turbo icon indicating copy to clipboard operation
turbo copied to clipboard

[turborepo] npm dependencies with peerDependencies in root package.json fails to clean-install from pruned artifacts

Open keawade opened this issue 2 years ago • 2 comments

What version of Turborepo are you using?

1.6.3

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

npm

What operating system are you using?

Mac

Describe the Bug

Attempting to run npm clean-install with the output of turbo prune fails if any of the dependencies in the root package.json include peer dependencies that are flagged as optional via the peerDependenciesMeta property.

This appears to be because due to a combination of the prune command trimming out the peerDependenciesMeta property and npm behaving slightly differently for root packages vs workspace packages.

Expected Behavior

I should be able to run npm clean-install on the output of turbo prune.

To Reproduce

  1. Set up a basic repo with turborepo
  2. Install a dependency that has an optional peer dependency in the repo root
    • The next package is a good example
  3. Run turbo prune --scope=<scope>
  4. Copy out/package-lock.json and the contents of out/json to a new directory
  5. Run npm clean-install in the new directory

I happened to be working with this in Docker containers so my reproduction repo does this in the Dockerfiles with turbo prune --docker.

Reproduction Repo

https://github.com/keawade/turbo-wat

keawade avatar Nov 16 '22 22:11 keawade

I'm ignorant of how turbo repo releases get released and I wasn't able to find any documentation describing it.

Could someone point me to documentation describing how/when releases are done around here or tell me when we might see the fix implemented in #2740 be released for use?

keawade avatar Nov 18 '22 19:11 keawade

@keawade we don't have a strict release cadence, but we usually cut a patch every ~2 weeks. We're in the middle of changing our release process so it might be slightly more delayed/only a canary would be released. @nathanhammond, I know the week has been crazy, but are close to cutting a canary?

chris-olszewski avatar Nov 22 '22 18:11 chris-olszewski

Howdy folks, just looking to follow up on this and see if there might be a release coming soon. 😄 😅

keawade avatar Dec 05 '22 13:12 keawade

@keawade it appears to me that the commit with the fix was released with https://github.com/vercel/turbo/releases/tag/v1.7.0 even though it is not called out in the release change log.

maybe @chris-olszewski can confirm to check my sanity though, I just compared the tag with the previous tag to confirm: https://github.com/vercel/turbo/compare/v1.6.3...v1.7.0

https://github.com/vercel/turbo/releases/tag/v1.7.0

derekaug avatar Jan 12 '23 17:01 derekaug