onceclick Quick notes for my learning path :)

Yarn is better than npm

2017-01-09
onceclick
yarn
 

Yarn is a new package manager that we built to be consistent and reliable. When installing hundreds or even thousands of third-party packages from the internet you want to be sure that you’re executing the same code across every system. Yarn is better than npm

Why Yarn?

Yarn provides a rich set of command-line commands to help you with various aspects of your Yarn package, including installation, administration, publishing, etc.

In most cases yarn commands are the same as npm, but there are some exceptions:

  • npm install is now just yarn
  • npm install fabric --save is yarn add fabric
  • npm uninstall taco --save is yarn remove taco
  • npm install taco --save-dev is yarn add taco --dev
  • npm update --save is yarn upgrade
  • npm install taco --global is yarn global add taco
  • npm run debug is either yarn run debug or just yarn debug
  • yarn why taco — Identify why ‘taco’ package is installed, detailing which other packages depend upon it

View more on command changes.

Advantage

  1. From the get-go, the Yarn lockfile guarantees that repeatedly running yarn on the same repository results in the same packages.
  2. Second, Yarn attempts to have good performance, with a cold cache, but especially with a warm cache.
  3. Finally, Yarn makes security a core value. NO npm cache clean && rm -rf node_modules anymore.

Comments