Skip to content

Frontend: replace Yarn with pnpm#1359

Merged
gusthoff merged 18 commits into
AdaCore:mainfrom
gusthoff:topic/infrastructure/pnpm/setup/20260525/pnpm-migration/main
May 25, 2026
Merged

Frontend: replace Yarn with pnpm#1359
gusthoff merged 18 commits into
AdaCore:mainfrom
gusthoff:topic/infrastructure/pnpm/setup/20260525/pnpm-migration/main

Conversation

@gusthoff
Copy link
Copy Markdown
Collaborator

@gusthoff gusthoff commented May 25, 2026

Rationale

Yarn 4 is configured in legacy nodeLinker: node-modules mode (.yarnrc.yml),
which means it gets none of the speed benefits of Yarn Berry's Plug'n'Play
resolver. Every cold install reads, links, and validates a 275 MB node_modules
tree built from a 10,619-line lock file. On CI, where no cache survives between
runs, this cost is paid in full on every job.

pnpm addresses this directly:

  • Uses a content-addressable global store and hard-links packages into
    node_modules, so disk space is shared across projects on the same machine.
  • Cold install is significantly faster than Yarn node-modules mode.
  • Warm install is near-instant when the lock file is unchanged — only
    missing hard-links are created.
  • Enforces a strict node_modules layout (only declared dependencies are
    accessible), eliminating a class of hidden-dependency bugs.

Changes

  • Replace yarn.lock with pnpm-lock.yaml, generated via pnpm import to
    preserve existing resolved versions. Declare pnpm@11.3.0 as the
    packageManager.
  • Remove yarn.lock, .yarnrc.yml, and .yarn/.
  • Replace all yarn run invocations with pnpm run in Makefile,
    package.json scripts, and CI workflows; switch CI node caching from yarn
    to pnpm.
  • Update Vagrantfile VM provisioners to install via pnpm instead of Yarn.
  • Add pnpm-workspace.yaml to approve build scripts for @parcel/watcher
    (native bindings) and es5-ext (pnpm 11 moved this setting out of
    package.json).
  • Update README.md, frontend/web_tests/README.md, and
    frontend/.gitignore.

Validation

Tested on the web VM (Node 24.14.1, pnpm 11.3.0):

  • pnpm install --frozen-lockfile — exits cleanly, both approved build
    scripts run
  • make webpack-production — exit 0; 3 asset-size warnings (pre-existing)

Notes

  • pnpm 11 no longer reads the pnpm key in package.json; project-level
    settings now live in pnpm-workspace.yaml. This is why allowBuilds is
    configured there rather than in package.json.
  • The .yarn entry in the root .gitignore is intentionally kept as a
    safeguard against accidentally re-initialising Yarn.
  • pnpm-lock.yaml was generated with pnpm import (best-effort conversion
    from yarn.lock) rather than a fresh pnpm install, preserving the resolved
    versions from the existing lock file.

Co-authored-by: Claude Sonnet 4.6 noreply@anthropic.com

gusthoff and others added 18 commits May 25, 2026 14:09
Declare pnpm@11.3.0 as the package manager in the `packageManager`
field of package.json (was yarn@4.12.0).

Add pnpm-lock.yaml (9297 lines, 1018 resolved packages) generated by
running `pnpm import` against the existing yarn.lock, preserving the
same resolved versions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/lock-file'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove all Yarn-specific files now that pnpm is the declared package
manager:

- frontend/yarn.lock  (replaced by frontend/pnpm-lock.yaml)
- frontend/.yarnrc.yml  (set nodeLinker: node-modules; no pnpm equivalent
  needed — pnpm uses node_modules by default)
- frontend/.yarn/  (install-state cache; untracked, deleted locally)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/remove-yarn'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- webpack-production: yarn run production  →  pnpm run production
- webpack-sandbox:    yarn run sandbox     →  pnpm run sandbox
- local target comment: yarn run dev       →  pnpm run dev

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In all three workflows (typescript-tests, sphinx-books-tests,
sphinx-content-tests):
- cache: 'yarn'  →  cache: 'pnpm'
- cache-dependency-path: 'frontend'  →  'frontend/pnpm-lock.yaml'
- yarn --immutable  →  pnpm install --frozen-lockfile

In typescript-tests only:
- yarn run cover  →  pnpm run cover

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e and CI

Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/makefile-ci'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In both web and epub VM provisioners, replace:
  yes | yarn set version berry
  yarn
with:
  pnpm install --frozen-lockfile

corepack enable is kept — with packageManager: "pnpm@11.3.0" declared
in package.json, corepack downloads and activates pnpm@11.3.0
automatically on first invocation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/vagrantfile'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pnpm 11 no longer reads the "pnpm" field in package.json; project-level
settings now live in pnpm-workspace.yaml.

Set allowBuilds for the two packages that have postinstall scripts:
- @parcel/watcher: compiles native file-watching bindings (needed by
  webpack-dev-server for efficient file watching)
- es5-ext: prints a message only; approved to keep pnpm install clean

Without this file, pnpm install exits with ERR_PNPM_IGNORED_BUILDS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/validation'.

Validated on web VM: pnpm install --frozen-lockfile exits cleanly,
make webpack-production succeeds (exit 0, 3 pre-existing size warnings).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace `yarn run dev` with `pnpm run dev` in the Getting started
section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/readme'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The "cover" script in package.json called `c8 yarn run test`, causing
the CI typescript-tests job to fail: `pnpm run cover` invokes this
script, which would then call yarn (no longer installed).

Changed to `c8 pnpm run test`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/cover-script'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace `yarn run dev` with `pnpm run dev` in frontend/web_tests/README.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yarn-error.log is Yarn's error log; pnpm-debug.log is the pnpm
equivalent. Update .gitignore accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… .gitignore

Merges branch 'topic/infrastructure/pnpm/setup/20260525/pnpm-migration/feat/docs-cleanup'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gusthoff gusthoff merged commit 1a9807d into AdaCore:main May 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant