Reputation: 842
For the OSS Review Toolkit project, I would like to identify which version of yarn is used by a given project in a given repository.
Which criteria should be used ? There is:
package.json/packageManager
which requires Corepack and may not be used by all projects..yarn/releases/*
.yarnrc
file: if this is yarnrc.yml
then this is Yarn 2+.yarn.lock
seems to not be related to the Yarn version used for the project (but please correct me if I am wrong).Is there any other criteria that could be used to disambiguiate if this is a Yarn 1, 2 or 3 project ?
Upvotes: 11
Views: 21976
Reputation: 65
In my experience, it shows the version of yarn being run when you perform a yarn command (e.g. yarn install
) on a repository.
Upvotes: 0
Reputation: 1018
The frustrating answer is that there isn't an easy way (although there probably should be). Running yarn -v
will simply show your global yarn version; not the local repo. You need to look for the same hints you listed.
Perhaps your collaborators can agree to make an arbitrary .yarnver
file that simply contains something like:
1.22.11
Upvotes: 5