Skip to content

fix(deploy): copy .packageManager from the workspace to the deployed package.json - #11534

Closed
dcousens wants to merge 1 commit into
pnpm:mainfrom
dcousens:main
Closed

dcousens wants to merge 1 commit into
pnpm:mainfrom
dcousens:main

Conversation

@dcousens

@dcousens dcousens commented May 8, 2026 •

Copy link
Copy Markdown

(Hopefully a) fix for #9079

Summary by CodeRabbit

Bug Fixes

  • The pnpm deploy command now correctly copies the packageManager field from the workspace root configuration to the deployed package.json, ensuring consistent package manager settings across deployments.

@dcousens
dcousens requested a review from zkochan as a code owner May 8, 2026 03:24
Copilot AI review requested due to automatic review settings May 8, 2026 03:24
@dcousens dcousens changed the title copy .packageManager from the workspace to the deployed package fix(deploy): copy .packageManager from the workspace to the deployed package May 8, 2026
@coderabbitai

coderabbitai Bot commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the pnpm deploy command to optionally propagate the packageManager field from the workspace root manifest to deployed package manifests. The contract is extended with an optional rootProjectManifest parameter, the manifest assembly logic applies root packageManager when available, and the shared-lockfile deployment path wires in this new capability.

Changes

packageManager Propagation in Deploy

Layer / File(s) Summary
Contract/Options Interface
releasing/commands/src/deploy/createDeployFiles.ts
CreateDeployFilesOptions gains optional rootProjectManifest property with Pick<ProjectManifest, 'packageManager'> shape.
Manifest Assembly Logic
releasing/commands/src/deploy/createDeployFiles.ts
createDeployFiles destructures rootProjectManifest and prefers rootProjectManifest.packageManager over selectedProjectManifest.packageManager when constructing the deployed manifest.
Deployment Wiring
releasing/commands/src/deploy/deploy.ts
deployFromSharedLockfile passes rootProjectManifest: opts.rootProjectManifest into createDeployFiles options.
Release Documentation
.changeset/deploy-copy-package-manager.md
Changeset entry documents patch releases for @pnpm/releasing.commands and pnpm with the feature that pnpm deploy copies packageManager field from workspace package.json to deployed package.json.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops with glee,
For packageManager now flows free,
From root to deploy it shall go,
No more guessing, the field does show!
thump thump — a feature most neat!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately and concisely describes the main change: copying the .packageManager field from the workspace to the deployed package.json, which is the core functionality implemented across all modified files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@dcousens dcousens changed the title fix(deploy): copy .packageManager from the workspace to the deployed package fix(deploy): copy .packageManager from the workspace to the deployed package.json May 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates pnpm deploy to preserve the workspace root packageManager setting by copying it into the generated/deployed package.json, addressing pnpm issue #9079 (Corepack selecting an unintended pnpm version in deployed outputs).

Changes:

  • Pass the workspace root manifest into the shared-lockfile deploy flow so the deployed manifest can inherit packageManager.
  • Extend deploy file generation to set manifest.packageManager from the root manifest (fallback to the selected project manifest if needed).
  • Add a changeset to publish the fix as a patch.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
releasing/commands/src/deploy/deploy.ts Passes rootProjectManifest into createDeployFiles() during shared-lockfile deploy.
releasing/commands/src/deploy/createDeployFiles.ts Writes packageManager into the deployed package.json based on the root manifest.
.changeset/deploy-copy-package-manager.md Release note for the deploy behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lockfileDir,
patchedDependencies: opts.patchedDependencies,
rootProjectManifest: opts.rootProjectManifest,
selectedProjectManifest: selectedProject.manifest,
Comment on lines 147 to 151
dependencies: targetSnapshot.dependencies,
devDependencies: targetSnapshot.devDependencies,
optionalDependencies: targetSnapshot.optionalDependencies,
packageManager: rootProjectManifest?.packageManager ?? selectedProjectManifest.packageManager,
},
Comment on lines +2 to +6
"@pnpm/releasing.commands": patch
"pnpm": patch
---

`pnpm deploy` should copy the `packageManager` from the workspace `package.json` to the deployed `package.json`.
@dcousens
dcousens marked this pull request as draft May 9, 2026 12:29
@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results

# Scenario main HEAD
1 Isolated linker: fresh restore, hot cache + hot store 2.334s ± 0.081s 2.321s ± 0.059s
2 Isolated linker: fresh add new dep, hot cache + hot store 5.605s ± 0.074s 5.825s ± 0.073s
3 Isolated linker: fresh install, hot cache + hot store 5.927s ± 0.049s 5.939s ± 0.045s
4 Isolated linker: fresh restore, cold cache + cold store 4.852s ± 0.051s 4.847s ± 0.062s
5 Isolated linker: fresh install, cold cache + cold store 8.223s ± 0.092s 8.244s ± 0.081s
6 GVS linker: fresh restore, hot cache + hot store 1.143s ± 0.042s 1.148s ± 0.034s

Run 26787569224 · runs per scenario · triggered by @zkochan

@dcousens dcousens closed this Jun 2, 2026
@dcousens

dcousens commented Jun 2, 2026 •

Copy link
Copy Markdown
Author

Quite a few subtle parts of this change apparently and I don't have the context to test that deeply. Happy for someone to continue on, sorry for drafting here rather than on my own fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants