feat: set yarn classic for corepack enabled #1408
Merged
+147,548
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
If a user has Node.js' experimental Corepack enabled, then invoking
yarn
may cause Yarn Modern (version 2 and later) instead of Yarn Classic (version 1) to be used. The Cypress Real-world app is however not compatible with Yarn Modern and callingyarn dev
, after installing dependencies withyarn
, may then cause the app to crash.Note that Yarn Modern > Starting with Yarn > Installation describes the preferred way to manage Yarn as being through Corepack. Users may have other projects on their client system, besides RWA, which use Yarn Modern, and so the scenario where Corepack is enabled should be catered for by RWA.
Changes
"packageManager": "[email protected]"
is added to package.json so that ifcorepack
is enabled it will use Yarn Classic and not Yarn Modern.The instructions for users who have not executed
corepack enable
remain unchanged.The advice that the project is not compatible with Yarn Modern also remains unchanged.
Detailed changes
README.md is updated with instructions that work for both traditional Yarn Classic users and those who have executed
corepack enable
.Yarn is set to Classic
The following is invoked
yarn set version classic
to tie the project to Yarn Classic methods for installation, even if Yarn Modern has been set as the global default version through corepack.
The following is merged into .gitignore to make sure only the required Yarn files are considered for
git
commit to the repo:See Yarn Modern > Which files should be gitignored?.
Verification
Using Node.js
18.16.1
according to .node-version.Yarn Classic
Install Yarn Classic globally and run
yarn install
:Confirm that Yarn
v1.22.19
is used to install, that there are no errors and no files identified by git for committing.Yarn Modern
Install Yarn Modern globally using corepack and run
yarn install
:npm uninstall yarn -g corepack enable corepack prepare yarn@stable --activate git clean -x -d -f yarn install git status
Confirm that Yarn
v1.22.19
is used to install, that there are no errors and no files identified by git for committing.