Live data from Hacker News

Everything You Wanted to Know About Yarn Package Manager

atatus.com

11–20 of 28 posts

Re: Everything You Wanted to Know About Yarn Package Manager

#11
I have such a burning, unquenchable hatred for NPM that I just switched to using Yarn. It's fine, has done what I expect it to, and hasn't caused any problems so far. Maybe not an ideal solution, but for someone coming primarily from languages that have non-shitty package managers it's a breath of fresh air.

Re: Everything You Wanted to Know About Yarn Package Manager

#14

- promises "everything you wanted to know about yarn" - has barely any content

What do you expect when Yarn has been out for less than a couple of weeks and this person isn't involved with the project in any way?

to not write an article proclaiming its everything?

Re: Everything You Wanted to Know About Yarn Package Manager

#18
post #17

What's the benefit of having a lockfile compared to just specifying exact versions in your package.json?

Because you can only specify exact versions for your top-level dependencies. Whether or not they pin versions of their own dependencies is up to their own maintainers; you can't control it from package.json. And, while a lot of npm packages adhere to semver and avoid shipping breaking changes on minor version number bumps, a lot of npm packages don't. So you can get hosed through no fault of your own by an Nth-level dependency.

'npm shrinkwrap' solves this by pinning the currently installed versions of everything under node_modules/, regardless of dependency depth. Yarn does the same thing, but by default rather than, as with npm, an optional extra. There's an argument to be made that the correct place to shrinkwrap, if you want to, is in your build process. But I suspect that, in practice, Yarn defaulting to it will prove a net positive, albeit a bit of a speedbump for people looking to do turnkey migrations from npm.

Re: Everything You Wanted to Know About Yarn Package Manager

#19
post #17

What's the benefit of having a lockfile compared to just specifying exact versions in your package.json?

Because you can only specify exact versions for your top-level dependencies. Whether or not they pin versions of their own dependencies is up to their own maintainers; you can't control it from package.json. And, while a lot of npm packages adhere to semver and avoid shipping breaking changes on minor version number bumps, a lot of npm packages don't . So you can get hosed through no fault of your own by an Nth-level…

Oh, of course. Thank you!

Re: Everything You Wanted to Know About Yarn Package Manager

#20
post #7
post #4

Why can't all of this be patched in npm ? Why do we have to create a new tool every time ? It makes no sense and honestly makes me want to tear my hairs.

A lot of people say this and I'll repeat the answer: go look at npm's source code and tell me you'd like to "patch in" a large change such as the one Yarn takes on. No seriously, go look at their source code. In particular go look at the caching code, one of the big things that Yarn fixes. You think their time would have been better spent hacking on that?

Maybe? It'll be interesting to see how many bugs turn up in Yarn that've already been fixed in npm. Until we can perform that kind of comparison, I'm not sure it is possible to know whether building a new package manager from scratch was more worthwhile than improving the one that everyone already uses.
Post reply on HN