This Node.js script automates the process of updating your project's dependencies while also running tests to ensure that each update doesn't break your code.
Generated with the help of ChatGPT by OpenAI.
- Checks for outdated npm packages in your project.
- Sorts the packages by update type (patch, minor, major).
- Updates each package one by one.
- Runs your test suite after each update.
- If a test fails, reverts the package to its previous version and continues with the next package.
-
Place the
updateAndTestDependencies.js
script in your project folder. -
Make sure you have
yarn
andNode.js
installed. -
Run the script with:
node updateAndTestDependencies.js
-
Optionally, you can customize the test command by modifying the
TEST_COMMAND
constant in the script.
Enjoy automated, worry-free dependency updates!