npm-check-updates

Find newer versions of package dependencies than what your package.json all...

README

npm-check-updates


npm-check-updates upgrades your package.json dependencies to the _latest_ versions, ignoring specified versions.

- maintains existing semantic versioning _policies_, i.e. "react": "^16.0.4" to "react": "^18.2.0".
- _only_ modifies package.json file. Run npm install to update your installed packages and package-lock.json.
- sensible defaults, but highly customizable
- CLI and module usage
- compatible with: npm, yarn, pnpm, deno, bun

npm-check-updates-screenshot

- Red = major upgrade (and all major version zero)
- Cyan = minor upgrade
- Green = patch upgrade

Installation


Install globally:

  1. ```sh
  2. npm install -g npm-check-updates
  3. ```

Or run with npx:

  1. ```sh
  2. npx npm-check-updates
  3. ```

Usage


Check the latest versions of all project dependencies:

  1. ```sh
  2. $ ncu
  3. Checking package.json
  4. [====================] 5/5 100%

  5. eslint             7.32.0      8.0.0
  6. prettier           ^2.7.1     ^3.0.0
  7. svelte            ^3.48.0    ^3.51.0
  8. typescript         >3.0.0     >4.0.0
  9. untildify          <4.0.0     ^4.0.0
  10. webpack               4.x        5.x

  11. Run ncu -u to upgrade package.json
  12. ```

Upgrade a project's package file:

Make sure your package file is in version control and all changes have been committed. This _will_ overwrite your package file.


  1. ```sh
  2. $ ncu -u
  3. Upgrading package.json
  4. [====================] 1/1 100%

  5. express           4.12.x     4.13.x

  6. Run npm install to install new versions.

  7. $ npm install      # update installed packages and package-lock.json
  8. ```

Check global packages:

  1. ```sh
  2. ncu -g
  3. ```

Interactive Mode


Choose which packages to update in interactive mode:

  1. ```sh
  2. ncu --interactive
  3. ncu -i
  4. ```

ncu --interactive

Combine with --format group for a truly _luxe_ experience:

ncu --interactive --format group

Filter packages


Filter packages using the --filter option or adding additional cli arguments. You can exclude specific packages with the --reject option or prefixing a filter with !. Supports strings, wildcards, globs, comma-or-space-delimited lists, and regular expressions:

  1. ```sh
  2. # upgrade only mocha
  3. ncu mocha
  4. ncu -f mocha
  5. ncu --filter mocha

  6. # upgrade packages that start with "react-"
  7. ncu react-*
  8. ncu "/^react-.*$/"

  9. # upgrade everything except nodemon
  10. ncu \!nodemon
  11. ncu -x nodemon
  12. ncu --reject nodemon

  13. # upgrade only chalk, mocha, and react
  14. ncu chalk mocha react
  15. ncu chalk, mocha, react
  16. ncu -f "chalk mocha react"

  17. # upgrade packages that do not start with "react-".
  18. ncu \!react-*
  19. ncu '/^(?!react-).*$/' # mac/linux
  20. ncu "/^(?!react-).*$/" # windows
  21. ```