Skip to content

Instantly share code, notes, and snippets.

@rpivo
Last active June 12, 2021 14:20
Show Gist options
  • Save rpivo/1799121927bded232b7e63727f09e6cc to your computer and use it in GitHub Desktop.
Save rpivo/1799121927bded232b7e63727f09e6cc to your computer and use it in GitHub Desktop.
Adding an NPM Script That Updates All Packages at Once

Adding an NPM Script That Updates All Packages at Once

Edit: I no longer use npm-update. I instead just run npm outdated to see what needs updating. I'm also not a fan of updating more than one package at once, so npm outdated works fine for me.


There is an awesome NPM package called npm-check-updates that will update all the packages in your project at once, requiring you to only run npm install after running it.

In most productionalized codebases, it's probably dangerous to update all package dependencies at once, but this nonetheless can be useful, especially in the early stages of building a greenfield codebase.

You can add an update script like this that uses npx to run npm-check-updates.

"update": "npx npm-check-updates -u"

And then, of course, you can call the script in the terminal:

npm run update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment