Skip to content

chore: migrate from npm workspaces to pnpm#381

Open
kraenhansen wants to merge 1 commit into
mainfrom
claude/migrate-pnpm-workspaces-qp0m9t
Open

chore: migrate from npm workspaces to pnpm#381
kraenhansen wants to merge 1 commit into
mainfrom
claude/migrate-pnpm-workspaces-qp0m9t

Conversation

@kraenhansen

Copy link
Copy Markdown
Collaborator

Motivation: pnpm's recursive runner (pnpm -r run) is fail-fast by default
and runs in topological (dependency-graph) order, so the root bootstrap
and prerelease no longer need the non-fail-fast npm run <s> --workspaces
pattern that buried the real root cause under cascading failures.

Workspace + package manager:

  • Replace the root workspaces array with pnpm-workspace.yaml
  • Add packageManager: pnpm@10.33.0 and switch devEngines to pnpm ^10
  • Allow only esbuild's build script via onlyBuiltDependencies (pnpm 10 blocks
    dependency lifecycle scripts by default); no shamefully-hoist needed
  • Replace package-lock.json with pnpm-lock.yaml; keep node_modules isolated

Internal deps -> workspace:* protocol (cmake-rn, ferric, gyp-to-cmake, host,
node-addon-examples, node-tests, ferric-example, test-app). Add explicit
weak-node-api edges to node-addon-examples and node-tests so the topological
bootstrap sequences weak-node-api (which builds the xcframework/.so they link)
before its consumers.

Phantom dependencies surfaced by pnpm's isolated node_modules (npm hoisting
had masked these):

  • host: add @types/babel__core (used by src/node/babel-plugin/plugin.ts)
  • host: add weak-node-api as a devDependency (used by
    scripts/generate-injector.mts; previously only a peerDependency)

Scripts:

  • bootstrap: tsc --build && pnpm -r run bootstrap (fail-fast, topological)
  • prerelease/release: make the build explicit instead of relying on npm's
    implicit prerelease hook (pnpm disables pre/post scripts by default)
  • test: pnpm --filter ... run test
  • depcheck/run-in-published: replace npm query .workspace with pnpm ls -r
  • Pin prettier to 3.6.2: 3.7+ is incompatible with @prettier/plugin-oxc@0.0.4
    (regenerating any lockfile floated it to 3.9.5 and crashed the plugin)

CI: port check.yml and release.yml to pnpm (pnpm/action-setup, cache: pnpm,
pnpm install --frozen-lockfile, --filter, pnpm exec). The ephemeral,
non-workspace macOS test app keeps its own npm install in
scripts/init-macos-test-app.ts.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01DnwodAoNbqPec77191HVXn

Motivation: pnpm's recursive runner (`pnpm -r run`) is fail-fast by default
and runs in topological (dependency-graph) order, so the root `bootstrap`
and `prerelease` no longer need the non-fail-fast `npm run <s> --workspaces`
pattern that buried the real root cause under cascading failures.

Workspace + package manager:
- Replace the root `workspaces` array with pnpm-workspace.yaml
- Add `packageManager: pnpm@10.33.0` and switch devEngines to pnpm ^10
- Allow only esbuild's build script via onlyBuiltDependencies (pnpm 10 blocks
  dependency lifecycle scripts by default); no shamefully-hoist needed
- Replace package-lock.json with pnpm-lock.yaml; keep node_modules isolated

Internal deps -> workspace:* protocol (cmake-rn, ferric, gyp-to-cmake, host,
node-addon-examples, node-tests, ferric-example, test-app). Add explicit
`weak-node-api` edges to node-addon-examples and node-tests so the topological
bootstrap sequences weak-node-api (which builds the xcframework/.so they link)
before its consumers.

Phantom dependencies surfaced by pnpm's isolated node_modules (npm hoisting
had masked these):
- host: add `@types/babel__core` (used by src/node/babel-plugin/plugin.ts)
- host: add `weak-node-api` as a devDependency (used by
  scripts/generate-injector.mts; previously only a peerDependency)

Scripts:
- bootstrap: `tsc --build && pnpm -r run bootstrap` (fail-fast, topological)
- prerelease/release: make the build explicit instead of relying on npm's
  implicit prerelease hook (pnpm disables pre/post scripts by default)
- test: `pnpm --filter ... run test`
- depcheck/run-in-published: replace `npm query .workspace` with `pnpm ls -r`
- Pin prettier to 3.6.2: 3.7+ is incompatible with @prettier/plugin-oxc@0.0.4
  (regenerating any lockfile floated it to 3.9.5 and crashed the plugin)

CI: port check.yml and release.yml to pnpm (pnpm/action-setup, cache: pnpm,
`pnpm install --frozen-lockfile`, `--filter`, `pnpm exec`). The ephemeral,
non-workspace macOS test app keeps its own `npm install` in
scripts/init-macos-test-app.ts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnwodAoNbqPec77191HVXn
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