Yarn is an alternative package manager to npm. It's been around since 2016.
Yarn's claim to fame is stability. It aims to have a deterministic installation; given a
yarn.lock file, Yarn will always create the some node_modules tree.
We use Yarn in the monorepo!
What is Yarn Berry?
Yarn Berry is the codename for a complete rewrite of the Yarn codebase that started two years ago.
All new versions of Yarn (the latest is 3.1.0) live in the yarnpkg/berry GitHub repo.
In addition to PnP-by-default, the new Yarn architecture is composed of small modules with intentional API
surfaces. It also includes a plugin framework that can make use of these new modules.
You check it in to your repo!
Why should I migrate off of Yarn v1?
New plugin API allows for really awesome new workflows, PnP improves performance and stability, and
Zero-Installs improve development experience and CI performance.
Also... Yarn v1 is deprecated and will not receive any future updates!
What do I get out of it?
A bunch of stuff! But first we need to explain some things we've been glossing over.
It should be the package manager's job to inform the interpreter about the location of the packages on the
disk and manage any dependencies between packages
Make your projects as stable and fast as possible by removing the main source of entropy from the equation:
What does that actually get us, practically?
Dramatically reduced install time in CI. git clone takes an extra 15 or 20 seconds,
and that's... it. Nothing else needs to be downloaded or written to disk. This led to a 4-minute+
decrease in build time for Oak.
Switching branches? That's all you need to do. No need to run yarn install,
yarn clean, rm -rf ./**/node_modules, what have you.
Yarn will now tell you if your packages attempt to import modules they don't declare a dependency on.
Real plugins! Have a thing you wished Yarn did for you? Now you can add support for that thing!