Skip to content

@simplysf/simply-package

Utilities for working with packages

Terminal window
sf plugins install @simplysf/simply-package

List the components of a package installed in an org.

USAGE
$ sf simply package component list -o <value> -p <value> [--json] [--flags-dir <value>] [--api-version <value>]
FLAGS
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-p, --package=<value> (required) The installed package: its name, its 0A3 installed-package ID, or its 033
subscriber package ID.
--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
List the components of a package installed in an org.
Lists every component of an installed package, as the package's View Components page in Setup shows it, with whether
Setup offers a Remove link for it.
Names, parents, and types are the labels Setup shows, not API names: a custom field is listed by its field label, with
its object's label as the parent. To remove a component with "sf simply package component remove", name it the way
package.xml does (Type:FullName, such as CustomField:Account.Region__c), or use the ID from this list.
Setup can only remove components from a no-namespace unlocked package, so a package with a namespace is refused.
EXAMPLES
List the components of the "my-core" package installed in the org with alias "my-sandbox":
$ sf simply package component list --target-org my-sandbox --package my-core
List them as JSON, by subscriber package ID:
$ sf simply package component list --target-org my-sandbox --package 033xx00000000AAAAA --json
FLAG DESCRIPTIONS
-p, --package=<value> The installed package: its name, its 0A3 installed-package ID, or its 033 subscriber package ID.
A name is matched exactly first, then without regard to case. When nothing matches, the error lists the packages
installed in the org.

See code: lib/commands/simply/package/component/list.js

Remove components from a package installed in an org, without deleting them from the org.

USAGE
$ sf simply package component remove -o <value> -p <value> [--json] [--flags-dir <value>] [--api-version <value>] [-c <value>...]
[-x <value>] [--dry-run] [--no-prompt]
FLAGS
-c, --component=<value>... A component to remove, as Type:FullName or a record ID. Repeat the flag for more than one.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-p, --package=<value> (required) The installed package: its name, its 0A3 installed-package ID, or its 033
subscriber package ID.
-x, --manifest=<value> A package.xml that lists the components to remove.
--api-version=<value> Override the api version used for api requests made by this command
--dry-run Show what would be removed, without removing anything.
--no-prompt Remove without asking for confirmation. Required with --json or without a terminal.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Remove components from a package installed in an org, without deleting them from the org.
Does what the Remove link on an installed package's View Components page in Setup does, for many components at once:
each component stops belonging to the package but stays in the org, as unmanaged metadata. Use it to move metadata
from one package to another, or to break up a package, before the package that will own the metadata next is
installed. Only no-namespace unlocked packages are supported, because Setup offers Remove only for those. Salesforce
has no API for this, so the command uses the Setup page with your org's access token.
Name each component the way package.xml does, as Type:FullName with a case-sensitive Metadata API type
(CustomField:Account.Region__c), or by its 15- or 18-character record ID. You can also pass a package.xml with
--manifest. Wildcard ("*") members aren't supported.
Every component is looked up before anything is removed, so one that doesn't exist in the org fails the whole run and
nothing is removed. The command then shows what it will remove and asks for confirmation. A component that exists but
isn't in the package is reported as "Not in package" and isn't an error, so running the same removal again is safe.
Each removal is checked by reloading the page; one that didn't take is reported as "Failed", the rest still run, and
the command exits with a non-zero code.
Removing a custom object doesn't remove its fields, validation rules, or list views from the package. Name them too,
or run "sf simply package component list" afterwards to check what's left.
The command asks for confirmation only in a terminal. With --json, or when there is no terminal (as in CI), pass
--no-prompt, or the command stops without removing anything.
EXAMPLES
Remove an Apex class and a custom field from the "my-core" package in the org with alias "my-sandbox":
$ sf simply package component remove --target-org my-sandbox --package my-core --component \
ApexClass:AccountsService --component CustomField:Account.Region__c
Show what would be removed for every component in a package.xml:
$ sf simply package component remove --target-org my-sandbox --package my-core --manifest manifest/package.xml \
--dry-run
Remove them in CI, without a prompt:
$ sf simply package component remove --target-org production --package my-core --manifest manifest/package.xml \
--no-prompt
FLAG DESCRIPTIONS
-c, --component=<value>... A component to remove, as Type:FullName or a record ID. Repeat the flag for more than one.
The type is a Metadata API type name as package.xml uses it, and is case-sensitive: CustomField:Account.Region__c,
ApexClass:MyClass, ValidationRule:Account.Require_Region. A 15- or 18-character record ID is used as is. Can't be
used with --manifest.
-p, --package=<value> The installed package: its name, its 0A3 installed-package ID, or its 033 subscriber package ID.
A name is matched exactly first, then without regard to case. When nothing matches, the error lists the packages
installed in the org.
-x, --manifest=<value> A package.xml that lists the components to remove.
Each member of each type becomes a Type:FullName component. A "*" member is refused, and so is a manifest with no
members. Can't be used with --component.

See code: lib/commands/simply/package/component/remove.js

Git-clone the source repositories of a Salesforce project’s package dependencies.

USAGE
$ sf simply package dependencies clone [--json] [--flags-dir <value>] [-d <value>] [-r] [--depth <value>] [-u]
[--dry-run]
FLAGS
-d, --output-dir=<value> [default: ..] Directory to clone into, relative to the project root.
-r, --recursive Also clone the dependencies of each dependency, following each clone's own
sfdx-project.json.
-u, --update Fetch and update repositories that are already cloned.
--depth=<value> Create shallow clones with this many commits of history.
--dry-run Show what would be cloned, without running git.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Git-clone the source repositories of a Salesforce project's package dependencies.
Clones each package dependency declared in sfdx-project.json whose source repository is given under
plugins.simply.packages, so you can review the metadata the project depends on. Nothing is installed in an org.
Each plugins.simply.packages entry is keyed by package alias. Its "repository" gives a git "url", plus an optional
"ref" (branch, tag, or commit SHA) and "path" (the subdirectory holding the repository's own sfdx-project.json). A key
matches a dependency's "package" value exactly, or up to its first "@", so a key such as "fflib" keeps matching as the
dependency moves from "fflib@3.0.0-1" to "fflib@3.1.0-2". A key also matches through packageAliases: a dependency
written as a bare ID (0Ho… or 04t…) matches the key of any alias, or alias prefix, that packageAliases maps to that
ID.
The command runs your own git, so any host works (GitHub, GitLab, self-hosted servers) with the SSH keys or credential
helper you already use. A url that contains credentials is rejected. Nothing prompts for input: a missing credential
fails that dependency's row, and so do an unknown ssh host key and a key passphrase, unless you've set your own ssh
command. Dependencies with no mapping, such as AppExchange packages, are reported as "No repository".
Each repository is cloned into a folder named after it, next to the project by default. A folder that already holds a
clone of the same repository is reused.
With --recursive, your own plugins.simply.packages entries always come first. A dependency's sfdx-project.json can
supply a repository only for a package you don't map, and only as an https or ssh URL. Each repository that comes from
one is named in the output.
Cloning runs nothing from the repositories: no install scripts, no git hooks, and no submodules. Treat the clones as
untrusted code until you've reviewed them. Opening one in an editor that trusts the folder, running npm install or its
scripts, or deploying its metadata can run code it contains.
EXAMPLES
Clone the direct dependencies of the project in the current directory, next to it:
$ sf simply package dependencies clone
Clone every dependency, including dependencies of dependencies, as shallow clones into a "deps" folder:
$ sf simply package dependencies clone --recursive --depth 1 --output-dir ../deps
Bring existing clones up to date with their configured refs:
$ sf simply package dependencies clone --update
Preview what would be cloned:
$ sf simply package dependencies clone --recursive --dry-run
FLAG DESCRIPTIONS
-d, --output-dir=<value> Directory to clone into, relative to the project root.
Each repository goes into "<output-dir>/<repository name>". The default, "..", puts clones next to the project. When
two different repositories share a name, the second folder is prefixed with its group or owner.
-u, --update Fetch and update repositories that are already cloned.
A clone on the configured branch is fast-forwarded, and a clone at a detached HEAD (after a tag or SHA) is checked
out at the configured ref. A clone with uncommitted changes, or on some other branch, is left alone and reported as
skipped, because it may be your own working copy. The exception is a clone still on the remote's default branch with
no commits of its own, such as one made before "ref" was set: it moves to the configured ref. A clone that follows a
branch, including the default branch when no "ref" is set, gets that branch's newest commits; set "ref" to a tag to
stay on one version.
--depth=<value> Create shallow clones with this many commits of history.
Passed to "git clone --depth". A dependency pinned to a commit SHA always gets a full clone, because a shallow clone
can't check out an arbitrary commit.

See code: lib/commands/simply/package/dependencies/clone.js

Install package dependencies for a Salesforce project.

USAGE
$ sf simply package dependencies install -o <value> [--json] [--flags-dir <value>] [-a all|package] [--api-version <value>] [-z
<value>] [-i All|Delta|Upgrade] [-k <value>...] [-r] [--output-file <value>] [--package-retry-attempts <value>...]
[-b <value>] [--retry-attempts <value>] [--retry-backoff <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: Upgrade] Install all packages, only deltas, or only newer versions.
<options: All|Delta|Upgrade>
-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.
-r, --no-prompt Don't prompt for confirmation.
-s, --security-type=<option> [default: AdminsOnly] Security access type for the installed package.
(deprecation notice: The default --security-type value will change from
AllUsers to AdminsOnly in v47.0 or later.)
<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 specifiying a Package/VersionNumber
combination
--api-version=<value> Override the api version used for api requests made by this command
--output-file=<value> Path to write a JSON install report to.
--package-retry-attempts=<value>... Number of retry attempts for a specific package, overriding --retry-attempts
for that package only.
--retry-attempts=<value> Number of additional attempts to make if a package install fails, before
giving up on that package. Defaults to 0 (no retries). Does not apply when
the install is still In-Progress when polling times out, since retrying could
race or duplicate an install that may still complete server-side. Overridden
per-package by --package-retry-attempts.
--retry-backoff=<value> [default: 2] Factor the delay between install retries grows by after each
failed attempt (e.g. 2 doubles the delay each time). Only relevant when a
package has retries enabled via --retry-attempts or --package-retry-attempts.
Applies to every package's retries; there is no per-package override.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Install package dependencies for a Salesforce project.
Installs all specified package dependencies in a Salesforce DX project using the sfdx-project.json definition.
EXAMPLES
$ sf simply package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub
$ sf simply package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --installation-key "MyPackage1Alias:MyPackage1Key"
$ sf simply package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --installation-key "MyPackage1Alias:MyPackage1Key" --installation-key "MyPackage2Alias:MyPackage2Key"
$ sf simply package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --output-file install-report.json
$ sf simply package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --retry-attempts 3 --retry-backoff 2
$ sf simply package dependencies install --target-org myTargetOrg --target-dev-hub myTargetDevHub --retry-attempts 1 --package-retry-attempts "MyPackage1Alias:5"
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|Upgrade Install all packages, only deltas, or only newer versions.
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. If 'Upgrade' is specified, then a package is installed only if it isn't
already installed, or if its semantic version (major.minor.patch.build) is newer than the version currently
installed in the org; packages with an installed version that is the same as or newer than the target version are
skipped.
-k, --installation-key=<value>... Installation key for key-protected packages
Installation key for key-protected packages in the key:value format of SubscriberPackageVersionId:Key
-r, --no-prompt Don't prompt for confirmation.
Allows the following without an 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 specifiying 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.
--output-file=<value> Path to write a JSON install report to.
When specified, a JSON report of the install outcome for every resolved dependency is written to this path, in
addition to the normal terminal output you can continue to monitor as the command runs. Each entry includes the
package name, the SubscriberPackageVersionId already installed in the org (if any), the SubscriberPackageVersionId
that was attempted, and the decision made (Skipped, Installed, Installing, or Failed).
--package-retry-attempts=<value>...
Number of retry attempts for a specific package, overriding --retry-attempts for that package only.
Retry attempts for a specific package in the key:value format of SubscriberPackageVersionId:RetryAttempts. You can
use an alias in place of the SubscriberPackageVersionId. Repeat this flag to set overrides for multiple packages.
Packages not listed here use --retry-attempts.

See code: lib/commands/simply/package/dependencies/install.js

Manage package dependency versions for a Salesforce project.

USAGE
$ sf simply package dependencies manage -v <value> [--json] [--flags-dir <value>] [-b <value>] [--update-to-released |
--update-to-latest] [--api-version <value>]
FLAGS
-b, --branch=<value> Package branch to consider when evaluating version options.
-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
--update-to-latest Automatically set all dependencies to the latest non-pinned build.
--update-to-released Automatically update all dependencies to the latest released version.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Manage package dependency versions for a Salesforce project.
Interactively updates package dependency versions in sfdx-project.json by querying the Dev Hub for available versions.
Supports interactive selection or automatic update to the latest released or latest build version.
Project-level configuration (in sfdx-project.json) is read from the following keys:
- plugins.simply.dependencies.ignore — array of Package2Ids or aliases to leave unchanged
- plugins.simply.package.brancheswithreleasedversions — array of branch names that contain released versions
EXAMPLES
$ sf simply package dependencies manage --target-dev-hub myDevHub
$ sf simply package dependencies manage --target-dev-hub myDevHub --branch my-feature-branch
$ sf simply package dependencies manage --target-dev-hub myDevHub --update-to-released
$ sf simply package dependencies manage --target-dev-hub myDevHub --update-to-latest
FLAG DESCRIPTIONS
-b, --branch=<value> Package branch to consider when evaluating version options.
When specified, the command will include the latest build on this branch as a selectable option for each dependency.
--update-to-latest Automatically set all dependencies to the latest non-pinned build.
When specified, all dependencies managed by the Dev Hub are automatically set to a non-pinned X.Y.Z.LATEST version
number without interactive prompts. Mutually exclusive with --update-to-released.
--update-to-released Automatically update all dependencies to the latest released version.
When specified, all dependencies managed by the Dev Hub are automatically updated to the latest released package
version without interactive prompts. Mutually exclusive with --update-to-latest.

See code: lib/commands/simply/package/dependencies/manage.js

Cleanup package versions.

USAGE
$ sf simply package version cleanup -p <value> -v <value> [--json] [--flags-dir <value>] [--api-version <value>] [-s <value>... |
-x <value>...]
FLAGS
-p, --package=<value> (required) Package Id
-s, --selector=<value>... One or more MAJOR.MINOR.PATCH values to select on
-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.
-x, --selector-exclude=<value>... One or more MAJOR.MINOR.PATCH values to exclude on
--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 one or more MAJOR.MINOR.PATCH selectors, either to select on or
to exclude on. Does not delete released package versions.
If --selector is provided, only the unreleased versions matching any of the given MAJOR.MINOR.PATCH values are
deleted. If --selector-exclude is provided instead, every unreleased version that does _not_ match any of the given
MAJOR.MINOR.PATCH values is deleted. Exactly one of --selector or --selector-exclude must be specified; each accepts
multiple values.
EXAMPLES
$ sf simply package version cleanup --package 0Hoxx00000000CqCAI --selector 2.10.0 --target-dev-hub myDevHub
$ sf simply package version cleanup --package 0Hoxx00000000CqCAI --selector 2.10.0 --selector 2.11.0 --target-dev-hub myDevHub
$ sf simply package version cleanup --package 0Hoxx00000000CqCAI --selector-exclude 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, --selector=<value>... One or more MAJOR.MINOR.PATCH values to select on
The MAJOR.MINOR.PATCH selector(s) that should be used to find package versions to delete. Only unreleased versions
matching any of the given selectors are deleted. Mutually exclusive with --selector-exclude.
-x, --selector-exclude=<value>... One or more MAJOR.MINOR.PATCH values to exclude on
The MAJOR.MINOR.PATCH selector(s) that should be used to find package versions to keep. Every unreleased version
that does not match any of the given selectors is deleted. Mutually exclusive with --selector.

See code: lib/commands/simply/package/version/cleanup.js

Get a package version from sfdx-project.json.

USAGE
$ sf simply package version get -p <value> [--json] [--flags-dir <value>] [-d <value>]
FLAGS
-d, --directory=<value> Package directory to search.
-p, --package=<value> (required) Package name or alias to look up.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Get a package version from sfdx-project.json.
Reads the version a package is declared at in your project's sfdx-project.json and prints it, so a script doesn't have
to parse the project file itself.
Both dependencies and the project's own package are searched. A dependency declared as an alias (test-package@0.1.0+2)
resolves to the version portion of the alias; a dependency declared as a package name plus a versionNumber resolves to
that versionNumber; a dependency declared as a raw ID resolves through packageAliases. A package directory that builds
the package resolves to that directory's versionNumber.
The version is returned exactly as it appears in the project file — no normalizing between the 0.1.0+2, 57.0.0-3, and
1.2.3.LATEST forms, since each means something to the tool that consumes it.
This command reads the project file only. It never contacts an org or a Dev Hub, so it can run in a pipeline before
any authentication step.
EXAMPLES
Get the version of a dependency:
$ sf simply package version get --package test-package
Get the version of the package the project itself builds:
$ sf simply package version get --package my-package
Get a dependency's version from one package directory:
$ sf simply package version get --package test-package --directory force-app
FLAG DESCRIPTIONS
-d, --directory=<value> Package directory to search.
The path of a single package directory to search, matching a "path" value in packageDirectories. Use this when the
same package is declared at different versions in more than one package directory.
-p, --package=<value> Package name or alias to look up.
The package name as it appears in sfdx-project.json, without a version suffix. For a dependency declared as
"test-package@0.1.0+2", pass "test-package".

See code: lib/commands/simply/package/version/get.js