DEV Community

Cover image for Npm Check and Update/Delete Package If Needed
akgondber
akgondber

Posted on

Npm Check and Update/Delete Package If Needed

As for dealing with sticking up to date dependencies in our projects one approach is npm outdated command, that will display a list of installed packages with their current version and the latest available version.

Image description

In order to update your dependencies listed in package.json one can use npm update command.

In this post I want you introduce much more powerful tool called npm-check-extras - CLI app to check for outdated and unused dependencies, and run update/delete action over selected ones.
In order to use it you can install it globally using

$ npm install -g npm-check-extras
Enter fullscreen mode Exit fullscreen mode

or execute it by using npx:

npx npm-check-extras
Enter fullscreen mode Exit fullscreen mode

and then you will have a UI to interactively update/delete packages with plenty of additional options. Main feature of course is update/delete packages with possibilities to toggle target packages desired to be actioned about. You can select packages by specifying a filter query.

As you can see there are many options you can use: targeting only development dependencies, looking at global packages, etc. One option you could find handy is storing a history of actions and viewing it so you can monitor and analyze what packages were updated/deleted while working on a project.

Top comments (0)