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

docs: update yarn contributing requirements with corepack #30877

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

MikeMcC399
Copy link
Contributor

Additional details

Following the CONTRIBUTING Requirements for Yarn installation, with corepack enabled, fails:

npm install --global yarn
npm error code EEXIST

Background

The CONTRIBUTING Requirements instructions for Yarn are incomplete and simply link to the Yarn 1 Classic installation instructions.

In the meantime, Yarn by default refers to Yarn Modern (4.x) and the experimental corepack technology has been introduced, generally, and in PR #30860 the corepack packageManager key was added to the Cypress repo.

Yarn 1 Classic is however no longer supported and corepack installation instructions have not been added to its installation documentation.

If a contributor user has corepack enabled, then the instructions in Yarn 1 Classic installation instructions fail. For instance on Ubuntu 24.04.1 LTS with Node.js 20.18.1 using n as Node version manager:

corepack enable yarn
npm install --global yarn
npm install --global yarn
npm error code EEXIST
npm error path /home/mike/n/bin/yarnpkg
npm error EEXIST: file already exists
npm error File exists: /home/mike/n/bin/yarnpkg
npm error Remove the existing file and try again, or run npm
npm error with --force to overwrite files recklessly.

With the addition of packageManager to Cypress' package.json, through PR #30860, the instructions change:

  1. If corepack is already enabled (corepack enable yarn), then Yarn does not need to be explicitly installed. When executing yarn in the Cypress repo, corepack will ask the following if the configured version of Yarn 1 is not already cached:

    ! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
    ? Do you want to continue? [Y/n]

  2. If corepack is not previously enabled for Yarn, then the following will enable corepack, download Yarn 1 (as configured by Cypress), and execute yarn install in one step, without any further prompting:

    corepack yarn

    Subsequently, yarn can be called without prepending corepack to the command.

Note that corepack is currently experimental and disabled by default.

Change

Modify the CONTRIBUTING Requirements Yarn installation section:

  • Show that Yarn 1 Classic (not Yarn Modern) is required.
  • Inform that separate installation of Yarn via npm is not required if corepack is enabled.

Steps to test

On Ubuntu 24.04.1 LTS, Node.js v20.18.1 according to .node-version. Set up system according to CONTRIBUTING Requirements.

git clone /~https://github.com/cypress-io/cypress
cd cypress
corepack disable
rm -rf ~/.cache/node/corepack
npm uninstall yarn -g
corepack -v
corepack enable yarn
yarn

Confirm that Corepack offers to install Yarn and that running yarn is successful:

! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
? Do you want to continue? [Y/n] Y

How has the user experience changed?

Affects contributors to repo only. No end-user changes.

PR Tasks

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399

This comment was marked as outdated.

@jennifer-shehane
Copy link
Member

@MikeMcC399 Going to pause on merging this before 14 releases today 🤞🏻 just to not complicate things.

@MikeMcC399
Copy link
Contributor Author

@jennifer-shehane

Going to pause on merging this before 14 releases today 🤞🏻 just to not complicate things.

Sure! No hurry for this one. I will stop trying to update and leave it all to you, if you want to update later, test and then merge.

@jennifer-shehane jennifer-shehane merged commit f33e4fc into cypress-io:develop Jan 16, 2025
30 of 32 checks passed
@MikeMcC399 MikeMcC399 deleted the docs/yarn-install branch January 17, 2025 06:19
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.

4 participants