使用npm-check-updates模块升级插件
记录一下自己升级的过程
npm install -g npm-check-updates
ncu - v # ncu是npm-check-updates的缩写命令
$ncu --help
Usage: ncu [options] [filter]
[filter] is a list or regex of package names to check (all others will be ignored).
Options:
--dep <dep> check only a specific section(s) of dependencies: prod|dev|peer|optional|bundle (comma-delimited)
-e, --error-level <n> set the error-level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration). Default is 1. (default: 1)
-f, --filter <matches> include only package names matching the given string, comma-or-space-delimited list, or /regex/
-g, --global check global packages instead of in the current project
-i, --interactive Enable interactive prompts for each dependency
-j, --jsonAll output new package file instead of human-readable message
--jsonUpgraded output upgraded dependencies in json
-l, --loglevel <n> what level of logs to report: silent, error, minimal, warn, info, verbose, silly (default: warn) (default: "warn")
-m, --minimal do not upgrade newer versions that are already satisfied by the version range according to semver
-n, --newest find the newest versions available instead of the latest stable versions
-p, --packageManager <name> npm (default) or bower (default: "npm")
--packageData include stringified package file (use stdin instead)
--packageFile <filename> package file location (default: ./package.json)
--packageFileDir use same directory as packageFile to compare against installed modules. See #201.
--pre <n> Include -alpha, -beta, -rc. Default: 0. Default with --newest and --greatest: 1
-r, --registry <url> specify third-party npm registry
--configFilePath <path> rc config file path (default: ./)
--configFileName <path> rc config file name (default: .ncurc.{json,yml,js})
-s, --silent don't output anything (--loglevel silent)
-t, --greatest find the highest versions available instead of the latest stable versions
--timeout <ms> a global timeout in ms
-u, --upgrade overwrite package file
-x, --reject <matches> exclude packages matching the given string, comma-or-space-delimited list, or /regex/
--semverLevel <level> find the highest version within "major" or "minor"
--removeRange remove version ranges from the final package version
-v, --version 3.1.23
-V
-h, --help output usage information
$ ncu
Checking C:\Users\tudan\Documents\WorkLearn\dreamer-framework\dreamer-front\package.json
[====================] 13/13 100%
axios ^0.18.0 → ^0.19.0
install ^0.12.2 → ^0.13.0
iview ^3.2.2 → ^3.5.1
vue ^2.5.21 → ^2.6.10
vue-router ^3.0.1 → ^3.1.3
vuex ^3.0.1 → ^3.1.1
@vue/cli-plugin-babel ^3.0.0 → ^3.11.0
@vue/cli-plugin-eslint ^3.0.0 → ^3.11.0
@vue/cli-service ^3.0.0 → ^3.11.0
babel-eslint ^10.0.1 → ^10.0.3
eslint ^5.8.0 → ^6.4.0
eslint-plugin-vue ^5.0.0 → ^5.2.3
vue-template-compiler ^2.5.21 → ^2.6.10
Run ncu -u to upgrade package.json
ncu -u
Upgrading C:\Users\tudan\Documents\WorkLearn\dreamer-framework\dreamer-front\package.json
[====================] 13/13 100%
axios ^0.18.0 → ^0.19.0
install ^0.12.2 → ^0.13.0
iview ^3.2.2 → ^3.5.1
vue ^2.5.21 → ^2.6.10
vue-router ^3.0.1 → ^3.1.3
vuex ^3.0.1 → ^3.1.1
@vue/cli-plugin-babel ^3.0.0 → ^3.11.0
@vue/cli-plugin-eslint ^3.0.0 → ^3.11.0
@vue/cli-service ^3.0.0 → ^3.11.0
babel-eslint ^10.0.1 → ^10.0.3
eslint ^5.8.0 → ^6.4.0
eslint-plugin-vue ^5.0.0 → ^5.2.3
vue-template-compiler ^2.5.21 → ^2.6.10
Run npm install to install new versions.
yarn install
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.6: The platform "win32" is incompatible with this module.
info "fsevents@1.2.6" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > eslint-plugin-vue@5.2.3" has incorrect peer dependency "eslint@^5.0.0".
warning "eslint-plugin-vue > vue-eslint-parser@5.0.0" has incorrect peer dependency "eslint@^5.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 39.09s.
npm-check-updates 升级插件,更新后会自动修改 package.json 里的版本号,但是 package-lock.json 或者 yarn.lock 不会更新,需要重新 npm install 或者 yarn install。