articleswikiproducts
RSS feed
contact
articleswikiproducts
RSS feed
contact
articleswiki
products

Made by nerdfish, development with user experience in mind.

Github
All wiki

Safely update your packages

21 March 2022

Updating packages is essential to get the latest features and reduce security issues. npm-check-updates is an npm package that makes the process of updating packages easier. Here's my flow of how I update packages.

Install npm-check-updates

If you don't want to install the package globally, you can run it with npx.

What does it do?

When you run the command below, you will get an overview of all packages that have updates available.

Safely updating packages

We will be updating packages in turns. First, we update the least impactful, followed by minor versions and last but not least, the packages that have breaking changes.Before moving to the next step, we run npm i, checking if something breaks.

Patches

Monorepo

Minor versions

Monorepo

Major versions

A change in major versions usually indicates that there are breaking changes. So look up the package and go and check the release notes. Once you do, you have two options. You could update all the major versions with npx ncu -u -t major, but it's better to update them one by one.

The param -f or --filter lets you filter the packages you want to update. After that, you can proceed to the next major package that needs an update.

npm install -g npm-check-updates
npx npm-check-updates
npx npm-check-updates -u -t patch
npx npm-check-updates -u -t patch --deep
npx npm-check-updates -u -t minor
npx npm-check-updates -u -t minor --deep
npx npm-check-updates -u -f eslint