Skip to content

Add JS package manager support (pnpm, yarn, npm)#2802

Closed
mikeland73 wants to merge 5 commits intomainfrom
mikeland73/js-pkg-manager
Closed

Add JS package manager support (pnpm, yarn, npm)#2802
mikeland73 wants to merge 5 commits intomainfrom
mikeland73/js-pkg-manager

Conversation

@mikeland73
Copy link
Collaborator

Summary

  • Add first-class support for JS package manager packages using prefix syntax: pnpm:vercel, yarn:turbo, npm:eslint
  • Packages are managed by the specified JS package manager (not Nix), with minimal managed_by lockfile entries
  • Binaries from node_modules/.bin/ are symlinked to .devbox/virtenv/<manager>/bin/ and added to PATH
  • Supports add, remove, update flows with version sync warnings between devbox.json and package.json

Test plan

  • Unit tests for type detection (pkgtype/jspm_test.go)
  • Unit tests for package parsing (package_test.go - CanonicalName, Versioned, IsJSPM)
  • All existing internal tests pass (go test ./internal/...)
  • Integration testscript: go test ./testscripts -run TestScripts/add_jspm
  • Integration project test: DEVBOX_RUN_PROJECT_TESTS=1 go test ./testscripts -run TestScriptsWithProjects/jspm
  • Manual: devbox add pnpm:vercel with nodejs+pnpm in packages

🤖 Generated with Claude Code

mikeland73 and others added 5 commits March 24, 2026 13:03
Allow installing JS packages via `devbox add pnpm:vercel`, `devbox add
npm:eslint`, etc. Packages are managed by the specified JS package
manager rather than Nix, with entries in devbox.lock using a minimal
`managed_by` field. Binaries are symlinked from node_modules/.bin/ to
.devbox/virtenv/<manager>/bin/ and added to PATH.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes revive cognitive-complexity lint (was 36, max 32).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enable DEVBOX_COREPACK_ENABLED in test devbox.json so pnpm is
available via corepack (bundled with nodejs) rather than as a
separate nix package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Refactor util.go: replace eager initDevboxUtilityProject with on-demand
addToUtilityProject that installs packages only when needed.

For JSPM, install nodejs in the utility project and enable corepack to
provide pnpm/yarn/npm binaries. This ensures JS package managers are
always available regardless of what the user has in their devbox.json.

Update services.go callsites to use addToUtilityProject directly with
the process-compose package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mikeland73 mikeland73 closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant