sfpm
Concepts

Dependency graph

How sfpm orders packages from their dependencies and runs independent packages in parallel.

sfpm builds a dependency graph from the workspace. A workspace: entry in a package's dependencies is an edge from that package to the package it needs. sfpm build, sfpm deploy, and sfpm install all run packages in graph order.

Levels and parallel runs

The graph is split into levels. A package goes in the first level where all of its dependencies are in an earlier level. Levels run one after another. Every package inside one level starts at the same time.

For this graph, where app needs core and logger, and core needs shared:

Level 0: shared, logger    no dependencies, run in parallel
Level 1: core              waits for shared
Level 2: app               waits for core and logger

Run one package and sfpm builds, deploys, or installs its whole dependency chain first. You do not list the dependencies yourself.

Transitive dependencies are included

By default, a run includes every package the named package depends on, directly or through another package. sfpm build app builds shared, logger, core, and app. sfpm deploy app and sfpm install app follow the same rule.

Each dependency goes through the same checks as the named package. A dependency with no source changes is skipped by the build. See caching.

Limiting a run with --no-dependencies

Pass --no-dependencies to sfpm build or sfpm deploy to run only the packages you named.

  • With one package, only that package runs.
  • With several packages, only those packages run, still in dependency order.

--turbo implies --no-dependencies. Turborepo runs the dependency tasks in that case. See caching.

sfpm install does not apply --no-dependencies. The install command passes every package its artifact provider resolves, including transitive ones, to the orchestrator, so the flag does not remove any package from an install.

When a package fails

Each package runs only after its dependencies finish. When a package fails:

  • Packages that depend on it directly are skipped.
  • Packages that depend only on a skipped package are not skipped by that rule. A skipped package is not added to the failed set, so its dependents can still run.
  • Packages that do not depend on the failed package keep running.
  • The command exits with an error that lists the failed packages.

Managed packages in the graph

Managed packages from managedDependencies are graph nodes too. Which commands include them depends on the command:

CommandManaged dependencies
sfpm buildNot included.
sfpm deployNot included.
sfpm deploy artifactInstalled.
sfpm installInstalled.

Next

On this page