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.- look at the version
.yarn/releases/*
- check the
.yarnrc
file: if this isyarnrc.yml
then this is Yarn 2+. - the version in
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 ?
yarn --version
? – Bechuana.yarnrc
and a.yarn/releases/XXX.cjs
file, callingyarn
returns the correct version, because the file in.yarn/releases/XXX.cjs
will be called. – Rist.yarn/release/XXX.cjs
file, won't I be able to compromise the users runningyarn
in my project source tree ? – Rist