Skip to content

build: migrate from npm to pnpm 11 - #3447

Merged
HughParry merged 2 commits into
mainfrom
feat/pnpm-migration-v2
Oct 2, 2026
Merged

HughParry merged 2 commits into
mainfrom
feat/pnpm-migration-v2

Conversation

@HughParry

@HughParry HughParry commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The repo moves from npm to pnpm 11 (packageManager: pnpm@11.27.1).

  • Lockfile and config: pnpm-lock.yaml replaces package-lock.json. It was converted with pnpm import, so no versions change. pnpm-workspace.yaml replaces the workspaces field and .npmrc.
  • Internal packages link locally: every @prosopo/* dependency is workspace:*, so packages always use the local copy. changeset publish now runs pnpm publish, which swaps in exact versions, so published packages look the same as before. Checked with pnpm pack and a --dry-run publish.
  • Scripts and CI: scripts, workflows, release tooling and Docker bake use pnpm. pnpm passes a literal -- through to scripts, so scripts no longer put one before their arguments.
  • Code that asked npm things:
    • getDependencies (bundle externals) now walks node_modules instead of parsing npm ls.
    • The lint tools read pnpm-workspace.yaml through a new getWorkspacePatterns in @prosopo/workspace, which keeps the workspace's exclusions.
    • The webpack and vite configs now resolve babel, loaders and polyfill shims from @prosopo/config, instead of relying on them being hoisted.
  • Undeclared dependencies: pnpm only lets a package import what it declares. Types and tools that npm's hoisting used to provide are now declared.
  • Supply-chain policy: pnpm refuses versions younger than 7 days, git or tarball subdependencies, and provenance downgrades. The currently locked exceptions are listed in pnpm-workspace.yaml, and Dependabot gets a matching 7-day cooldown.
  • verifyDepsBeforeRun is off, so running a script inside captcha-private can't install captcha standalone over the parent's node_modules.

Effect

  • 54 of 58 production bundles are byte-identical to npm's, including every widget bundle.
  • The provider, provider-mock and client-example-server bundles contain the same package versions, but are about 20% smaller. npm had installed duplicate copies of mongodb and express at the same version; pnpm installs one.

Tests

Standalone, locally, against an npm baseline on the same commit:

  • Pass on both: install, lint, build, build:cjs, build:tsc, typecheck, webpack, CLI bundle and every production bundle.
  • Tests: turbo run test gives the same pass/fail per package as npm. The 8 packages that need Mongo, Redis or the provider fail on both; Docker was not available locally.
  • New or rewritten unit tests: the node_modules walk, workspace lookup and getWorkspaceGlobs.
  • Not testable before merge: GitHub Actions runs and real publishing (OIDC trusted publishing and provenance).

Merge order

fingerprintjs first, then this PR, then Protect (its CI builds fingerprintjs from captcha main), then captcha-private.

Links: prosopo/fingerprintjs#10 · #3447 · prosopo/Protect#1120 · prosopo/docs#106 · prosopo/captcha-private#5035

@github-actions

Copy link
Copy Markdown
Contributor

No updates since 2026-09-29T14:05:34Z (over 1 days), so this PR has been converted to draft. That stops it holding CI runners.

Nothing is lost — gh pr ready 3447, or the "Ready for review" button, picks it straight back up. Add the keep-ready label to exempt it permanently.

Converting to draft disables auto-merge, so PRs with auto-merge enabled are excluded from this entirely.

@HughParry
HughParry force-pushed the feat/pnpm-migration-v2 branch from c064f09 to 138f363 Compare October 1, 2026 09:40
- pnpm-workspace.yaml replaces the workspaces field and .npmrc; pnpm-lock.yaml
  (from `pnpm import`, same versions) replaces package-lock.json.
- Internal @prosopo/* deps use workspace:*. `changeset publish` now runs
  `pnpm publish`, which writes exact versions into published manifests.
- Scripts, CI workflows and release tooling use pnpm; pnpm passes a literal
  `--` through, so scripts no longer put one before their arguments.
- getDependencies walks node_modules instead of parsing `npm ls`; the lint
  tools read pnpm-workspace.yaml via @prosopo/workspace's getWorkspaceGlobs.
- The webpack config resolves loaders, babel plugins and @babel/runtime from
  @prosopo/config; the frontend vite config aliases the polyfill shims the
  same way.
- Packages declare the types and tools npm's hoisting used to provide.
- verifyDepsBeforeRun is off so running a script here inside captcha-private
  cannot install captcha standalone over the parent's node_modules.

Co-Authored-By: Claude <noreply@anthropic.com>
@HughParry
HughParry force-pushed the feat/pnpm-migration-v2 branch from 138f363 to 801692d Compare October 1, 2026 16:33
@HughParry
HughParry enabled auto-merge (squash) October 2, 2026 08:40
@HughParry
HughParry merged commit a17e8eb into main Oct 2, 2026
13 checks passed
@HughParry
HughParry deleted the feat/pnpm-migration-v2 branch October 2, 2026 08:43
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