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
- Red = major upgrade (and all major version zero)
- Cyan = minor upgrade
- Green = patch upgrade
Installation
Install globally:
- ```sh
- npm install -g npm-check-updates
- ```
Or run with npx:
- ```sh
- npx npm-check-updates
- ```
Usage
Check the latest versions of all project dependencies:
- ```sh
- $ ncu
- Checking package.json
- [====================] 5/5 100%
- eslint 7.32.0 → 8.0.0
- prettier ^2.7.1 → ^3.0.0
- svelte ^3.48.0 → ^3.51.0
- typescript >3.0.0 → >4.0.0
- untildify <4.0.0 → ^4.0.0
- webpack 4.x → 5.x
- Run ncu -u to upgrade package.json
- ```
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.
- ```sh
- $ ncu -u
- Upgrading package.json
- [====================] 1/1 100%
- express 4.12.x → 4.13.x
- Run npm install to install new versions.
- $ npm install # update installed packages and package-lock.json
- ```
Check global packages:
- ```sh
- ncu -g
- ```
Interactive Mode
Choose which packages to update in interactive mode:
- ```sh
- ncu --interactive
- ncu -i
- ```
Combine with --format group for a truly _luxe_ experience:
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:
- ```sh
- # upgrade only mocha
- ncu mocha
- ncu -f mocha
- ncu --filter mocha
- # upgrade packages that start with "react-"
- ncu react-*
- ncu "/^react-.*$/"
- # upgrade everything except nodemon
- ncu \!nodemon
- ncu -x nodemon
- ncu --reject nodemon
- # upgrade only chalk, mocha, and react
- ncu chalk mocha react
- ncu chalk, mocha, react
- ncu -f "chalk mocha react"
- # upgrade packages that do not start with "react-".
- ncu \!react-*
- ncu '/^(?!react-).*$/' # mac/linux
- ncu "/^(?!react-).*$/" # windows
- ```