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.
Motivation
We previously were trying to make one file work for both tools. It was causing a lot of confusion, and it made the code and migrations significantly more complex (in particular we were relying on weak heuristics to figure out which parser to user).
Effects
.yarnrc.yml
files; files named.yarnrc
are completely ignored.Migration plan
People with Yarn 1.17.2+ in their global path (still a RC) won't have anything to do; I've published Adds basic support for .yamlrc.yml (yarnPath only, v2) yarn#7350 which adds a basic support for reading
.yarnrc.yml
files if possible (it will only use theyarnPath
settings, and ignore everything else).People with Yarn 2.0.0+ in their global path won't have anything to do as well; they'll just have to set
yarnPath
from their.yarnrc.yml
file instead of.yarnrc
(just like people using 1.17.2+) and things will work as expected.People that don't have Yarn 1.17.2+ in their global path (which I assume will be a lot of people) will need to keep the
yarn-path
settings inside a.yarnrc
file.Teams that use a combination of pre-1.17.2 and 2.x+ global binaries will have to either set both the
yarn-path
andyarnPath
settings in their respective files, or use the branched binary hack (cf below) to recommend pre-1.17.2 users to upgrade to 1.17.2+.Branched binary hack
Some problems may arise when working on a v2 project: someone with a pre-1.17.2 global binary might fail to pick up the
yarnPath
configuration from the.yarnrc.yml
. Yarn would then disregard the configuration and use the global one instead of whatever has been configured in the repository. Fortunately, this can be avoided: we can use both the.yarnrc
and the.yarnrc.yml
!Maybe even more interesting, by setting the
yarn-path
settings in the.yarnrc
file to a file that prints an error message, you can ensure that engineers in such situations will quickly find out what's wrong, and learn how to fix it. For an example of what I mean, look forscripts/warn-about-yarn1.js
in this PR - this script will be the one called by anyone running pre-1.17.2 global yarns.Extra notes
.yml
instead of.yaml
as that's what the industry uses. Although the official recommendation is.yaml
, in practice it's not applied this way.