Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Yarn a wrapper over npm?

I'm aware of the benefits that Yarn brings about and what it does that npm doesn't. I do have some doubts however:

  • Does Yarn use npm under the hood for some of the other commands that retain the same behaviour as npm?
  • If no, is there a reason why they were re-implemented in yarn and are there downsides to this approach?
like image 235
Yangshun Tay Avatar asked Oct 30 '25 05:10

Yangshun Tay


1 Answers

No, it is a rewrite.

Rather than continue building infrastructure around the npm client, we decided to try looking at the problem more holistically. What if instead we attempted to build a new client that addressed the core issues we were experiencing? Sebastian McKenzie in our London office started hacking on this idea and we quickly became excited about its potential.

-- https://code.facebook.com/posts/1840075619545360

It offers the same API (without some shortcuts if you notice). This is (I am guessing) because the original interface was simple enough and to ensure adoption.

It is much faster, solves typical problems of npm (undeterministic deploys mainly). This can be only achieved with a top-down rewrite, they also changed how deps are installed (fetch, calculate, download, link) so the logic is different.

The downsides of this approach is that it requires a huge amount of work. Normally you would just PR over the main repo, but given they wanted a whole different thing and Facebook has the means, they decided going solo.

Another big downside is that its benefits won't be immediately available for all the npm older users, since it is not an upgrade and it does not come installed with node.

like image 142
jsdario Avatar answered Nov 01 '25 18:11

jsdario



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!