Skip to content

fix(bump): node apply drops pnpm -w outside a workspace (v2.0.6) - #42

Merged
ericfitz merged 1 commit into
mainfrom
fix/40-pnpm-w-non-workspace
Aug 20, 2026
Merged

fix(bump): node apply drops pnpm -w outside a workspace (v2.0.6)#42
ericfitz merged 1 commit into
mainfrom
fix/40-pnpm-w-non-workspace

Conversation

@ericfitz

Copy link
Copy Markdown
Owner

Summary

ecosystem node apply failed on every range-widening bump in a single-package pnpm repo: _install_cmd read an empty workspaceName as "workspace root" and unconditionally fell back to pnpm add -w, which pnpm rejects outside a workspace (ERROR --workspace-root may only be used inside a workspace). Since in-range bumps never reach the manifest-rewriting path, the practical effect was that major bumps were unappliable in exactly the repos most likely to be single-package.

Fix

Gate -w on pnpm-workspace.yaml actually existing at the project root — pnpm ignores package.json's workspaces field, so that file's presence is the definition of a pnpm workspace:

  • workspace member → --filter <name> (unchanged)
  • real workspace root → -w (unchanged; plain pnpm add there fails with ERR_PNPM_ADDING_TO_ROOT)
  • plain single-package repo → no flag (new; mirrors the npm branch, which already got this right)

handle("apply") passes its root down so the probe honors the working directory.

Tests

TDD: test_pnpm_plain_repo_omits_workspace_flag written first and watched failing with exactly the buggy command (pnpm add -w -D eslint@^11.0.0), plus test_pnpm_workspace_root_keeps_w_flag pinning the workspace-root behavior. Full suite: 851 passed, 456 subtests passed; ruff clean.

Version bumped 2.0.5 → 2.0.6 in both plugin manifests.

Fixes #40.

🤖 Generated with Claude Code

https://claude.ai/code/session_016FKf6Gee6Zzd4xF6Ldho54

_install_cmd read an empty workspaceName as "workspace root" and fell
back to `pnpm add -w`, but workspaceName is empty for the root manifest
of ANY repo — including a plain single-package one, where pnpm rejects
-w with "--workspace-root may only be used inside a workspace". Since
in-range bumps never reach this path, every range-widening (i.e. major)
bump in a non-workspace pnpm repo failed.

Gate -w on pnpm-workspace.yaml actually existing — pnpm ignores
package.json's `workspaces` field, so that file's presence is the
definition of a pnpm workspace. A real workspace root keeps -w (plain
`pnpm add` there fails with ERR_PNPM_ADDING_TO_ROOT); a plain repo gets
no flag, matching the npm branch's existing behavior.

Fixes #40.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016FKf6Gee6Zzd4xF6Ldho54
@ericfitz
ericfitz merged commit 4cd8a52 into main Aug 20, 2026
1 check passed
@ericfitz
ericfitz deleted the fix/40-pnpm-w-non-workspace branch August 20, 2026 05:27
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.

fix: node apply uses 'pnpm add -w' in non-workspace repos, so range-widening bumps always fail

1 participant