Nodejs 包优雅的升级

前记

最近在升级 hexo 各种包的版本,对于升级推荐使用 npm-check-updates,这个包可以做所有 npm oudatednpm upgrade 能做的事情

安装

1
npm install -g npm-check-updates

检查

利用 ncu 检查包的版本,输出如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
> ncu
Checking /hexo/package.json
[====================] 16/16 100%

hexo ^5.4.2 → ^6.3.0
hexo-deployer-git ^2.1.0 → ^4.0.0
hexo-generator-archive ^1.0.0 → ^2.0.0
hexo-generator-category ^1.0.0 → ^2.0.0
hexo-generator-index ^2.0.0 → ^3.0.0
hexo-generator-sitemap ^2.2.0 → ^3.0.1
hexo-generator-tag ^1.0.0 → ^2.0.0
hexo-pangu ^0.2.1 → ^0.2.2
hexo-renderer-ejs ^1.0.0 → ^2.0.0
hexo-renderer-marked ^3.3.0 → ^6.0.0
hexo-server ^2.0.0 → ^3.0.0
hexo-theme-next ^8.12.1 → ^8.15.0
hexo-word-counter 0.0.3 → 0.1.0

Run ncu -u to upgrade package.json

升级

upgrade package.json

1
ncu -u

install new versions

1
npm install