turbo prune <scope>...
Generate a sparse/partial monorepo with a pruned lockfile for a target workspace.
This command will generate folder called out
with the following inside of it:
- The full source code of all internal workspaces that are needed to build the target
- A new pruned lockfile that only contains the pruned subset of the original root lockfile with the dependencies that are actually used by the workspaces in the pruned workspace.
- A copy of the root
package.json
. # Folder full source code for all workspaces needed to build the target
├── package.json # The root `package.json`
├── packages
│ ├── ui
│ │ ├── package.json
│ │ ├── src
│ │ │ └── index.tsx
│ │ └── tsconfig.json
│ ├── shared
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── __tests__
│ │ │ │ ├── sum.test.ts
│ │ │ │ └── tsconfig.json
│ │ │ ├── index.ts
│ │ │ └── sum.ts
│ │ └── tsconfig.json
│ └── frontend
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── src
│ │ └── pages
│ │ └── index.tsx
│ └── tsconfig.json
└── yarn.lock # The pruned lockfile for all targets in the subworkspace
Options
--docker
type: boolean
Default to false
. Passing this flag will alter the outputted folder with the pruned workspace to make it easier to use with Docker best practices / layer caching (opens in a new tab).
With the --docker
flag. The prune
command will generate folder called out
with the following inside of it:
- A folder
json
with the pruned workspace'spackage.json
s - A folder
full
with the pruned workspace's full source code, but only including the internal packages that are needed to build the target. - A new pruned lockfile that only contains the pruned subset of the original root lockfile with the dependencies that are actually used by the packages in the pruned workspace.
.
├── full # Folder full source code for all package needed to build the target
│ ├── package.json
│ └── packages
│ ├── ui
│ │ ├── package.json
│ │ ├── src
│ │ │ └── index.tsx
│ │ └── tsconfig.json
│ ├── shared
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── __tests__
│ │ │ │ ├── sum.test.ts
│ │ │ │ └── tsconfig.json
│ │ │ ├── index.ts
│ │ │ └── sum.ts
│ │ └── tsconfig.json
│ └── frontend
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── src
│ │ └── pages
│ │ └── index.tsx
│ └── tsconfig.json
├── json # Folder containing just package.jsons for all targets in the subworkspace
│ ├── package.json
│ └── packages
│ ├── ui
│ │ └── package.json
│ ├── shared
│ │ └── package.json
│ └── frontend
│ └── package.json
└── yarn.lock # The pruned lockfile for all targets in the subworkspace
--out-dir
Default: ./out
Customize the directory the pruned output is generated in.