npm-check-updates 是一个 nodejs 包更新管理的插件,该插件可以查询当前那些包可以更新,并提供了快速的更新方法。npm-check-updates - npm (npmjs.com)

安装 npm-check-updates

1
npm i -g npm-check-updates

检查当前项目

1
2
3
4
5
6
7
8
9
PS E:\zsf90.github.io> ncu
Checking E:\zsf90.github.io\package.json
[====================] 15/15 100%

hexo-renderer-marked ^4.0.0 → ^5.0.0
hexo-renderer-pug ^2.0.0 → ^3.0.0
hexo-theme-butterfly ^4.0.1 → ^4.1.0

Run ncu -u to upgrade package.json

检查全局

1
2
3
4
PS E:\zsf90.github.io> ncu -g
[====================] 5/5 100%

All global packages are up-to-date :)

更新包

1
2
3
4
5
6
7
8
9
PS E:\zsf90.github.io> ncu -u
Upgrading E:\zsf90.github.io\package.json
[====================] 15/15 100%

hexo-renderer-marked ^4.0.0 → ^5.0.0
hexo-renderer-pug ^2.0.0 → ^3.0.0
hexo-theme-butterfly ^4.0.1 → ^4.1.0

Run npm install to install new versions.

安装新包

1
2
3
4
5
6
7
8
9
10
11
12
13
PS E:\zsf90.github.io> npm install

removed 2 packages, changed 56 packages, and audited 297 packages in 13s

20 packages are looking for funding
run `npm fund` for details

3 vulnerabilities (2 high, 1 critical)

To address all issues, run:
npm audit fix

Run `npm audit` for details.