Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Yarn Modern examples to Corepack #1349

Closed
MikeMcC399 opened this issue Jan 24, 2025 · 2 comments · Fixed by #1350
Closed

Migrate Yarn Modern examples to Corepack #1349

MikeMcC399 opened this issue Jan 24, 2025 · 2 comments · Fixed by #1350
Assignees

Comments

@MikeMcC399
Copy link
Collaborator

Situation

The two examples for Yarn Modern v4 are currently set up so that the Yarn package manager executables are committed to the repo in each corresponding examples directory under .yarn/releases with the Yarn config parameter yarnPath pointing to the file, for example yarnPath: .yarn/releases/yarn-4.6.0.cjs.

The current Yarn Modern Installation instructions recommend managing Yarn through Corepack. This is not currently the case for the Yarn Modern examples:

Updates to Yarn Modern versions are being done together with Cypress version updates through scripts/update-cypress-latest-yarn.sh and yarn set version latest commands.

Background

Yarn Modern versions, before the v4 release, initialized Yarn Modern projects with the Yarn package manager executables being committed into the repo.

In the meantime, Corepack has been introduced. It automatically installs a selected Yarn package manager version defined in a packageManager field in package.json. (See explanation in Release: Yarn 4.0 blog from Oct 2023.)

Corepack is currently shipped with all supported Node.js releases (18, 20, 22, 23) and installing Node.js automatically installs corepack and npm as global packages (list with the command: npm ls -g).

Corepack comes from an open source GitHub repo https://github.com/nodejs/corepack.

Node.js documentation for corepack and for the related packageManager field for Node.js package.json files are marked with Stability: 1 - Experimental

Non-backward compatible changes or removal may occur in any future release. Use of the feature is not recommended in production environments.

There are open discussional PRs in https://github.com/nodejs/node about removing corepack from the Node.js distribution.

In GitHub Actions runner images corepack is disabled by default.

Assessment

Corepack is the method recommended by Yarn Modern for managing its installations.

At this time it is unclear whether or not:

  • Corepack will move to Node.js Stability 2 - Stable
  • Corepack will continue to be shipped with Node.js

or if alternatives will be offered for installing Yarn Modern, such as publishing Yarn Modern as a package to the npm registry.

Despite any uncertainty about the future status of Corepack, it is the method recommended by Yarn Modern for managing its installations.

Not migrating to Corepack means continuing to require Yarn Modern large binary files be committed to the repo. Git is not particularly suited to manage binaries as git differences. It works best with configuration parameters and source files.

Recommendation

Convert the Yarn Modern examples to follow the Yarn Modern Installation instruction recommendations to use Corepack:

@MikeMcC399 MikeMcC399 self-assigned this Jan 24, 2025
@MikeMcC399

This comment has been minimized.

@MikeMcC399
Copy link
Collaborator Author

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 a pull request may close this issue.

1 participant