Skip to content

Converge frontend to Yarn Berry with global cache#340

Merged
dkhalife merged 5 commits into
mainfrom
dkhalife/converge-to-yarn-berry
Jun 6, 2026
Merged

Converge frontend to Yarn Berry with global cache#340
dkhalife merged 5 commits into
mainfrom
dkhalife/converge-to-yarn-berry

Conversation

@dkhalife

@dkhalife dkhalife commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Converges the frontend/ Node package management to modern Yarn (Berry 4.16.0) configured with a global cache so git worktrees share installed dependencies instead of each re-installing node_modules. Uses only Yarn's built-in features — no bespoke scripts.

Changes

  • frontend/package.json: added "packageManager": "yarn@4.16.0" so Corepack activates Berry automatically.
  • frontend/.yarnrc.yml (new):
    • nodeLinker: node-modules — keeps a real node_modules so vite/jest/playwright/eslint/tsc work unchanged.
    • enableGlobalCache: true — shared global cache.
    • nmMode: hardlinks-global — hardlink from the global cache so worktrees share inodes.
  • frontend/package-lock.json: deleted (stray npm leftover).
  • frontend/yarn.lock: regenerated in Berry format via yarn install.
  • frontend/.gitignore: replaced the old .yarn/ + .yarnrc.yml ignores with Yarn's standard entries (.yarn/* with ! exceptions for patches/plugins/releases/sdks/versions, plus .pnp.*). .yarnrc.yml is now tracked.

CI / workflows

  • frontend-build.yml: added corepack enable step and switched yarn install --frozen-lockfileyarn install --immutable (Berry equivalent). Kept cache: 'yarn' + cache-dependency-path: frontend/yarn.lock.
  • cut-release.yml: added corepack enable; yarn version --patch --no-git-tag-versionyarn version patch (Berry equivalent, no git tag by default).
  • full-release.yml: added corepack enable; yarn installyarn install --immutable.
  • .github/copilot-instructions.md: yarn install --frozen-lockfileyarn install --immutable.

GitHub runners default to Yarn classic v1, which can't read the Berry lockfile, so corepack enable is required before any yarn invocation.

Verification

In frontend/, all pass:

  • yarn install / yarn install --immutable (no lockfile drift)
  • yarn lint
  • yarn tsc
  • yarn build
  • yarn test ✅ (9 suites, 79 tests)

E2E (yarn test:e2e) skipped — requires browser download.

Note: locally the nmMode was downgraded to hardlinks-local because this session's global cache and worktree live on different drives. On a normal same-device setup hardlinks-global applies as configured.

Copilot AI review requested due to automatic review settings June 6, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the frontend/ package management and CI to use Yarn Berry (via Corepack) with a shared global cache, aiming to reduce redundant installs across git worktrees while keeping the node_modules linker for tool compatibility.

Changes:

  • Pin Yarn Berry via packageManager and add Yarn configuration for global cache + node-modules linker.
  • Refresh frontend ignore rules for Yarn Berry artifacts.
  • Update GitHub Actions workflows/docs to enable Corepack and use Berry’s --immutable install / yarn version patch.
Show a summary per file
File Description
frontend/package.json Pins Yarn Berry via packageManager so Corepack selects the intended Yarn version.
frontend/.yarnrc.yml Adds Yarn Berry configuration (global cache + node-modules), but includes security-weakening settings that should be removed/narrowed.
frontend/.gitignore Updates ignore patterns to Yarn Berry’s recommended .yarn/* + exceptions and .pnp.*.
.github/workflows/frontend-build.yml Enables Corepack and switches install to yarn install --immutable (but Corepack step ordering needs fixing).
.github/workflows/full-release.yml Enables Corepack and uses yarn install --immutable during release builds.
.github/workflows/cut-release.yml Enables Corepack and switches to yarn version patch (but should explicitly set up Node).
.github/copilot-instructions.md Updates frontend install command to yarn install --immutable.

Copilot's findings

  • Files reviewed: 7/9 changed files
  • Comments generated: 4

Comment thread frontend/.yarnrc.yml Outdated
Comment thread frontend/.yarnrc.yml Outdated
Comment thread .github/workflows/frontend-build.yml Outdated
Comment thread .github/workflows/cut-release.yml
@dkhalife dkhalife merged commit e33af19 into main Jun 6, 2026
6 checks passed
@dkhalife dkhalife deleted the dkhalife/converge-to-yarn-berry branch June 6, 2026 20:32
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