yarn
doesnpm install
yarn add foo
doesnpm install foo --save
- and for global installs:
yarn global add foo
is the same asnpm install foo --global
(this was cribbed from here, switched around a little, and will probably become out-dated quite quickly; yarn docs can be found here)
npm install === yarn
//Install is the default behaviornpm install taco --save === yarn add taco
//taco package is saved to your package.jsonnpm uninstall taco --save === yarn remove taco
//—-save can be defaulted in NPM by npm config set save true but this is non-obvious to most developers. Adding and * removing from package.json is default in Yarn.npm install taco --save-dev === yarn add taco --dev
npm update --save === yarn upgrade
//Great call on upgrade vs update, since that is exactly what it is doing! Version number moves, upgrade is happening! WARNING npm update --save seems to be kinda broken in 3.11npm install taco@latest --save === yarn add taco
npm install taco --global === yarn global add taco
//As always, use global flag with care. (Note: global always precedes add, bin, ls, remove, etc)
The packages are the same as on the NPM registry. Yarn is basically a new installer, where NPM structure and registry * is the same.
npm init === yarn init
npm ls === yarn ls
npm link === yarn link
npm outdated === yarn outdated
npm publish === yarn publish
npm run === yarn run
npm cache clean === yarn cache clean
npm login === yarn login (and logout)
npm test === yarn test
(yarn clean
is warned against, but is there. It's run on yarn
anyway, though.)
yarn licenses ls
//Allows you to inspect the licenses of your dependenciesyarn licenses generate
// Automatically create your license dependency disclaimeryarn why taco
// Identify why taco package is installed, detailing which other packages depend upon it- 🐟 Emojis 🐸
- Speed 🏃⌁
- Automatic shrinkwrap with the yarn lockfile
- Security-centric design
npm xmas === **NO EQUIVALENT**
npm visnup === **NO EQUIVALENT**
I considered turning it into a table. Would that be preferred?