My Shift from “npm“ to just “Yarn“

shihab P M
2 min readMay 30, 2017

--

A package manager that covers the drawback’s present in npm .

Yarn is a new package manager for JavaScript built by Facebook. As can be read in the official announcement, its purpose is to solve a handful of problems that the team faced with npm (namely ) .But, don’t be alarmed! This is not an attempt to replace npm completely .

Yarn is only a new CLI client that fetches modules from the npm registry. Nothing about the registry itself will change — you’ll still be able to fetch and publish packages as normal.

From the past two years I had been using npm and bower in combination , as I kept using I found some difficulties in maintaining two folders namely node_modules and bower_component , Now ever since I started using yarn I personally got rid of bower and now I only work around with node_modules folder,I found many short commands compared to npm that are very easy to remember too and does the same job that npm does for us but in a way that solely helps the front-end development .

Below are two links to cheat-sheet that might help you understand how the commands are slightly user friendly when compared to npm and simplify our tasks.

Take a quick look at some more goodies that Yarn has to offer:

Lockfile

Yarn adds the long awaited Lockfile feature with even stricter reproducability across devices and systems than npm offers at the moment.

To avoid package version mis-matches, an exact installed version is pinned down in a lock file. Every time a module is added, Yarn creates (or updates) a yarn.lock file. This way you can guarantee another machine installs the exact same package, while still having a range of allowed versions defined in package.json.

Speed and offline

Yarn caches every package it downloads so it never needs to download it again. It also parallelizes operations to maximize resource utilization so install times are faster than ever.

Licenses

yarn licenses ls lists the licenses of all installed packages. yarn licenses generate-disclaimer generates a disclaimer containing the contents of all licenses of all packages. Some licenses state that you must include the project’s license in your project, making this a rather useful tool to do that

Thanks for Reading ,Please do keep posting comments ;)

--

--

No responses yet