https://classic.yarnpkg.com/en/docs/cli/
There's a yarn v2 now and it's missing lots of features from the original. One big one is that you can no longer install global packages. So my main use for yarn is gone.
init
yarn init -2
This creates a "zero-install" project. Normally, with yarn or npm after you
clone a repo you must run yarn install to download all its dependencies which
often creates an absolutely massive node_modules folder. Yarn does a good job
making sure all the versions stay the same (npm doesn't), but using this
"zero-install" feature is often better. It creates a .yarn/cache folder which
you're meant to check into git. It's much smaller than node_modules as it's only
"binary" code rather than source.
"global" package install
You can install node packages for your user account with yarn, this is useful if
they're not packaged for your distro. yarn global bin prints the install path,
but it's usually ~/.yarn/bin. You need to add this to your PATH if you want
to be able to run the installed programs.
yarn global add: installs a package
yarn global bin: display install path
yarn global list: list manually installed packages
yarn global remove: remove a package
yarn global upgrade: upgrade all or some packages
update global packages
yarn global update
For some reason this command wont update packages past major version bumps. You
can run yarn global add package to manually update a specific package.
local package management
Yarn is primarily used for developing node programs. The following commands are helpful for working on those:
Running yarn without options runs yarn install which will grab all
dependencies for a node project and install them locally in that folder.
yarn add: adds a package to use in your current package.
yarn init: initializes the development of a package.
yarn install: installs all the dependencies defined in a package.json file.
yarn publish: publishes a package to a package manager.
yarn remove: removes an unused package from your current package.