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.0
1.2
→1.3
- Range operators are preserved, and the version is updated:
^1.2.0
→^2.0.0
1.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--pre
to include them.
The --target
Option
You can control the upgrade level using the --target
(or -t
) option.
-
--target minor
Strictly updates patch and minor versions, without bumping the major version.0.1.0
→0.2.1
-
--target patch
Strictly updates only the patch version.0.1.0
→0.1.2
-
--target semver
Updates 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 @next
upgrades0.1.0
to0.1.1-next.1
-
--target newest
Upgrades 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 greatest
Upgrades 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.