It might be a »no-brainer« in case you are working within the Node.js environment for a while. But I used to ask myself how to figure out if there are updates to my dependencies / devDependencies which are beyond the patch-level updates which are »automatically« installed via the definition within my `package.json`. Because I don’t like to check possible updates separately for every module I’m using in my project.
Fortunately there is a node module which can handle that for all dependencies within your project and even all your globale modules. It’s called npm-check-updates and will also update your
package.json file if you like to. So updating becomes »fun« again
Using this is pretty straight forward. First you need to install the package globally with:
npm install -g npm-check-updates
Then use the modules cli without any option to check available updates within your projects root directory:
This will show you all possible updates without changing anything:
"superb" can be updated from ^1.0.5 to ^1.1.1 (Installed: 1.0.5, Latest: 1.1.1) "mocha" can be updated from ^2.0.1 to ^2.1.0 (Installed: 2.0.1, Latest: 2.1.0) "should" can be updated from ^4.4.2 to ^4.6.1 (Installed: 4.4.2, Latest: 4.6.1) Run 'npm-check-updates -u' to upgrade your package.json automatically
If you like to upgrade your projects
package.json file just make use of the
-u option as mentioned in the output above and fire:
afterwards. And … all updates will land on your machine and you’re done.
See the README for more options.
- Cheat Sheet: Docker CLI
- Data mocking – Ways to fake a backend (API)
- Switch Node.js versions with the Node Version Manager (nvm)