Skip to content

feat(nodejs): add pnpm support with auto-detection in Node.js plugin - #2

Merged
bruno-archastro merged 1 commit into
mainfrom
bruno/2026-06-24/pnpm-support
Jun 24, 2026
Merged

feat(nodejs): add pnpm support with auto-detection in Node.js plugin#2
bruno-archastro merged 1 commit into
mainfrom
bruno/2026-06-24/pnpm-support

Conversation

@bruno-archastro

Copy link
Copy Markdown
Contributor

This PR adds support for pnpm alongside npm in the Node.js plugin, with automatic detection of the package manager used by each project. Key changes:

  • Introduces a PackageManager enum as the single source of truth for all npm/pnpm command strings and install lock resources.
  • Implements detect_package_manager, which walks up from the project directory to the workspace root, preferring the packageManager field in package.json, then falling back to lockfiles (pnpm-lock.yaml → pnpm, package-lock.json → npm), defaulting to npm if nothing matches.
  • All generated commands (install, test, run, exec) now use the detected package manager.
  • Workspace members inherit the package manager from their workspace root.
  • Updates the README to document pnpm support and detection logic.
  • Adds comprehensive tests for:
    • Detection via packageManager field and lockfiles
    • Per-manager install lock resource
    • pnpm exec for tools like Prettier
    • Workspace inheritance of the package manager

Existing behavior is preserved for projects without a lockfile or packageManager field (defaults to npm). This enables seamless support for both npm and pnpm workflows.

@bruno-archastro bruno-archastro self-assigned this Jun 24, 2026
@archastro

archastro Bot commented Jun 24, 2026

Copy link
Copy Markdown

✅ Clean PR, @bruno-archastro! No blocking findings on f2ac019 — a few nice things I clocked:

  • Nice move centralizing every emitted command in the PackageManager enum — install/test/run/exec/cache_resource all flow through one source of truth instead of scattered literals. 🎯
  • Clean layered detection in detect_package_manager — closest-wins packageManager field, then lockfile fallback, then npm default, with workspace members inheriting the root by walking up to workspace_root.
  • Solid red-green discipline — every new mode is locked in by a test (field detection, lockfile fallback, pnpm_cache resource isolation, pnpm exec, and workspace inheritance). 🙌

Reply @archastro <verb>: review · do <pattern> · don't <pattern> · forget <slug> · list

Auto-detect whether a Node.js project uses npm or pnpm and emit matching
commands instead of hardcoding npm. A new PackageManager enum is the single
source of truth for command strings (install/test/run/exec) and the install
lock resource; detect_package_manager walks up to the workspace root,
preferring the packageManager field, then a lockfile, defaulting to npm.
Workspace members inherit the root's manager.

Existing behavior is preserved (no lockfile/field => npm). Added tests for
field/lockfile detection, pnpm exec, the per-manager install lock, and
workspace inheritance.
@bruno-archastro
bruno-archastro force-pushed the bruno/2026-06-24/pnpm-support branch from f2ac019 to f777a4b Compare June 24, 2026 15:57
@bruno-archastro
bruno-archastro merged commit 4ddabfc into main Jun 24, 2026
4 of 6 checks passed
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.

1 participant