http://javascript.ruanyifeng.com/nodejs/npm.html#toc23
https://docs.npmjs.com/getting-started/semantic-versioning
npm i
npm i
npm uninstall
npm uninstall
npm outdated
npm update
-g --save --save-dev
npm -v
发包
npm adduser
npm login
npm publish
npm version patch
git push --tag
Updating the package
When you make changes, you can update the package using npm version <update_type>
, where update_type is one of the semantic versioning release types, patch, minor, or major. This command will change the version number inpackage.json
. Note that this will also add a tag with this release number to your git repository if you have one.
After updating the version number, you can npm publish
again.
Test: Go to https://npmjs.com/package/<package>
. The package number should be updated.
The README displayed on the site will not be updated unless a new version of your package is published, so you would need to run npm version patch
and npm publish
to have a documentation fix displayed on the site.
After this, changes should be handled as follows:
- Bug fixes and other minor changes: Patch release, increment the last number, e.g. 1.0.1
- New features which don't break existing features: Minor release, increment the middle number, e.g. 1.1.0
- Changes which break backwards compatibility: Major release, increment the first number, e.g. 2.0.0
清除重复引用
npm dedupe
https://docs.npmjs.com/how-npm-works/npm3-dupe
版本
具体见:https://docs.npmjs.com/misc/semver
~ 允许patch
^ 允许小版本
https://docs.npmjs.com/misc/semver