If you are a yarn user, running yarn upgrade-interactive
is the one built-in command that makes your life super easy. But no, this article is meant for the hardcore npm users.
When using npm there is a built-in tool to check for dependencies updates too. npm outdated
shows you list of outdated packages.
npm outdated in action
But there is a better tool for that! Using npm-check-updates to check for updates and updating your package.json
is a no-brainer.
npm-check-updates is a command-line tool that allows you to upgrade your package.json or bower.json dependencies to the latest versions, regardless of existing version constraints.
npm install -g npm-check-updates
$ ncu
nuxt ^1.0.0 → ^2.2.0node-sass ^4.9.2 → ^4.9.4vue-scrollto ^2.11.0 → ^2.13.0
Run with -u to upgrade your package.json
Well, wasn't that easy? It shows which packages have updates and using the flag -u it automatically replaces the version in package.json.
Edited 19 Oct 2018 - Updated the article with new images and up to date information.