Skip to content

fix(pnpm): read linkWorkspacePackages from pnpm-workspace.yaml#10391

Merged
chris-olszewski merged 5 commits intomainfrom
chrisolszewski/turbo-4683-turbo-doesnt-respect-preferworkspacepackages
Apr 28, 2025
Merged

fix(pnpm): read linkWorkspacePackages from pnpm-workspace.yaml#10391
chris-olszewski merged 5 commits intomainfrom
chrisolszewski/turbo-4683-turbo-doesnt-respect-preferworkspacepackages

Conversation

@chris-olszewski
Copy link
Copy Markdown
Contributor

Description

Fixes #10387 by adding partial support for the new configuration location added in pnpm/pnpm#9121. There will be future work to add additional configuration options that lived in .npmrc and package.json to the YAML definition.

I highly suggest reviewing the first 2 commits on their own as they are prefactors. They both get a slightly smaller to slimming down the impl PackageManager so we can move to an interface instead of a single struct with matchs for every package manager x version.

Testing Instructions

Added new unit tests for this behavior, also manually verified behavior change in repro provided in #10387. Note that after this PR the topological ^lint dependency is correctly applied so the application lints to not start until @repo/lint completes.

Before

[0 olszewski@macbookpro] /tmp/turbo-respect-pnpm-configs $ turbo lint                         
turbo 2.5.2

• Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web
• Running lint in 5 packages
• Remote caching disabled
┌ web#lint > cache miss, executing b9dab19525365b14 
│ 
│ 
│ > [email protected] lint /private/tmp/turbo-respect-pnpm-configs/apps/web
│ > next lint --max-warnings 0
└────>
┌ docs#lint > cache miss, executing 72e63e1338f32778 
│ 
│ 
│ > [email protected] lint /private/tmp/turbo-respect-pnpm-configs/apps/docs
│ > next lint --max-warnings 0
└────>
┌ @repo/ui#lint > cache miss, executing 1e7e4e418db8cf29 
│ 
│ 
│ > @repo/[email protected] lint /private/tmp/turbo-respect-pnpm-configs/packages/ui
│ > echo 'failing lint' && exit 1
│ 
│ failing lint
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/private/tmp/turbo-respect-pnpm-configs/packages/ui) /User
│ s/olszewski/.nvm/versions/node/v22.13.0/bin/pnpm run lint exited (1)
└────>
@repo/ui#lint: command (/private/tmp/turbo-respect-pnpm-configs/packages/ui) /Users/olszewski/.nvm/versions/node/v22.13.0/bin/pnpm run lint exited (1)

 Tasks:    0 successful, 3 total
Cached:    0 cached, 3 total
  Time:    1.096s 
Failed:    @repo/ui#lint

 ERROR  run failed: command  exited (1)

After

[1 olszewski@macbookpro] /tmp/turbo-respect-pnpm-configs $ turbo_dev --skip-infer lint            
turbo 2.5.2

• Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web
• Running lint in 5 packages
• Remote caching disabled
┌ @repo/ui#lint > cache miss, executing 5e80cac629794173 
│ 
│ 
│ > @repo/[email protected] lint /private/tmp/turbo-respect-pnpm-configs/packages/ui
│ > echo 'failing lint' && exit 1
│ 
│ failing lint
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/private/tmp/turbo-respect-pnpm-configs/packages/ui) /User
│ s/olszewski/.nvm/versions/node/v22.13.0/bin/pnpm run lint exited (1)
└────>
@repo/ui#lint: command (/private/tmp/turbo-respect-pnpm-configs/packages/ui) /Users/olszewski/.nvm/versions/node/v22.13.0/bin/pnpm run lint exited (1)

 Tasks:    0 successful, 1 total
Cached:    0 cached, 1 total
  Time:    363ms 
Failed:    @repo/ui#lint

 ERROR  run failed: command  exited (1)

@chris-olszewski chris-olszewski requested a review from a team as a code owner April 27, 2025 19:35
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 0:43am

Comment thread crates/turborepo-repository/src/package_manager/pnpm.rs Outdated
@turbo-orchestrator turbo-orchestrator bot added the area: ci Internal CI for vercel/turborepo label Apr 28, 2025
@chris-olszewski chris-olszewski enabled auto-merge (squash) April 28, 2025 12:42
@chris-olszewski chris-olszewski merged commit db8427b into main Apr 28, 2025
40 checks passed
@chris-olszewski chris-olszewski deleted the chrisolszewski/turbo-4683-turbo-doesnt-respect-preferworkspacepackages branch April 28, 2025 13:08
@anthonyshew anthonyshew mentioned this pull request Apr 28, 2025
chris-olszewski added a commit that referenced this pull request Jun 10, 2025
### Description

Closes #10528

With #10391 we started reading
`linkWorkspacePackages` from `pnpm-workspace.yaml`. This caused issues
with single package vs monorepo detection as `deep` is a valid value
here and we only expected a boolean. This would cause a detection of a
single package repo and we would swallow the error of
`pnpm-workspace.yaml` not parsing due to the usage of `deep`.

This PR adds support for [`deep` on the parsing
end](https://pnpm.io/settings#linkworkspacepackages)

Follow up PR is to have noisy warnings if we find a
`pnpm-workspace.yaml`, but do not understand it.

### Testing Instructions

Added a red/green test. Verified with
https://github.com/ocavue/starter-monorepo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci Internal CI for vercel/turborepo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Turborepo doesn't respect preferWorkspacePackages in pnpm configuration

2 participants