Why Yarn?
.pnp.cjs
instead of a whole folder called node_modules
in EVERY project. (React Native isn’t yet supported though).yarn help
1npm i -g yarn
Set version to Yarn 2.0 (aka berry) inside your project
1yarn set version berry
Set global config
1yarn config set init-license 'CC-BY-SA-4.0' -g
2yarn config set init-version '0.0.1' -g
1# Accessing the list of commands
2yarn help
3
4# Starting a new project
5yarn init
6
7# Installing all the dependencies
8yarn
9yarn install
10
11# Adding a dependency
12yarn add [package]
13yarn add [package]@[version]
14yarn add [package]@[tag]
15
16# Adding a dependency to different categories of dependencies
17yarn add [package] --dev # dev dependencies
18yarn add [package] --peer # peer dependencies
19
20# Upgrading a dependency
21yarn up [package]
22yarn up [package]@[version]
23yarn up [package]@[tag]
24
25# Removing a dependency
26yarn remove [package]
27
28# Upgrading Yarn itself
29yarn set version latest
30yarn set version from sources