This is utility tool for updating npm modules safety.
Updating npm modules is important but it is hard to confirm this update won't break application even if we have unit test and E2E test.
This will execute test commands on each update then if it fails, this will rollback package.json and lockfile.
This makes your updating npm module more safety.
Usage
$ safety-update ['major'|'minor'|'patch'|'all']
Options
--config, Config file path
--only-prod, Update Only dependency
--only-dev, Update Only devDependency
--break, -B, Update include breaking changes
--force, Skip test command on update
--manager <'npm'|'yarn'>, Detect your module manager.
Examples
$ safety-update minor patch --only-dev
for more infomation: https://github.com/pastak/npm-safety-updater
echo '{}' > safety-update.config.json
on Project root.npx npm-safety-updater patch --only-dev
Don't use it via project's node_modules , use via npx or global install because this command remove project's node_modules directory to refresh dependency (also npm ci
includes removing node_modules).
{
"packageFilePath": "path/to/package.json",
"prepare": ["npm run build"],
"testCommand": ["echo 'no test'", "exit 1"],
"afterTest": "echo 'after test'",
"onlyFailed": "echo 'test failed'",
"onlySuccess": "echo 'test success'"
}
packageFilePath: string
: Specifypackage.json
pathprepare: string | string[]
: commands execused before updating a moduletestCommand: string | string[]
: commands for test after updating a moduleafterTest: string | string[]
: commands execused after test commandsonlyFailed: string | string[]
: commands execused when fails test commandsonlySuccess: string | string[]
: commands execused when success test commands
%PACKAGE_NAME%
%CURRENT_VERSION%
%GOTO_VERSION%
%DEPS_TYPE%
- test