Npm
GitbookKb2021-02-28
📑 🍷🐝 我的 npm package 信息
- scope:@williamjiang
- 包名:util
- https://www.npmjs.com/package/@williamjiang/util
📑 🍷🐝 如何更新发布到 npm 的 package?
以@williamjiang scope 下面的 util 为例,当对 util 做了改动就需要更新到 npm。
- 进入到 util 目录, 对 index.js 做一些修改(做为要更新的内容)
- 然后再命令行执行
npm version patch
, 此命令会把package.json
的 version 更新到 0.02 - 然后执行
npm publish
就可以更新到npm
了
Learning npm the Node Package Manager
🍷 package.json, package-lock.json
license
: “ISC”-
semantic (语义的) versioning:
major
,minor
,patch
: 4.16.3Caret^: All minor and patches OK:
^4
=4.x.x
Tilde~: All patches only: ~4.16.x
"dependencies": { "my_dep": "^1.0.0", "another_dep": "~2.2.0" },
package-lock.json
: control versioning, always include it to repo.-
versioning check:
$ npm outdated $ npm outdated -g $ npm install -g npm-check-updates $ ncu -u $ npm install
Notice: npm update
not work well.
-
cache:
$ npm cache verify $ npm cache clean --force
-
audit:
$ npm audit $ npx audit fix
🍷 npmjs.com
$ npm publish
$ npm whoami
$ npm login