Settings

Theme

Everything You Wanted to Know About Yarn Package Manager

atatus.com

22 points by fizerkhan 9 years ago · 27 comments

Reader

eric_b 9 years ago

This post contains content that is plagiarized verbatim from other sources. Namely Yehuda's blog post and the Yarn homepage itself.

gotofritz 9 years ago

- promises "everything you wanted to know about yarn"

- has barely any content

  • joelthelion 9 years ago

    Well, most people don't want to know much about Yarn. Granted, mostly because they don't even know it exists :)

  • sotojuan 9 years ago

    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?

  • choward 9 years ago

    I was thinking the same thing. I want to know about the pitfalls and reasons not to use yarn. For example, does it support modules from github?

matthewmacleod 9 years ago

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.

ittan 9 years ago

Yarn needs to learn from lein for clojure. Yarn is the wrong way forward, but an incremental fix for npm.

Kiro 9 years ago

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

  • throwanem 9 years ago

    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.

kyriakos 9 years ago

anyone knows if yarn has an equivalent of --no-bin-links option?

EDIT: guess not according to https://github.com/yarnpkg/yarn/issues/929

agnivade 9 years ago

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.

  • sotojuan 9 years ago

    I don't get why people say this. You're acting like the npm team is desperate for contributions and fixes and the Yarn people are like "No! We'll make our OWN tool!".

    It's the literal opposite. npm hasn't been open to contributions or fixes for years.

  • Touche 9 years ago

    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?

    • throwanem 9 years ago

      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.

      • agnivade 9 years ago

        Exactly my point. I am not totally against reinventing the wheel. Sometimes its fun and sometimes interesting results do come out of it. I am especially looking at the servo project.

        But considering the amount of collaboration effort it took to build this (fb said they collaborated with multiple companies in different timezones), wouldn't it be better to spend a little more time understanding npm's codebase and get it patched ? Maybe I'm wrong, but yea just a thought.

        • Touche 9 years ago

          > But considering the amount of collaboration effort it took to build this (fb said they collaborated with multiple companies in different timezones), wouldn't it be better to spend a little more time understanding npm's codebase and get it patched ?

          Better for you? You know that open source work is free labor, right? Why should they prefer to spend weeks trying to understand undocumented, opaque and "clever" code (much of which has never been refactored) when they can start from scratch with a codebase of their own design?

          What I'm asking is, what is the value to them? Or to you (assuming you ever do open source)? Unless you are getting paid for your OS work, you're under no obligation to do things any way other than what works for you.

  • jerrycruncher 9 years ago

    My favorite thing about the post* that introduced Yarn, itself a rewrite of a basic component, is that the author(s) unironically began with "In the JavaScript community, engineers share hundreds of thousands of pieces of code so we can avoid rewriting basic components, libraries, or frameworks of our own."

    *https://code.facebook.com/posts/1840075619545360?_fb_noscrip...

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection