Is Yarn still a thing?

Does Yarn still a good product? Let's figure it out
10 August 2017   1436

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

Yarn features

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

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

  1. yarn add saves a package not only to node_modules but also adds it to the list of dependencies in package.json. Think of it like yarn does not install a package into node_modules directory, it adds a package to your project
  2. yarn install worked in average from 2 to 3 times faster than npm installyarn changes how packages are downloaded and installed, that’s why it is so blazingly fast
  3. yarn install also checks for yarn.lock (or creates it), a special file where every single version is locked into a known state, what makes dependency resolution process deterministic
  4. yarn 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 js package manager should look like. npm had to take the pace.

npm@5 breaks in

Keeping all that in mind the npm 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 yarn? The changelog for this release is inspiring indeed.

What are the key features that npm@5 brings to us?

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

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

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

Cache: it was completely rewrittencacache and pacote 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 toolnpm is the default. Everyone uses it. Earlier it was like IE: 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 npm@5 was with my the most favorite vue-starter which has around 850 packages to download. npm’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 yarn: 35 seconds without cache and 20 seconds with the cache in place. For me, this time gap was important enough to still use yarnas 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

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

Provided by Elixir club.

Elixir Club 11 in Ternopil

Elixir developers' event will take place on June 23, 2018, in Ternopil, Ukraine
28 May 2018   1491

Elixir community, let’s gather in Ternopil!

We are pleased to invite you on Elixir Club 11 in Ternopil, June 23!

If you are passionate about Elixir programming and interested in technology, then come on Elixir Club 11. You will meet the same people as you are, get live communication and some new knowledge, find answers on your questions.

Programme

Stefan Wintermeyer

Topic: "WebPerformance - Why and How?"

Stefan Wintermeyer,
Stefan Wintermeyer

A dive into the topic of fast webpages. Why does a specific webpage load fast or not? Why is it important? What's the difference between a mobile user on a 3G network and one on a fiber connection? What can be done on the server? Is JavaScript the solution or the reason for this problem?
 

Stefan Wintermeyer

Phoenix Framework developer

Eugene Pirogov

Topic: "ElixirConf Eu 2018, what was it like?"

Eugene Pirogov
Eugene Pirogov

Elixir programming language is raving around the world. Every year tens of community events are being organized to promote and share experience related to this beautiful programming language.
 

Eugene Pirogov
Senior Back-end developer

In April Eugene Pirogov visited one such event – "ElixirConf Eu 2018", a conference held in Warsaw, Poland. He is going to go through the presentations he attended, topics elixir community is exploring these days and finally talk about some exciting upcoming features in Elixir and Phoenix web framework.

Viktor Deryagin

Topic: "Implementing GraphQL API in Elixir"

Viktor Deryagin
Viktor Deryagin

GraphQL is an increasingly popular way of building web APIs, and Absinthe library makes Elixir a really convenient choice for doing it. This talk is about our team's experience of implementing GraphQL API powering popular marketplace for educators Teachers Pay Teachers. I'll tell about challenges we faced in evolving the API over time, monitoring, and leveraging features of OTP to address performance & scaling issues.
 

Viktor Deryagin

Yurii Bodarev

Topic: "GenServer in action"

Yurii Bodarev
Yurii Bodarev

Others will be added soon.

Buy a ticket.

Elixir is a young language, so every developer can come forward and share experience, get a powerful feedback and supporting from a friendly community. We invite you to suggest your speech by filling in the form. Come to us and try yourself as a Speaker.

Also, you can feel free to discuss your problems or solutions on lightning talk. You could suggest your speech via filling in the form or writing down on the board during the conference.

Thanks to our sponsors: Wise Engineering, Aejis.

We are welcome students for your willingness to learn and we give 50% discount via the promo code "student". Please send your student ID’s scan to make your registration on the event faster.

Also, we are welcome parents of a small baby (0-3 years) on maternity leave, who want to grow their skills with growing the kid. You can get a special discount for the ticket with promo code "GrowWithYourKid". Please take kid’s birth certificate with you to confirm the status.

We conduct all our events in a friendly atmosphere and we are always glad to get new people excited with Elixir on our events.

If you have any questions or suggestions, don't hesitate to contact us via cell phone: 099 202 6308 or by email: elixir.club.org@gmail.com

Buy a ticket.