How to Update a NodeJs Project with dependency-time-machine

To update a project using dependency-time-machine, you can follow a straightforward process that automates the task of updating dependencies in your package.json file in chronological order.

Step 1:Install the Tool

You can use the following command to install dependency-time-machine globally or run it via npx:

npx dependency-time-machine —update —install

Alternatively, install it globally using npm:

npm install -g dependency-time-machine

Step 2: Update Dependencies

Once installed, you can run the tool to start updating your dependencies:

npx dependency-time-machine —update —install

This command will check for the latest compatible versions of your dependencies and update them one by one, ensuring each version is compatible before proceeding to the next.

Step 3: Auto-run Tests

To automate testing after each update (using npm test by default), you can add the --auto flag:

npx dependency-time-machine —update —install —auto

You can also customize the install and test commands:

npx dependency-time-machine —update —install —auto —install-script “yarn install” —test-script “yarn test”

Step 4: Excluding Dependencies

If there are specific dependencies you want to exclude from the update process, use the --exclude flag:

npx dependency-time-machine —update —install —exclude react,react-dom

Read also how to update all dependencies using npm-check-updates.

For more advanced options, such as excluding dependencies via a file or generating a timeline of updates, refer to the detailed documentation on npm.