vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.37k stars 1.84k forks source link

`turbo prune` broken w/ pnpm@v9 lockfile using injected dependencies #8243

Open gerbyzation opened 5 months ago

gerbyzation commented 5 months ago

Verify canary release

Link to code that reproduces this issue

https://github.com/gerbyzation/pnpm-v9-turbo-prune-injected-deps-repro

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

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

2.0.0-canary.0

Describe the Bug

When a workspace uses injected dependencies and the new pnpm lockfile format turbo prune will break with the following error:

❯ pnpm exec turbo prune --scope application
Generating pruned monorepo for application in /Users/gerbenneven/projects/pnpm-turbo-prune-repro/out
 - Added application
 - Added library
  × No lockfile entry found for 'link:../../../libraries/library'

Expected Behavior

turbo prune --scope application should create a directory with pruned repo

To Reproduce

Clone and follow steps in https://github.com/gerbyzation/pnpm-v9-turbo-prune-injected-deps-repro for repro

Additional context

No response

ErikLysne commented 2 months ago

Any updates on this? It's preventing me from upgrading to pnpm@9.

gerbyzation commented 2 months ago

Same here still. For context injected dependencies are necessary for monorepo's where both apps and libraries co-exist and the libraries have peerdependencies. This is fairly common especially when working with react for examle. Without injecting the library it would resolve to it's dev depenendency instead of the dependency used in the parent project(s).

ErikLysne commented 2 months ago

Yes, or when developing libraries and apps around NestJS, where both the libraries and apps must share a single instance of the @nestjs/core package for dependency injection to work properly.

GabrielGil commented 1 month ago

This is still happening for me, and it breaks the creation of Docker images of many apps.

It'd be great if the team could allocate some time to fix it. I'd be happy to contribute, but I have no idea of where to start in this codebase.

I've created an example repo that reprodudes it. Basically when using dependenciesMeta with a package of the workspace that is injected, the turbo prune APP --docker returns this message for me:

 - Added ui-library
 - Added user-service
  × No lockfile entry found for 'file:libs/utils-v2(encoding@0.1.13)'

Here's the reproduction: https://stackblitz.com/edit/vitejs-vite-rusctn?file=package.json