Repository navigation
Migrate Yarn 1 → Yarn 4 (Berry), nodeLinker node-modules - #2069
Merged
Merged
Conversation
Cloudflare's default build image runs Yarn 4 + Node 22, which refused an immutable install against our Yarn-1 lockfile (YN0028) -- the reason the toolchain was pinned to [email protected]. A Yarn-4-native lockfile needs no migration, so that immutable install becomes a no-op and passes. - packageManager -> [email protected]; commit .yarn/releases/yarn-4.16.0.cjs and pin it via .yarnrc.yml yarnPath so any 'yarn' invocation (incl. CF's) self-redirects to 4.16.0 regardless of the image's bundled version. - .yarnrc.yml: nodeLinker: node-modules (REQUIRED -- PnP breaks @docusaurus/theme-mermaid, meta/docusaurus#10645, and @docusaurus/ faster #10787), plus enableScripts: true so the Solana native addons (bigint-buffer/bufferutil/utf-8-validate) build as they did under Yarn 1. - yarn.lock migrated to Yarn 4 native format (__metadata version: 10). The large diff is the one-time v1->v4 format change, not a dependency change. - .gitignore: official non-Zero-Install block (commit .yarn/releases; ignore .yarn/cache, .yarn/install-state.gz, .pnp.*). Verified on Node 22.22.3 + Yarn 4.16.0: - 'yarn install --immutable' under CI=true / YARN_ENABLE_IMMUTABLE_INSTALLS= true (the form Cloudflare runs) exits 0 with the lockfile checksum byte-for-byte unchanged -- no YN0028. - Production build (node scripts/build-redirects.mjs && docusaurus build) generates all 71 pages with no module-resolution or mermaid-PnP errors.
Deploying heliumdocs with
|
| Latest commit: |
42a70b0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://21cc8f0e.heliumdocs.pages.dev |
| Branch Preview URL: | https://chore-yarn-4-migration.heliumdocs.pages.dev |
jthiller
added a commit
that referenced
this pull request
Jun 6, 2026
The repo migrated to Yarn 4 (Berry) managed by Corepack (#2069), so the setup docs were stale. - CLAUDE.md Local Development: npm install/run -> nvm use + corepack enable + yarn install/start/build; prettier invoked via 'yarn dlx'. - README Requirements: replace the stale 'Node >= 10.15.1 / Yarn >= 1.5' with a pointer to .nvmrc for Node and Corepack-managed Yarn 4. Referencing .nvmrc (rather than hardcoding a version) keeps the docs correct across Node bumps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Migrates the toolchain from Yarn 1.22.21 → Yarn 4.16.0 with the
node-moduleslinker.The
[email protected]pin (commit 66de0ed) existed solely to dodge YN0028: Cloudflare's default image runs Yarn 4 + Node 22, which refused an immutable install against our Yarn-1 lockfile because it "required migration." A Yarn-4-native lockfile needs no migration, so the immutable install becomes a clean no-op — removing the reason for the pin and unblocking the modern toolchain.Changes (5 files)
package.json→"packageManager": "[email protected]"..yarn/releases/yarn-4.16.0.cjs(2.9 MB) — pinned binary, committed..yarnrc.yml— exactly 3 keys:yarn.lock→ Yarn 4 native format (__metadata version: 10). The ~29k-line diff is the one-time v1→v4 format migration, not a dependency change (proven below)..gitignore→ official non-Zero-Install block (commit.yarn/releases; ignore.yarn/cache,.yarn/install-state.gz,.pnp.*).Why these settings
nodeLinker: node-modulesis load-bearing — Yarn 4 defaults to PnP, which breaks@docusaurus/theme-mermaid(#10645, closed not-planned) and@docusaurus/faster(#10787). node-modules produces a standard tree, so mermaid, the customconfigureWebpack/ProvidePlugin, and faster's Rspack/SWC all resolve normally.enableScripts: true— Yarn 4 defaults tofalse; this lets the Solana native addons (bigint-buffer/bufferutil/utf-8-validate) build as they did under Yarn 1 (they have pure-JS fallbacks regardless).Verification — proven locally (Node 22.22.3, Yarn 4.16.0)
yarn install --immutableunderCI=true YARN_ENABLE_IMMUTABLE_INSTALLS=true(the form Cloudflare runs) → exit 0, no YN0028, lockfile SHA-256 byte-for-byte unchanged before/after.node scripts/build-redirects.mjs && yarn docusaurus build→[SUCCESS], all 71 HTML pages +build/llms.txt, zero module-resolution / mermaid-PnP errors.Reviewer note
.yarnrc.ymlmust contain only the 3 keys above. A localyarn installon some machines transiently injectsapprovedGitRepositories: ['**']/npmMinimalAgeGate: 0(a machine-level Yarn artifact, also seen on thefeat/jupiter-tokens-to-rentbranch) — those loosen security and must not ship. Confirmed they are not present here and don't re-appear on a clean immutable install.Cloudflare gate (the only untested residual)
CF v3 image = Yarn 4.9.1 / Node 22.16.0 and ignores
yarn.lock/engines/packageManagerfor version selection. The committedyarnPathmakes CF self-redirect to 4.16.0 (4.9.1 also reads a 4.x lockfile fine)..nvmrcalready pins Node 22.22.3. Optionally setYARN_VERSION=4.16.0in Pages settings as belt-and-suspenders. Please confirm the preview deploy builds 71 pages before merging.🤖 Generated with Claude Code