feat: implement native recursive version command#10879
Conversation
There was a problem hiding this comment.
Pull request overview
Implements a native pnpm version command (including pnpm -r version) so version bumps run with pnpm’s workspace context instead of being passed through to npm version (which breaks on workspace: protocol deps).
Changes:
- Register
versionas a pnpm command via@pnpm/plugin-commands-script-runnersand stop passingversionthrough to npm. - Update CLI arg parsing to treat
versionsimilarly torun/dlxfor passthrough-style args. - Add regression tests and a small repro workspace fixture for the
workspace:^dependency case.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| repro-workspace-version-issue/pnpm-workspace.yaml | Adds a minimal workspace manifest for the repro fixture. |
| repro-workspace-version-issue/pnpm-lock.yaml | Adds a minimal lockfile capturing workspace:^ dependency usage. |
| repro-workspace-version-issue/package.json | Adds root package.json for the repro fixture. |
| repro-workspace-version-issue/packages/pkg-a/package.json | Adds pkg-a fixture package. |
| repro-workspace-version-issue/packages/pkg-b/package.json | Adds pkg-b fixture package depending on pkg-a via workspace:^. |
| pnpm/test/version.test.ts | Adds an integration test asserting pnpm -r version minor succeeds with workspace: deps. |
| pnpm/src/pnpm.ts | Removes version from the npm pass-through command list. |
| pnpm/src/parseCliArgs.ts | Treats version as an escaped-args command at the pnpm CLI wrapper level. |
| pnpm/src/cmd/index.ts | Registers the new version command from script-runners. |
| pnpm-lock.yaml | Adds @pnpm/run-npm workspace dependency (for the new command). |
| exec/plugin-commands-script-runners/tsconfig.json | Adds TS project reference for run-npm. |
| exec/plugin-commands-script-runners/package.json | Adds @pnpm/run-npm dependency. |
| exec/plugin-commands-script-runners/src/index.ts | Exports the new version command module. |
| exec/plugin-commands-script-runners/src/version.ts | New implementation of the version command (recursive + non-recursive). |
| exec/plugin-commands-script-runners/test/version.test.ts | Unit test ensuring version delegates to runNpm with correct args/options. |
| cli/parse-cli-args/src/index.ts | Treats version like run/dlx for special escaping behavior. |
Files not reviewed (2)
- pnpm-lock.yaml: Language not supported
- repro-workspace-version-issue/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
556cede to
3cb39a1
Compare
ff6a339 to
1a54dca
Compare
|
I pulled this PR locally and fixed the failing import-sort errors in a follow-up branch on my fork:
Validated locally with:
If helpful, feel free to cherry-pick |
|
Follow-up fix for the remaining review feedback is available on Addressed in this update:
Validated locally:
|
34eae5d to
22b47ab
Compare
4f9d668 to
f47ef4b
Compare
ee2a254 to
252a7c6
Compare
2da4634 to
e0ee9dc
Compare
38450fa to
b67ea5c
Compare
- Fix changeset package name to @pnpm/releasing.commands - Use writeProjectManifest instead of writeJsonFile to preserve formatting - Remove dead updateWorkspaceDependencies placeholder function - Remove unused imports (path, ProjectManifest, writeJsonFile) - Add expect.assertions(1) to prevent silent test pass on no-throw Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b67ea5c to
2f7e7fd
Compare
Description
Implement
versionnatively in pnpm to support workspaces andworkspace:protocols correctly.Changes
versioncommand in@pnpm/plugin-commands-script-runners.versioncommand inpnpmCLI.npm versioninpnpmCLI.--recursiveversioning.Checklist
pnpm version -wsleads tonpm error Unsupported URL Type "workspace:": workspace:^#10703)