Home

Awesome

<img src="https://cdn.rawgit.com/detailyang/awesome-cheatsheet/master/awesome.svg" alt="awesome" width="120" align="right" >

Awesome Cheatsheet Awesome

Branch master Build Status GitHub license

Why Yarn

Yarn is Super Fast!!

Yarn caches every package it downloads so it never needs to again. It also parallelizes operations to maximize resource utilization so install times are faster than ever.

Common NPM commands in Yarn

NPM CommandYarn CommandDescription (wherever necessary)
npm installyarn <br/> yarn installWill install packages listed in the package.json file
npm install pkg-name <br/> npm install --save pkg-nameyarn add pkg-nameBy default Yarn adds the pgk-name to package.json and yarn.lock files
npm install pkg-name@1.0.0yarn add pgk-name@1.0.0
npm install pkg-name --save-devyarn add pkg-name --dev
npm install pkg-name --peeryarn add pkg-name--peer
npm install pkg-name --optionalyarn add --optional
npm install -g pkg-nameyarn global add pkg-nameCareful, yarn add global pkg-name adds packages global and pkg-name locally!
npm updateyarn upgradeNote: It's called upgrade in yarn
npm uninstall pkg-nameyarn remove pkg-name
npm run script-nameyarn run script-name
npm inityarn init
npm packyarn packCreates a compressed gzip archive of the package dependencies
npm linkyarn link
npm outdatedyarn outdated
npm publishyarn publish
npm runyarn run
npm cache cleanyarn cache clean
npm loginyarn login (and logout)
npm testyarn test
npm install --productionyarn --production
npm --versionyarn version
npm infoyarn info

New Commands in Yarn

Yarn CommandDescription
yarn why pkg-name Builds a dependency graph on why this package is being used
yarn cleanFrees up space by removing unnecessary files and folders from dependencies
yarn licenses ls  Inspect the licenses of your dependencies
yarn licenses generate-disclaimer  Automatically create your license dependency disclaimer

References

https://yarnpkg.com/en/docs/