Yarn Package Manager Cheat Sheet

A Programming › node.js cheat sheet in English by GregFinzer

Yarn Package Manager

23,525 views 5,022 downloads 13 Apr 2017 History
3.8 avg · 1 rating

Links

Install Yarn
Docume­ntation
Get version of Yarn Installed
yarn --version

Migrating from npm

Run first in your project directory on the command line.
yarn
Change Angular CLI to use yarn
ng set --global packag­eMa­nag­er=yarn

Install Packages

Install a package, update the packag­e.json and yarn.lock files
yarn add <pa­cka­ge-­nam­e>
Install a specific version of a package, update the packag­e.json and yarn.lock files
yarn add <pa­cka­ge-­nam­e>@­<ve­rsi­on-­num­ber>
Install to dev depend­encies
yarn add <pa­cka­ge-­nam­e> --dev
Install a package globally
yarn global add <pa­cka­ge-­nam­e>
Get the global cache directory
yarn cache dir
Restore Packages defined in packag­e.json
yarn install

Uninstall Packages

Uninstall, remove from packag­e.json, remove from yarn.lock
yarn remove <pa­cka­ge-­nam­e>
Uninstall a global package
yarn global remove <pa­cka­ge-­nam­e>
Clean from the yarn cache
yarn cache clean

List Packages

List packages used by your applic­ation with no depend­encies
yarn list --depth 0
List packages used by your applic­ation with depend­encies
yarn list
List packages installed globally
yarn global ls
Get info about a package
yarn info <pa­cka­ge-­nam­e>
Why is a package needed?
yarn why <pa­cka­ge-­nam­e>

Verify Packages

Verify package depend­encies
yarn check
Verify package check sums
yarn check --inte­grity

Upgrading Packages

Show outdated packages
yarn outdated
Upgrade a package to the latest version
yarn upgrade <pa­cka­ge-­nam­e>
Upgrade a package to a specific version
yarn upgrade <pa­cka­ge-­nam­e>@­<ve­rsi­on-­num­ber>
Upgrade a global package
yarn global upgrade <pa­cka­ge-­nam­e>

Badges

Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 5

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.