-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat: set yarn classic for corepack enabled #1408
feat: set yarn classic for corepack enabled #1408
Conversation
|
02f75a3
to
175aaed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gave everything a go and looks good on my end
Many thanks @AtofStryker! 👍🏻 |
@MikeMcC399 I see you checked in |
You're referring to CI testing in CircleCI I guess? Would you like to open a new issue for this, since it is apparently causing you problems. I can take a look to see if there is a better way of doing this. The PR was based on following the official Yarn Modern documentation as explained in the related issue #1404, however I recognize that Yarn is still in transition mode between the frozen Yarn Classic version and the Yarn Modern v4 version which was released two weeks ago. It presents problems to try to balance between the two worlds! #1423 suggests migrating away from Yarn Classic. This is probably more of a medium- / long-term goal though. |
|
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.