First, need to understand the command
npm install= = = yarn --install installation is the default behavior.
npm install taco --save= = = yarn add taco --taco package is immediately saved to Package.json.
npm uninstall taco --save ===yarn remove taco
In NPM, you can use npm config set save true settings- -save The default behavior, but this is not obvious to most developers. In yarn, the behavior of adding (add) and removing (remove) in Package.json is the default.
npm install taco --save-dev ===yarn add taco --dev
npm update --save ===yarn upgrade
Update (UPDATE) vs Upgrade (upgrade), Praise! Upgrade is the actual thing to do! When the version number is promoted, it happens to be upgrade!.
Note: npm update--save seems to have a problem with version 3.11.
npm install taco@latest --save ===yarn add taco
npm install taco --global = = =- yarn global add taco Use the global tag carefully, as always.
Ii. Known Orders
The package is the same as the NPM registry. In general, Yarn is just a new installation tool, and the NPM structure is the same as registry.
npm init ===yarn init
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 (Logout empathy)
npm test ===yarn test
Iii. Yarn's unique order
I skipped over some of the things that reminded us not to use, such as yarn clean .
yarn licenses ls -Allows you to check dependent license information.
yarn licenses generate --Create dependent disclaimer license automatically.
yarn why taco--Check why the taco is installed, detailing other packages that depend on it (acknowledgements Olivier Combe).
Emojis
Speed
Shrinkwrap function automatically implemented by yarn Lockfile
Security-centric design
Four, NPM's unique command
npm xmas = = NO equivalent
npm visnup= = NO equivalent
Summarize
When I wrote this article, I found that yarn's Run command seemed to be a bit of a problem and should be repaired in 0.15.2. At this point, NPM is much better. The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.