Package Managers
Switching from NPM to Yarn
While you may be familiar with npm
, or even use it as your package manager of choice, it is not the recommended package manager for this project. This is because Yarn
is faster, more reliable, and more extensible than npm
. If you are not familiar with Yarn
, you can read more about it here.
To download Yarn
using npm
, run the following command:
This will install Yarn Classic/v1
globally on your machine.
Upgrading to Yarn 3
Why Yarn 3
Yarn 3
includes a host of benefits over Yarn Classic/v1
, including:
Even faster installs
More verbose & readable output
Yarn version
is stored directly in the repo to keep everyone on the same versionYarn plugins
can be added to extend the functionality ofYarn
PnP
(Plug and Play) mode can be used to improve performance and stability (if supported by your project)Helpful, new commands like
yarn dedupe
,yarn info
, & more
Yarn does not use
PnP
by default. If you would like to usePnP
, you can read more about it here.
Read more about the differences between
Yarn Classic/v1
andYarn 3
here.
Upgrading
To upgrade to Yarn 3
from Yarn Classic/v1
, run the following command:
Yarn Plugins
Now, you can start getting plugins to extend the functionality of Yarn 3
.
Yarn-Typescript Plugin
This will install the Yarn-TypeScript
plugin, which automatically adds @types/
packages into your dependencies when you add a package that doesn't include its own types
Interactive-Tools
This will install the Interactive-Tools
plugin, which includes the yarn dedupe
& yarn upgrade-interactive
commands. These commands will help you to remove duplicate packages from your node_modules
folder, and upgrade your dependencies to the latest versions.
Last updated