Is Yarn still a thing?

Nikita Sobolev
Jun 12, 2017 · 3 min read
Image for post
Image for post

When was just released this question was the first one I have googled. No doubts it comes to mind since new version introduced a lot of ’s features. In other words: should I still use after installing ?

Yarn features

Why do people use in the first place? had some known issues. Well, we all have been there: downloading and installing packages for hours, resolution hell, not using essential and by default, and many others.

When was first released it solved many of these issues completely. It offered multiple improvements:

  1. saves a package not only to but also adds it to the list of dependencies in . Think of it like does not install a package into directory, it adds a package to your project
  2. worked in average from 2 to 3 times faster than . changes how packages are downloaded and installed, that’s why it is so blazingly fast
  3. also checks for (or creates it), a special file where every single version is locked into a known state, what makes dependency resolution process deterministic
  4. utilizes cache to make the installation process even faster. It is even possible to reinstall everything without internet connection when the cache is alive (saved me once)

This set of advantages at some point predetermined how the package manager should look like. had to take the pace.

npm@5 breaks in

Keeping all that in mind the core team made a huge step towards the competitor. When the 5th major release was out a lot of people asked this question: should we still use ? The changelog for this release is inspiring indeed.

What are the key features that brings to us?

Speed up: it is now competing with and other package managers. Here’s a nice gif of the speed up, brought to you by one of the ‘s core members:

Determinism: now enforces the same workflow as (and many other package managers). It generates to know what exact versions your project uses. It is worth mentioning that algorithms in and differ. And has a solid advantage since it has better hoisting position across npm versions than has across different version of .

Sane defaults: is now enabled by default. No more problems with that.

Cache: it was completely rewritten. and living inside the new realization are fast and reliable. You can run this command to see it yourself:

git clone https://github.com/zkat/cacache && cd cacache && npm i && npm run benchmarks

Default tool: is the default. Everyone uses it. Earlier it was like : a browser to download another browser. Jokes aside, this point is strong. You don’t need to have this one extra custom package manager.

But, really, is yarn still a thing?

The answer is: it depends.

My first attempt to install something with was with my the most favorite -starter which has around 850 packages to download. ’s time was not bad at all with 42 seconds at the fresh run. When the cache is ready, it takes only 30 seconds to install everything.

Compared to : 35 seconds without cache and 20 seconds with the cache in place. For me, this time gap was important enough to still use as a primary tool.

But. Do not use both tools inside one team. It will lead to a disaster with package resolution and pollute your repository with extra files. Stick to something and use it.

Finale

is moving in a right direction (say hi to ). It is pretty great already, but soon it will be even cooler.

Subscribe to stay tuned for more articles about , , and :

wemake.services

We love Python and Elixir. We use Javascript.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store