Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Why You Should Consider Switching To Yarn, The New Package Manager by Facebook?

Parent Feed: 

Let me guess: your whole work as a developer (and even more so if you're a front end developer) depends on and relies on NPM, the "Holly Grail" of JavaScript package managers!

How about Facebook's own (not that) recently released package manager?

Has it even stirred your attention, just to see what new features it comes equipped with and how/if it can improve your whole workflow? Or have you stubbornly overlooked it, sticking to your way too familiar, already tested JavaScript package manager?

But what if it actually helps you handle your Javascript files much faster (thus gaining time, which is gold especially when you're dealing with huge web projects)? What if it is more secured? What if you discover that it's a much more simplified version of the standard "monopolizing" NPM?

If you're willing to continue to handle your Javascript frameworks, libraries or plugins in the same familiar pace, no need to continue digging up more info about what Yarn can do for you.

But if you're not too afraid to test and eventually embrace innovation and if you're constantly looking for breakthroughs that could help you get even more efficient in your work, well, then here's why should start using Facebook's Yarn today:
 

1. Catching Mode

Imagine this scenario: you're trying to install a package that you already installed once, in the past, and your internet connection goes down!

Here Yarn comes to your rescue: it practically catches the packages that it downloads and this features allows it to it handle previously installed packages without internet connection.

Could you have imagined this when you were using NMP?
 

2.  Secure and Faster Installs

Security is vital when you're deploying lots of packages during the development process of a big web project!

Stay reassured: Yarn inspects every package's integrity for you, keeping your project protected from any corrupt package that you might need to install.

As for speed (and this is no "small" detail when you need to install lots and lots of JS packages), Yarn becomes a serious competition for NPM: depending on the packages' sizes it can turn an install into a matter of just a few seconds.
 

3. Registry Compatibility

Need to download a package from the NPM repository? Or maybe from Bower or other custom repo?

Yarn "spoils" you with registry compatibility. So, feel free to install and boost your web project with whatever JavaScript package you need!
 

4. Deterministic Install Algorithm

Bid farewell to machine specific bugs! 

For Yarn uses lock files, which allows it to keep the same node_modules directories structure; it practically installs the same dependencies regardless of the types of development environments (that's right,Yarn allows you to install them across multiple machines) that you're installing your JavaScript packages in or of the order in which you install them.

Just imagine: same structure (node_modules directories) for all the "participants" in a large project; close to zero bugs that would otherwise replicate on multiple machines.
 

5. Improved Network Performance 

On a scale of 1 to 5 how frustrated do you get when your package's installation fails more than 2 or 3 times in a row?

Good news: Yarn will make the whole process stress-free. How? It queues up, mitigates and constantly retries the failed requests, thus reducing the no. of installation failures.
 

Does This Mean We're Witnessing The End of NPM?

No, we're not, for one major reason: open-source projects don't work that way. 

The whole community behind it (bringing together Facebook, Google, Exponent and Tilde engineers) see themselves as NPM contributors instead of "annihilators". 

In a nutshell: Yarn is the proof of how a piece of code written so that it should address secific work scenarios better than the generally-used and proven “tool” can turn into a competitive new tool that other teams of developers can deploy, as well.

Note: there still are improvements to be made (but we're talking about Facebook here, so expect the team behind it to work hard to continuously perfect it) and making Yarn capable to help you handle private packages (its main limitation at the moment) is on top of the list!

How can get started with Yarn? Well, it's available on GitHub, under a BSD-2-clause license. Go get it, test it and share your thoughts in the comments bellow! We're more than curious what are your impressions about the new Yarn vs the conventional NPM "competition" (for developers' preferences) are. Happy Yarning!  

Author: 
RSS Tags: 
Original Post: