sfpm
CLI reference

Deploy and install

Deploy from local source, deploy or install published artifacts, and publish built packages to npm.

Four commands move packages toward an org or a registry. They differ in where they read from and where they write to. Pick the one that matches what you have.

CommandReads fromWrites toUse it when
sfpm deployLocal project sourceTarget orgYou want to deploy the source in your working copy.
sfpm deploy artifactPublished artifacts from npmTarget orgYou want to deploy the source of published package versions.
sfpm installPublished artifacts from npmTarget orgYou want to install published packages, with installation keys where needed.
sfpm publishBuilt output in each dist/ directorynpm registryYou want to publish packages that sfpm build has built.

For the concepts behind deploy and install, see deploy vs install.

The deploy GitHub Action runs the artifact-install flow, the same kind of operation as sfpm deploy artifact, not sfpm deploy (which deploys from local project source). The action and the CLI command are not identical: check the action's action.yml for its own inputs and defaults rather than assuming full parity.

sfpm deploy

Deploys the named packages from the source in your project to the target org. Dependencies are included unless you pass --no-dependencies.

sfpm deploy <package> [<package>...] [flags]
FlagDefaultDescription
-o, --target-org <username>target-org from sf configTarget org username or alias. Env: SF_TARGET_ORG. Required. Falls back to the sf config default when unset.
-f, --forceonDeploys even when the package is already installed. Turn it off with --no-force.
--no-dependenciesoffDeploys only the named packages, without their transitive dependencies.
--no-hooksoffSkips lifecycle hooks for this run.
-l, --test-level <level>noneDeployment test level: NoTestRun, RunSpecifiedTests, RunLocalTests, or RunAllTestsInOrg.
--regression-testoffAccepted by the command, but currently has no effect: nothing passes it through to the step that would run dependent-package tests.
--turbooffSingle-package mode for external orchestrators. Requires exactly one package. Implies --no-dependencies and --force.

The shared flags --json, --plain, and --log-level also apply. See the CLI reference.

sfpm deploy artifact

Takes the same flags and arguments as sfpm deploy. The difference is the source. Before deploying, the command runs npm install --no-save for the named packages in the project root. That step fetches their published artifacts and any sfpm packages they depend on. The command then deploys the source from those artifacts to the target org.

Publish the packages first with sfpm publish, so the artifacts exist in the registry.

sfpm deploy artifact my-package -o my-sandbox

deploy artifact accepts --test-level because it inherits every flag from sfpm deploy, but the value is never passed through to the artifact install path. Setting it currently has no effect on this command.

sfpm install

Fetches the named packages and their sfpm dependencies from npm, then installs them into the target org. The fetch uses npm install --no-save, not pnpm. It runs in the project root and does not change package.json.

An artifact with a package version ID installs as a package version; installation keys apply to it. An unlocked package built at the default local validation level has no package version ID (it was built as a plain source package), so installing that artifact is a source deploy instead, the same as installing a source-type package.

sfpm install <package> [<package>...] -o my-sandbox [flags]
FlagDefaultDescription
-o, --target-org <username>noneTarget org username or alias. Env: SF_TARGET_ORG. Required. Unlike deploy, there is no sf config fallback.
-f, --forceoffReinstalls even when the package is already installed.
-k, --installation-key <key>noneInstallation key for unlocked packages. Repeatable. Pass <package>=<key> for one package, or a bare value as the default for all packages.
--no-dependenciesoffDeclared, but currently has no effect: install always resolves the named packages together with their transitive sfpm dependencies, regardless of this flag.
-l, --test-level <level>noneTest level for source deployments. Same values as sfpm deploy.
--regression-testoffAccepted by the command, but currently has no effect, same as on sfpm deploy.
--turbooffSingle-package mode for external orchestrators. Requires exactly one package. Implies --no-dependencies and --force.

install runs the install lifecycle hooks. It has no --no-hooks flag.

sfpm publish

Publishes packages from their dist/ directories to npm. Run sfpm build first. A package without a built dist/package.json is skipped with a warning.

With no arguments, or with all, the command publishes every package in the workspace. Each package is published by running pnpm publish --no-git-checks inside its dist/ directory.

FlagDefaultDescription
--tag <tag>latestnpm dist-tag to publish under, such as next.
--dry-runoffPasses --dry-run to pnpm, so nothing is published.
sfpm publish my-package --tag next --dry-run
sfpm publish all

Typical flow

sfpm build my-package
sfpm publish my-package
sfpm install my-package -o my-sandbox

Use sfpm deploy while you change source and want the working copy in an org. Use sfpm publish and then sfpm install or sfpm deploy artifact when the target should receive the published version.

This flow builds at the default local validation level, so the install step above is a source deploy, not a package-version install (see the note on sfpm install above). Add --validation org (or full) to sfpm build first if you need an actual package version installed.

On this page