Command Line Summary of yarn and npm, yarnnpm command line

Source: Internet
Author: User

Command Line Summary of yarn and npm, yarnnpm command line

1. commands to be understood first

npm install===yarn-- Install is the default action.

npm install taco --save===yarn add taco-- The taco package is immediately saved to package. json.

npm uninstall taco --save===yarn remove taco

In npm, you can usenpm config set save true Settings--save Is the default action, but this is not obvious to most developers. In yarn, adding (add) or removing (remove) in package. json is the default action.

npm install taco --save-dev===yarn add taco --dev

npm update --save===yarn upgrade

Update vs upgrade, like! Upgrade is what we actually do! When the version number is upgraded, upgrade occurs!

Note:Npm update -- save seems to be a problem in Version 3.11.

npm install taco@latest --save===yarn add taco

npm install taco --global ===yarn global add taco-- As always, use the global tag with caution.

2. Known commands

The package is the same as that on npm registry. Generally speaking, Yarn is just a new installation tool. The npm structure is the same as that of 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 (Similarly, logout)

npm test ===yarn test

Iii. Unique Yarn commands

I skipped some content that reminds us not to use, suchyarn clean.

yarn licenses ls -- Allows you to check the dependent license information.

yarn licenses generate -- Automatically create a dependency disclaimer license.

yarn why taco-- Check why taco is installed and list other packages dependent on it in detail (thanks to Olivier Combe ).

Emojis

Speed

Automatically implement shrinkwrap through yarn lockfile

Security-centric design

4. Npm-specific commands

npm xmas === NO EQUIVALENT

npm visnup=== NO EQUIVALENT

Summary

When I wrote this article, I found that yarn's run Command seems to have a problem and should be fixed in 0.15.2. At this point, npm is much better. The above is all about this article. I hope this article will help you in your study or work. If you have any questions, please leave a message.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.