Regarding the enforcement of the NPM version: ever heard of https://volta.sh?
The only thing I miss about yarn when I switch to NPM is the way you can run package scripts without the word "run". Just "yarn build". It's the tiniest thing but it makes a difference with how often you do that. I hope NPM copies it some day.
Can you fix transitive dependencies in npm natively yet? That's why I switched to yarn.
Re:Hello Yarn 2, Goodbye node_modules
by trinovantes on Monday August 09, 2021 @06:21PM
(#28123049)
What kind of issues did you encounter converting to yarn 2/3?
Re:Hello Yarn 2, Goodbye node_modules
by theshrike79 on Tuesday August 10, 2021 @02:24AM
(#28125669)
Not the OP, but there was no clear tutorial on how to do it when I first tried it.
I've got actual work to do, I don't have time to spend a day or two figuring out how to do yarn2 on our dev machines + CI env + prod. So we just stuck with yarn1.
Now when Yarn 3 is out, it's either back to npm, which is supposedly on par with yarn1 in speed or I'll try a yarn 1 ->3 transition.
Not that I’m a fan of Yarn 2+, but this view strikes me as narrow. Setting up and upgrading the development environment is actual work, too! If you don’t treat it as such, developer efficiency will suffer in the long run.
Re:Hello Yarn 2, Goodbye node_modules
by theshrike79 on Tuesday August 10, 2021 @06:20AM
(#28127045)
But breaking the development and CI environments will prevent a good dozen people from working. So it's a risk vs reward question.
Unless it’s some arcane setup, I don’t see what would break from one developer trying stuff on a branch.
Even if you don’t have your build pipelines in the same or any repo, you could probably clone then modify them on a reasonable CI server.
I'm currently using yarn 1.17. Is the npm workspaces support on par with yarn 1? If so I might switch back to that.
Meanwhile, as much as I respect the work of Mael (yarn maintainer) I’ve switched back to npm. Mostly because:
- isaacs (original creator of npm) did some commits lately
- now backed by GitHub
- they introduced workspaces (monorepo support) in npm 7
- it’s still easier to use the standard tooling in dev/ci/prod
- like many, I had issues trying to convert my projects to yarn v2/3
The only thing yarn did I want in npm is an easy way to enforce the npm version across all environments (https://classic.yarnpkg.com/en/docs/cli/policies/).