Difference between yarn versions
Asked Answered
P

1

8

I've been using yarn 1.x for a while, installed with npm. Today, I wanted to use a plugin, which, after some research propted me to install something like yarn 3.x. I had no idea that there are other supported versions of yarn. To be honest, now I'm totally confused about the yarn versioning. I'm particullary confused about backwards compatibility, folder structure, differences between the 1.x ; 2.x ; 3.x. I tried looking at the docs for each version, looked at github repos and checked internet, but I was unable to find some comparison/explanation why this has happened, why are all of the versions supported and maintained (to some extent).

What I would like to know: Is there any site/article explaining the difference and reasoning with this weird versioning? What's the backwards compability with yarn versions? What is the recomended version of yarn?

I know this is not a technical question, however I don't know where else to ask. I'm not asking for oppinions, I'm asking for fact, or resources (articles, github issues,...) to research this myself.

Phago answered 27/3, 2022 at 8:40 Comment(0)
L
7

Yarn's website is the best resource, because there are a lot of new and breaking features. I learned about it a month ago and after a few days of toying with it, I had it set up and working as part of our build pipeline.

The motivation behind these newer versions is to fix what they see as inefficiencies in the Node module resolution algorithm and a belief in very strict dependency checking (you can't use something that some NPM module is using, everything has to be explicit).

A lot of the functionality seems to mainly benefit monorepo setups.

Check out their migration docs to see how you can gracefully update an existing project. I have found that it has a huge effect on the time it takes to calculate all dependencies.

The most frustrating thing about it is that some tools/libraries straight up refuse to work with it. AWS Amplify is the one that's been giving me trouble, even if I set it to use v1, it still refuses my builds.

I've been meaning to publish a blog article about my experience. It's an interesting tool in the newer versions, but it isn't quite ready for prime time. If you set it up, you are the one who has to maintain it from now on. I wrote everything in our README explaining how it affects our current processes and no one has complained yet.

Lithoid answered 31/5, 2022 at 16:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.