Projects are always growing and evolving as new items are added, and keeping that `package.json` file under control has several parts to it.

One of those parts is making sure that you are running the latest versions of all those packages. While some of those updates are small, minor updates, large updates can be included in them.

Now, while each update itself will be down to you to decide if you need to make further updates to your code as you update them, the first part is finding out which packages need updating and by how much.

This is where npm-check-update will come in handy to give you that information.

Installation

First, you'll need to install the package, and it's probably best to install it globally to run it for any Repository you have. So open up a terminal and run the following command to install.

Running a check

Now, navigate to a directory that has a `package.json` file and run the below command to run a package check. It'll spit out every package that needs updating with an indication of the difference between your current version and the latest available version.

If you haven't run the installation above, this next command will detect that anyway and prompt you to install it.

npm-update-check run on a repository

As you can see, there are a few packages marked with light blue that have minor updates, and the ones marked in red are major updates.

Running in groups

You can also run these in groups, which might help with larger projects to see which smaller wins can be gained early on, and which items will need more investigation before updating.

You can run the group format with the following command

You'll end up with them coloured the same but patch versions first, minor versions and then major versions.

npm-update-check

Update the packages

One way to update them is to do this yourself by installing the packages individually.

But if you want to do this in bulk, and use `npm-check-update` you can just add `-u` to either of the previous two commands to update the `package.json` file and install the newer versions.

Warning: Don't update the Major versions unless you are sure about introducing possible breaking changes.

Other options

While the above options will probably be all you really need, it does come with some cool other features

Filter the list

You can filter by packages. That means if you have a collection of `react` packages for example, you can filter by that.

Terminal view of npm-update-check with filter option

Mark which packages to update

This mode allows you to check all available updates and then mark which ones you'd like to batch update. You run the command and then go through the results toggling on or off each package.

Conclusion

This is a great little tool and probably covers everything you need. It allowed me to quickly view which packages were out of date and which needed updating. It is also helpful with the colour-coded list to be able to see some quick wins and get a wide-angle view of the work that might need to be done.

Other packages

npm-check was another package that I was looking at but didn't have as many downloads. It is one the I might review because it had some nice features like being able to tell if it was still used or not, so pointing out if you could remove it as well as updating it. It also provided links to each package so you could quickly refresh your memory on what its use is.