Automate updates for NodeJS packages with next-update
Prerequisites
- Solid unit tests for your code, E2E tests.
next-update
: An npm package which tests whether your dependencies can be updated without breaking the tests.- It will find all new packages
- It updates the packages in sequence
- It keep the update if your tests pass
How to
On CLI
Install it globally.
1
npm install -g next-update
Run it.
1
next-update
On project
Install next update
1
npm install next-update --save-dev
Configure the script on
package json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15{
"name": "a-sample-node-project",
"version": "0.0.1",
"description": "A sample node project",
"scripts": {
"test": "karma start",
"start": "node app.js",
"dep:update": "next-update" // Configure an npm script
},
"devDependencies": {
"next-update": "^3.6.0"
},
"dependencies": {
},
}Run the script
1
npm run dep:update