-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[turborepo] prune package-lock.json not stable #4510
Labels
Comments
darthmaim
added
area: turborepo
kind: bug
Something isn't working
needs: triage
New issues get this label. Remove it after triage
labels
Apr 9, 2023
A workaround is to sort the -RUN npm i -g turbo
+RUN npm i -g turbo sort-json
COPY . .
-RUN turbo prune --scope=worker --docker
+RUN turbo prune --scope=worker --docker && sort-json out/package-lock.json This will ensure the package-lock.json is always the same as long as no dependencies changed and later build stages can be cached. |
chris-olszewski
added a commit
that referenced
this issue
Apr 10, 2023
### Description Fixes #4510 by using `BTreeMap` instead of a `HashMap` so we have stable ordering of the package entries. ### Testing Instructions Setup a monorepo using NPM as a package manager. Run `turbo prune --scope=web --out-dir=a && turbo prune --scope=web --out-dir=b && diff a/package-lock.json b/package-lock.json` and expect a zero exit code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
What version of Turborepo are you using?
1.8.8
What package manager are you using / does the bug impact?
npm
What operating system are you using?
Mac, Windows, docker
Describe the Bug
Running
turbo prune --scope=<workspace> --docker
multiple times always generates a different package-lock.json.This causes the docker build to never use the cache to install dependencies.
The keys in the generated JSON have a different order, see for example this screenshot:
This occurs on MacOS, Windows (WSL) and inside the docker build.
Expected Behavior
The generated package-lock.json should be stable to allow docker to cache the build step.
To Reproduce
npx turbo prune --scope=worker --docker
to create pruned outputout/package-lock.json
somewhere…npx turbo prune --scope=worker --docker
againThe reproduction repo is kinda large, maybe I will create a smaller repro in the coming days.
Reproduction Repo
https://github.com/GW2Treasures/gw2treasures.com/tree/9c86b97ea829b25ee89cc2b28a07ec36b1cd8a0d
The text was updated successfully, but these errors were encountered: