turbo icon indicating copy to clipboard operation
turbo copied to clipboard

[turborepo] `turbo prune` creates broken `pnpm-lock.yaml`

Open dlehmhus opened this issue 3 years ago • 0 comments

What version of Turborepo are you using?

1.6.3

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Describe the Bug

turbo prune --scope="<app-name>" --docker creates broken/incomplete pnpm-lock.yaml file, which leads to ERR_PNPM_ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY and ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE errors .

Expected Behavior

Pruned pnpm-lock.yaml lock file should still contain every needed dependency and pruned output should also include packages that a referenced from the project root (but are not inside the --scope)

To Reproduce

git clone https://github.com/dlehmhus/pnpm-prune-root-issue-example
cd pnpm-prune-root-issue-example/
docker build -f apps/web/Dockerfile -t "pnpm-prune-example" .

or, to inspect the output:

pnpm exec turbo prune --scope="web" --docker

if you take a look at the generated pnpm-lock.yaml you can see two issues:

  1. apps/web references 13.0.4_biqbaboplfbrettd7655fr4n2y, but that dependency doesn't exists in the pruned pnpm-lock.yaml
  2. . (projet root) links to link:packages/package-for-ci but that doesn't exist in out/json

Reproduction Repo

https://github.com/dlehmhus/pnpm-prune-root-issue-example

dlehmhus avatar Nov 22 '22 12:11 dlehmhus