Breaking
--semverLevel major
is now--target minor
.--semverLevel minor
is now--target patch
. This change was made to provide more intuitive semantics for--semverLevel
(now--target
). Most people assumed it meant the inclusive upper bound, so now it reflects that. a2111f4c2- Programmatic usage:
run
now defaults tosilent: true
instead ofloglevel: 'silent
, unlessloglevel
is explicitly specified. If you overrodesilent
orloglevel
, this may affect the logging behavior. 423e024
Deprecated
Options that controlled the target version (upper bound) of upgrades have been consolidated under --target
. The old options are aliased with a deprecation warning and will be removed in the next major version. No functionality has been removed.
--greatest
: Renamed to--target greatest
--newest
: Renamed to--target newest
--semverLevel
: Renamed to--target
See: 7eca5bf3
Features
Doctor Mode
Usage: ncu --doctor [-u] [options]
Iteratively installs upgrades and runs tests to identify breaking upgrades. Add -u
to execute (modifies your package file, lock file, and node_modules).
To be more precise:
- Runs
npm install
andnpm test
to ensure tests are currently passing. - Runs
ncu -u
to optimistically upgrade all dependencies. - If tests pass, hurray!
- If tests fail, restores package file and lock file.
- For each dependency, install upgrade and run tests.
- When the breaking upgrade is found, saves partially upgraded package.json (not including the breaking upgrade) and exits.
Example:
$ ncu --doctor -u
npm install
npm run test
ncu -u
npm install
npm run test
Failing tests found:
/projects/myproject/test.js:13
throw new Error('Test failed!')
^
Now let's identify the culprit, shall we?
Restoring package.json
Restoring package-lock.json
npm install
npm install --no-save react@16.0.0
npm run test
✓ react 15.0.0 → 16.0.0
npm install --no-save react-redux@7.0.0
npm run test
✗ react-redux 6.0.0 → 7.0.0
Saving partially upgraded package.json
Github URLs
Added support for GitHub URLs.
See: f0aa792a4
Example:
{
"dependencies": {
"chalk": "https://github.com/chalk/chalk#v2.0.0"
}
}
npm aliases
Added support for npm aliases.
See: 0f6f35c
Example:
{
"dependencies": {
"request": "npm:postman-request@2.88.1-postman.16"
}
}
Owner Changed
Usage: ncu --ownerChanged
Check if the npm user that published the package has changed between current and upgraded version.
Output values:
- Owner changed:
*owner changed*
- Owner has not changed: no output
- Owner information not available:
*unknown*
Example:
$ ncu --ownerChanged
Checking /tmp/package.json
[====================] 1/1 100%
mocha ^7.1.0 → ^8.1.3 *owner changed*
Run ncu -u to upgrade package.json