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.12.2.0
    • 1.21.3
  • Range operators are preserved, and the version is updated:
    • ^1.2.0^2.0.0
    • 1.x2.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.00.2.1
  • --target patch Strictly updates only the patch version.

    • 0.1.00.1.2
  • --target semver Updates to the highest version that still satisfies the existing semantic versioning range in your package.json.

    • ^1.1.0^1.9.99 (hypothetically)
  • --target @[tag] Updates to the version published on a specific npm distribution tag.

    • --target @next upgrades 0.1.0 to 0.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.