Interactively Update NPM Dependencies

  • dependencies
  • format
  • ncu
  • npm
Sep 12, 2022
Keeping up with your project's dependencies can be difficult and time consuming. Here's the best way I've found to keep up with them.

Update your dependencies

Keeping up with a project’s dependencies can be difficult and time consuming. After trying a variety of methods, here’s the best way I’ve found to manage npm dependencies with npm-check-updates.

Script

Add this script to your package.json, you can name it whatever you prefer, I name mine deps. Alternatively, you can run the script in the command line directly.

{
	"scripts": {
		"deps": "npx npm-check-updates@latest --interactive --format group"
	}
}

By specifying @latest you can ensure that you are always using the latest version of the npm-check-updates package. By using npx instead of installing the package as a dependency, it saves time if other people are contributing to your project. They will not need to install the npm-check-updates when they run npm install to start their dev environment.

Update project

Run this command from the workspace folder to run the command and start the interactive process.

npm run deps

Process

  • Update all patch/minor updates, test
  • Update each major update independently, test

References


Edit