Yarn is a package manager made by Facebook to replace npm. It's fast, easy and it doesn't have it's own registry.
The following post will be a guide for adding Yarn support to your project.
- Install Yarn.
yarnin the directory of your project.
- Commit the generated yarn.lock file.
After that, you can easily add modules with yarn. And it's really fast.
Adding a dependency:
yarn add <dependency> yarn add <dependency>@[version] yarn add <dependency>@[tag]
This automatically adds the dependency to your config.json
A lockfile is made for the purpose of getting rid of the sentence "Works for me."
It stores the version of the package that the developer has, so when the user types "yarn", it installs the package with the version that the developer was coding for.
No more GitHub issues about dependencies!
The handiest extra command included in Yarn is the "why" sub-command.
yarn why <package>
It shows why a package is installed, for example:
"This module exists because it's specified in "dependencies"."