This is Yarn!





Hey all,

Recently I was running a few projects and got a weird behavior my npm runs were taking too long ** devs will understand the frustration of having to wait long times for the entire script to finish running :( ** .

So after all that pain I was talking to a friend the introduced me to Yarn(https://yarnpkg.com/), a package manager like the classic NPM but with a amazing performance doing the same tasks with a similar language.

How to Install Yarn:

https://yarnpkg.com/en/docs/install

 in this link you'll find the installation process to each OS, just pick yours and go for it.


I know now you thinking "Why would I bother, they probably don't even have an extensive library of packages!" I thought that too until I found out the Yarn works with the same library NPM uses.

So if you're used to run like 

npm install font-awesome

With Yarn you can just do this

yarn add font-awesome

and voilá, all good! :D 

And wasn't just speed but with npm sometimes controlling versions of packages can become a mess once the list starts to get bigger and Yarn let you have a better handle on them.

Overall I'm not telling anyone they should pick NPM or Yarn over all both have their good sides and bad sides, the best to be done is really see what works better for you and which one you get more used to work with it.

The goal in reality is just improve your workflow.

Well that's all for now, see you guys in the next post :D



Sort:  

Thank you wanna try that out

Yarn is great. But there's a caveat to introducing it into your ecosystem:

Yarn uses a file called yarn.lock to remember package versions, and this file is incompatible (and will remain incompatible) with npm's package-lock.json.

Since you want to commit the lockfile with the rest of your code, if you're using yarn you should be adding the package-lock.json file to your ignore list (eg .gitignore).

cf https://yarnpkg.com/blog/2017/05/31/determinism/