Understanding Version Targets
npm-check-updates intelligently determines which version to upgrade to based on your current package.json and the options you provide.
How Updates Are Determined
- Direct dependencies are updated to the latest stable version:
2.0.1→2.2.01.2→1.3
- Range operators are preserved, and the version is updated:
^1.2.0→^2.0.01.x→2.x
- "Less than" ranges are replaced with a wildcard:
<2.0.0→^3.0.0
- "Any version" (
*) is preserved. - Prerelease versions (
-alpha,-beta, etc.) are ignored by default. Use--preto include them.
The --target Option
You can control the upgrade level using the --target (or -t) option.
-
--target minorStrictly updates patch and minor versions, without bumping the major version.0.1.0→0.2.1
-
--target patchStrictly updates only the patch version.0.1.0→0.1.2
-
--target semverUpdates to the highest version that still satisfies the existing semantic versioning range in yourpackage.json.^1.1.0→^1.9.99(hypothetically)
-
--target @[tag]Updates to the version published on a specific npm distribution tag.--target @nextupgrades0.1.0to0.1.1-next.1
-
--target newestUpgrades to the version with the most recent publish date, even if its version number is lower than another available version. Includes prereleases by default. -
--target greatestUpgrades to the highest version number published, regardless of release date or tag. Includes prereleases by default.
For more details, see the CLI reference for --target.