Skip to content

chore: finish migrating from Yarn 1 to Yarn 4 - #175

Merged
Naturalclar merged 2 commits into
masterfrom
chore/yarn4
Nov 25, 2026
Merged

Naturalclar merged 2 commits into
masterfrom
chore/yarn4

Conversation

@Naturalclar

Copy link
Copy Markdown
Member

Closes #174

Finishes the half-done Yarn migration from #153 (Berry lockfile, but packageManager: yarn@1.22.22), using the same setup as react-native-menu/menu.

Changes

  • Yarn 4.19.0: packageManager, release committed at .yarn/releases/yarn-4.19.0.cjs, .yarnrc.yml with yarnPath + nodeLinker: node-modules. The runner's global Yarn 1 delegates to it via yarnPath (checked: npx yarn@1.22.22 --version → 4.19.0), so CI needs no corepack.
  • Lockfiles: root, example/ and fabric-example/ regenerated with Yarn 4. The root lockfile is now honoured again, so CI stops re-resolving everything on each run (e.g. @types/node is back to the locked 18.0.0).
  • Examples link the library instead of copying it (link:../): Yarn 4 resolves file:../ by archiving the entire parent directory, including the example's own node_modules, and runs out of memory ("Couldn't allocate enough memory"). Metro (RN 0.68) doesn't follow symlinks, so example/metro.config.js now resolves the library and its peers explicitly (watchFolders, extraNodeModules, root copies of react/react-native blocked), as fabric-example already did.
  • CI / release: yarn cache dir → yarn config get cacheFolder, --pure-lockfile → --immutable.
  • .gitignore: commit .yarn/releases, ignore the rest of .yarn/ (also in sub-projects). Dropped the .yarnrc ignore-engines workaround from chore: automate npm releases with release-it and Trusted Publishing #173; Yarn 4 doesn't fail installs on dependency engines.

Verified locally

  • root: yarn lint, type-check, flow, test pass
  • example: yarn install --immutable still passes after editing a library file (no content hash in the lockfile), and build:ios / build:android bundle the library from ../js with no react/react-native from the root node_modules
  • fabric-example: install + build:ios bundle OK
  • yarn release patch --ci --dry-run → 1.5.0...1.5.1; npm pack --dry-run has no .yarn files

🤖 Generated with Claude Code

Naturalclar and others added 2 commits November 24, 2026 17:22
- packageManager yarn@4.19.0, committed under .yarn/releases and pointed to
  by yarnPath, with nodeLinker: node-modules (same setup as
  react-native-menu/menu)
- regenerate root, example and fabric-example lockfiles with Yarn 4
- examples depend on the library via link:../ instead of copying it; Yarn 4
  archives the whole parent directory for file:../ (including the example's
  own node_modules), which runs out of memory. Metro resolves the library and
  its peers explicitly, as fabric-example already did.
- CI/release: yarn config get cacheFolder, --immutable instead of
  --pure-lockfile; drop the .yarnrc ignore-engines workaround

Closes #174

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Yarn 4 migration wrote settings that preserve legacy behaviour,
including two that loosen safety defaults (npmMinimalAgeGate: 0 and
approvedGitRepositories: "**"). Keep only nodeLinker and yarnPath, as
react-native-menu/menu does. No dependency has install scripts, so the
enableScripts: false default is safe. Lockfiles change only in checksums
(cacheKey) from the compressionLevel default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Naturalclar
Naturalclar merged commit 334ff20 into master Nov 25, 2026
6 checks passed
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.

Finish migrating from Yarn 1 to Yarn 4

1 participant