Updating Node.js Dependencies with dependency-time-machine
Updating Node.js Dependencies with dependency-time-machine
Updating dependencies is critical for security, performance, and compatibility — but doing it manually can break your project. The dependency-time-machine tool solves this by updating packages one at a time in chronological order, letting you detect breaking changes early and keep your project stable.
This guide walks you through installation, automatic updates, test automation, exclusions, and advanced usage.
1. Install dependency-time-machine
You can run the tool without installing anything using npx:
npx dependency-time-machine --update --installOr install it globally:
npm install -g dependency-time-machineOnce installed, the CLI becomes available as dependency-time-machine.
2. Run an Update Cycle
To begin updating dependencies safely, run:
npx dependency-time-machine --update --installWhat this does:
- scans your package.json
- detects outdated dependencies
- updates them sequentially, not all at once
- installs after each bump
- stops if a new version breaks your project
This step-by-step approach is much safer than npm update or npm-check-updates.
3. Automate Tests During Updates
Enable auto-testing:
npx dependency-time-machine --update --install --autoBy default, it runs:
npm testYou can customize both install and test commands:
npx dependency-time-machine --update --install --auto --install-script "yarn install" --test-script "yarn test"4. Exclude Specific Dependencies
npx dependency-time-machine --update --install --exclude react,react-dom5. Advanced Usage
Exclude via file
Create a file:
react
typescript
webpackThen:
npx dependency-time-machine --update --install --exclude-file skip.txtGenerate timeline
npx dependency-time-machine --timelineDry run
npx dependency-time-machine --update --dry6. Combine with Other Tools
Fast bulk updating:
Update NPM Dependencies
Conclusion
dependency-time-machine provides one of the safest ways to modernize dependencies. With sequential updates, automated tests, and advanced controls, it helps maintain stability in every Node.js project.