# @dx-cli-toolbox/sfdx-toolbox-package-utils 中文文档

规范地址：https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/

版本：1\.0\.2
npm 元数据更新时间：2025-04-15T12:32:12.413Z
中文译文更新时间：2026-11-14T15:24:48.595Z
软件包许可：BSD-3-Clause

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils
原文对照：https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/?lang=original
项目主页：https://github.com/ImJohnMDaniel/sfdx-toolbox-package-utils
源码仓库：https://github.com/ImJohnMDaniel/sfdx-toolbox-package-utils

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：674 kB，23 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=18\.0\.0
- 运行依赖：7 个
- 首次发布：2020-01-16T20:33:06.218Z
- 最新版本发布：2025-04-15T12:32:12.214Z
- 近 30 天下载量：2006（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：29（近 12 个月 0 个）

## 中文简介

更好地管理销售力DX软件包的公用事业

## 安装

```sh
npm install @dx-cli-toolbox/sfdx-toolbox-package-utils
```

也可以使用：`pnpm add @dx-cli-toolbox/sfdx-toolbox-package-utils`、`yarn add @dx-cli-toolbox/sfdx-toolbox-package-utils`、`bun add @dx-cli-toolbox/sfdx-toolbox-package-utils`

## README

# @dx-cli-toolbox/sfdx-toolbox-package-utils (英语)

更好地管理销售力DX软件包的公用事业

# 目录

-   [@dx-cli-toolbox/sfdx-toolbox-package-utils (英语)](https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/#readme-dx-cli-toolboxsfdx-toolbox-package-utils)
-   [目录](https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/#readme-contents)
-   [设置](https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/#readme-setup)
-   [图标](https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/#readme-commands)

# 设置

### **作为销售力DX插件安装**

```
sfdx plugins:install @dx-cli-toolbox/sfdx-toolbox-package-utils
```

您将被提示确认您想要安装一个未签名的插件 。 选择"是"

```
This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?: y
```

要将此插件白化, [在 $HOME/.config/sfdx/未签名的Plugin WhiteList.json 中添加条目](https://developer.salesforce.com/blogs/2017/10/salesforce-dx-cli-plugin-update.html)。 。 。 .

### **从源安装**

1.  清除仓库

```
git clone https://github.com/ImJohnMDaniel/sfdx-toolbox-package-utils.git
```

2.  链接插件 :

```
sfdx plugins:link .
```

# 图标

-   [`sf toolbox package dependencies install`](https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/#readme-sf-toolbox-package-dependencies-install)
-   [`sf toolbox package version cleanup`](https://npmcn.com/package/%40dx-cli-toolbox/sfdx-toolbox-package-utils/#readme-sf-toolbox-package-version-cleanup)

## `sf toolbox package dependencies install`

安装 Salesforce 项目的软件包依赖性 .

```
USAGE
  $ sf toolbox package dependencies install -o <value> [--json] [--flags-dir <value>] [-a all|package] [--api-version <value>] [-z
    <value>] [-i All|Delta] [-k <value>...] [-p] [-b <value>] [-s AllUsers|AdminsOnly] [-v <value>] [-t
    DeprecateOnly|Mixed|Delete] [-w <value>]

FLAGS
  -a, --apex-compile=<option>        Compile all Apex in the org and package, or only Apex in the package; unlocked
                                     packages only.
                                     <options: all|package>
  -b, --publish-wait=<value>         Maximum number of minutes to wait for the Subscriber Package Version ID to become
                                     available in the target org before canceling the install request.
  -i, --install-type=<option>        [default: Delta] Install all packages or only deltas.
                                     <options: All|Delta>
  -k, --installation-key=<value>...  Installation key for key-protected packages
  -o, --target-org=<value>           (required) Username or alias of the target org. Not required if the `target-org`
                                     configuration variable is already set.
  -p, --prompt                       Prompt for confirmation.
  -s, --security-type=<option>       [default: AdminsOnly] Security access type for the installed package.
                                     <options: AllUsers|AdminsOnly>
  -t, --upgrade-type=<option>        [default: Mixed] Upgrade type for the package installation; available only for
                                     unlocked packages.
                                     <options: DeprecateOnly|Mixed|Delete>
  -v, --target-dev-hub=<value>       Username or alias of the Dev Hub org.
  -w, --wait=<value>                 Number of minutes to wait for installation status.
  -z, --branch=<value>               Package branch to consider when specifiyng a Package/VersionNumber combination
      --api-version=<value>          Override the api version used for api requests made by this command

GLOBAL FLAGS
  --flags-dir=<value>  Import flag values from a directory.
  --json               Format output as json.

DESCRIPTION
  Installs package dependencies for a Salesforce project.

  Installs package dependencies for a Salesforce project specified in the sfdx-project.json file.

EXAMPLES
  $ sf toolbox package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub

  $ sf toolbox package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --installation-key "MyPackage1Alias:MyPackage1Key"

  $ sf toolbox package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --installation-key "MyPackage1Alias:MyPackage1Key" --installation-key "MyPackage2Alias:MyPackage2Key"

FLAG DESCRIPTIONS
  -a, --apex-compile=all|package

    Compile all Apex in the org and package, or only Apex in the package; unlocked packages only.

    Applies to unlocked packages only. Specifies whether to compile all Apex in the org and package, or only the Apex in
    the package.

    For package installs into production orgs, or any org that has Apex Compile on Deploy enabled, the platform compiles
    all Apex in the org after the package install or upgrade operation completes.

    This approach assures that package installs and upgrades don’t impact the performance of an org, and is done even if
    --apex-compile package is specified.

  -i, --install-type=All|Delta  Install all packages or only deltas.

    If 'All' is specified, then all packages specified in package dependencies are installed, regardless of if the
    version already is installed in the org. If 'Delta' is specified, then only packages that differ from what is
    installed in the org will be installed.

  -k, --installation-key=<value>...  Installation key for key-protected packages

    Installation key for key-protected packages in the key:value format of SubscriberPackageVersionId:Key. Specify
    multiple "--installation-key" flags for more than one key

  -p, --prompt  Prompt for confirmation.

    Require explicit confirmation response: 1) Remote Site Settings and Content Security Policy websites to send or
    receive data, and 2) --upgrade-type Delete to proceed.

  -t, --upgrade-type=DeprecateOnly|Mixed|Delete

    Upgrade type for the package installation; available only for unlocked packages.

    For package upgrades, specifies whether to mark all removed components as deprecated (DeprecateOnly), to delete
    removed components that can be safely deleted and deprecate the others (Mixed), or to delete all removed components,
    except for custom objects and custom fields, that don't have dependencies (Delete). The default is Mixed. Can
    specify DeprecateOnly or Delete only for unlocked package upgrades.

  -z, --branch=<value>  Package branch to consider when specifiyng a Package/VersionNumber combination

    For dependencies specified by Package/VersionNumber combination, you can specify the branch group of builds to work
    from by entering the branch build name. If not specified, the builds from NULL branch will be considered.
```

_参见代码 : [src/commands/工具箱/包装/依赖/安装](https://github.com/ImJohnMDaniel/sfdx-toolbox-package-utils/blob/1.0.2/src/commands/toolbox/package/dependencies/install.ts)_

## `sf toolbox package version cleanup`

清理包版本.

```
USAGE
  $ sf toolbox package version cleanup -s <value> -p <value> -v <value> [--json] [--flags-dir <value>] [--api-version
  <value>]

FLAGS
  -p, --package=<value>         (required) Package Id
  -s, --matcher=<value>         (required) MAJOR.MINOR.PATCH
  -v, --target-dev-hub=<value>  (required) Username or alias of the Dev Hub org. Not required if the `target-dev-hub`
                                configuration variable is already set.
      --api-version=<value>     Override the api version used for api requests made by this command

GLOBAL FLAGS
  --flags-dir=<value>  Import flag values from a directory.
  --json               Format output as json.

DESCRIPTION
  Cleanup package versions.

  Delete package versions for a given package provided a MAJOR.MINOR.PATCH matcher. Does not delete released pacakge
  versions.

EXAMPLES
  $ sf toolbox package version cleanup --package 0Hoxx00000000CqCAI --matcher 2.10.0 --target-dev-hub myDevHub

FLAG DESCRIPTIONS
  -p, --package=<value>  Package Id

    The 0Ht Package Id that you wish to cleanup versions for.

  -s, --matcher=<value>  MAJOR.MINOR.PATCH

    The MAJOR.MINOR.PATCH matcher that should be used to find package versions to delete.
```

_参见代码 : [src/commands/工具箱/包装/版本/清理.ts](https://github.com/ImJohnMDaniel/sfdx-toolbox-package-utils/blob/1.0.2/src/commands/toolbox/package/version/cleanup.ts)_

## 常见问题

### @dx-cli-toolbox/sfdx-toolbox-package-utils 是什么？

更好地管理销售力DX软件包的公用事业

### 如何安装 @dx-cli-toolbox/sfdx-toolbox-package-utils？

在项目目录运行 npm install @dx-cli-toolbox/sfdx-toolbox-package-utils，或使用 pnpm add / yarn add / bun add。

### @dx-cli-toolbox/sfdx-toolbox-package-utils 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/dx-cli-toolbox\_\_sfdx-toolbox-package-utils 是否存在。

### @dx-cli-toolbox/sfdx-toolbox-package-utils 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @dx-cli-toolbox/sfdx-toolbox-package-utils 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @dx-cli-toolbox/sfdx-toolbox-package-utils 可以商用吗？

@dx-cli-toolbox/sfdx-toolbox-package-utils 使用 BSD-3-Clause 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括，不构成法律意见，请以许可原文为准。

### @dx-cli-toolbox/sfdx-toolbox-package-utils 的下载量有多少？

根据 npm 官方下载统计，@dx-cli-toolbox/sfdx-toolbox-package-utils 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,006 次，日均约 67 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @dx-cli-toolbox/sfdx-toolbox-package-utils 还在维护吗？

最新版本 1\.0\.2 发布于 2025/04/15（1\.6 年前）；至今共发布 29 个版本，其中过去 12 个月发布了 0 个；首次发布于 2020/01/17。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

