[Feature] Allow opting-out of vendoring berry's files
See original GitHub issue- I’d be willing to implement this feature
- This feature can already be implemented through a plugin
Describe the user story
I am a Yarn user, I have run yarn set version berry
on my repo. Now I would like not to commit .yarn/releases
; it’s not my code, I am not confortable having it on my CVS; also, upgrading to a new version produces huge diffs.
One of the reason I am using Yarn, it is to avoid storing vendor files; I feel forcing users to vendor is not the way to go.
Describe the solution you’d like
We could imagine yarn set version xx
keeps the actual version number on the .yarnrc.yml
; when running yarn
, it will first check if the yarnPath
file exists, and if not, checks if a yarnVersion
is defined and download it from the network. Note that it doesn’t change anything for projects that vendor the file, while providing an easy opt-out (adding .yarn/
to .gitignore
).
Describe the drawbacks of your solution
Besides the debat vendoring vs using a package manager, I can’t think of any.
Describe alternatives you’ve considered
Put the .yarn
folder and the .yarnrc.yml
to my .gitignore
and put a note on the Getting Started section of the README to run yarn set version berry
…
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:13 (9 by maintainers)
Top GitHub Comments
I have written the tool that works almost the way the topic starter @aduh95 described, it computes and stores URL of the Yarn 2 bundle and URLs of official plugins in a JSON file
.pinyarn.json
, it also writes a small (less than 4Kb) wrapper.pinyarn.js
which you can easily review. The wrapper is responsible for downloading Yarn bundle and Yarn plugin if they have not been downloaded yet, because the wrapper is very small it does not affect Yarn 2 boot time: https://github.com/sysgears/pinyarnFor the CLI you can use corepack https://github.com/nodejs/corepack. Uninstall yarn, run
npm install corepack -g
, and add"packageManager": "yarn@2.3.3"
to yourpackage.json
and corepack will handle downloading and running the correct version