prune

Generate a partial monorepo for a target package. The output will be placed into a directory named out containing the following:

  • The full source code of all internal packages needed to build the target.
  • A pruned lockfile containing the subset of the original lockfile needed to build the target.
  • A copy of the root package.json.
Terminal
turbo prune [package]

Example

Starting with a repository with the following structure:

package.json
pnpm-lock.yaml

Run turbo prune frontend to generate a pruned workspace for the frontend application in an out directory:

package.json
pnpm-lock.yaml (partial)

Options

--docker

Defaults to false.

Alter the output directory to make it easier to use with Docker best practices and layer caching. The directory will contain:

  • A folder named json with the pruned workspace's package.json files.
  • A folder named full with the pruned workspace's full source code for the internal packages needed to build the target.
  • A pruned lockfile containing the subset of the original lockfile needed to build the target.

Using the same example from above, running turbo prune frontend --docker will generate the following:

pnpm-lock.yaml (partial)
package.json (from repo root)
package.json (from repo root)
package.json
package.json
package.json

--out-dir <path>

Defaults to ./out.

Customize the directory the pruned output is generated in.

hours

Total Compute Saved
Get started with
Remote Caching →

On this page