前言
安装
npm install -g npm-check-updates
用法
检查当前目录下可更新的依赖项
ncu
升级 package.json
ncu -u
根据更新的 package.json 安装新版本
npm install
检查全局包:
添加 -u 以获取升级的单行命令
ncu -g
以下四中写法作用相同
ncu —filter one, two, three
nuc -f one, two, three
ncu one, two, three
ncu one two three
ncu —reject one, two, three
ncu -x one, two, three
匹配以 “gulp-” 开头的依赖项
ncu ‘/^gulp-.*$/‘
匹配不以 “gulp-” 开头的依赖项
ncu ‘/^(?!gulp-).*$/‘
配置文件
例如 .ncurc.json:
{
“upgrade”: true,
“filter”: “express”,
“reject”: [
“@types/estree”,
“ts-node”
]
}
参考文档
https://github.com/tjunnone/npm-check-updates
版权声明:《 维护 NPM - 检查并更新项目依赖的版本 》为漠北星火原创文章,转载请注明出处!
最后编辑:2020-9-13 10:09:05