I have written a small tool for those people who don't want to commit Yarn 2+ binary into their git repos, while still benefiting from sticking Yarn version per project. If you already have Yarn 2+ configured in your project just don't want to commit it, you can run:
yarn dlx pinyarn
This command will generate .pinyarn.js
(4KB) which you should commit, instead. .pinyarn.js
will contain URLs inside to download Yarn 2+ and its plugins from the official Yarn Berry GitHub repo. .pinyarn.js
will download binary and plugins from these URLs if they are not downloaded yet.
You can also specify which version of Yarn 2+ you want via:
yarn dlx pinyarn 3
- the latest released Yarn 3 version, or
yarn dlx pinyarn 2.2.2
- version 2.2.2, or
yarn dlx master
- version from latest sources, or
yarn dlx 1638
- version from Pull Request 1638
The pinyarn
tool repo on GitHub:
https://github.com/sysgears/pinyarn