Skip to content

feat: add Yarn Berry (v2+) support with automatic version switching#1254

Open
ddusht wants to merge 2 commits into
paketo-buildpacks:mainfrom
ddusht:feat/yarn-berry
Open

feat: add Yarn Berry (v2+) support with automatic version switching#1254
ddusht wants to merge 2 commits into
paketo-buildpacks:mainfrom
ddusht:feat/yarn-berry

Conversation

@ddusht
Copy link
Copy Markdown

@ddusht ddusht commented Apr 21, 2026

Summary

Adds support for Yarn Berry (v2+), removing the previous limitation of Classic-only installs. The install process is now selected automatically at runtime based on packageManager in package.json.

Changes

  • switching_install_process.go — New SwitchingInstallProcess that reads packageManager in package.json and delegates to either the Classic or Berry process. No changes to existing YarnInstallProcess logic.
  • berry_install_process.go — New BerryInstallProcess implementing the InstallProcess interface:
    • Runs yarn install --immutable (Berry's equivalent of --frozen-lockfile)
    • Sets YARN_NODE_LINKER=node-modules for traditional node_modules layout
    • Redirects install-state.gz into the layer for caching across builds
    • Supports app-provided Berry binaries via yarnPath in .yarnrc.yml (invoked as node <yarnPath> install --immutable); falls back to buildpack-provided yarn with YARN_IGNORE_PATH=1
  • run/main.go — Wires up both processes through SwitchingInstallProcess.
  • README.md — Documents Classic vs Berry selection logic and yarnPath behaviour.

Behaviour

packageManager in package.json Install command
yarn@1.x.x or absent yarn install --frozen-lockfile (Classic)
yarn@2.x.x or higher yarn install --immutable (Berry)

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@ddusht ddusht requested review from a team as code owners April 21, 2026 15:37
@ddusht
Copy link
Copy Markdown
Author

ddusht commented Apr 21, 2026

Comment thread berry_install_process.go Outdated
Comment thread berry_install_process.go
Comment thread berry_install_process.go Outdated
Comment thread berry_install_process.go Outdated
Comment thread berry_install_process.go Outdated
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