Updating NPM Dependencies using `npm-check-updates`

I wanted to share my method of updating npm dependencies in a Vaadin/Hilla-Application.

Add the following code as a file called .ncurc.js into the root of your repository

When you run npx npm-check-updates you will be presented with a list of updates, split into 3 categories (patch, minor, major) and you’re able to choose what to update.

After that I usually restart the application so the vaadin.hash is recalculated in the package.json (then commit & push).

module.exports = {
	/**
	 * Run this command to update the dependencies:
	 * $ npx npm-check-updates
	 * */
	upgrade: true,
	format: "group",
	interactive: true,

	filter: (name) => {
		// get the vaadin.dependencies and vaadin.devDependencies from the package.json
		const { vaadin } = require("./package.json");
		const vaadinControlledDependencies = {
			...vaadin.dependencies,
			...vaadin.devDependencies,
		};

		// do not update dependencies that vaadin controls
		return !Object.keys(vaadinControlledDependencies).includes(name);
	},
};
1 Like

Nice :) Thanks for sharing!