bump
bump copied to clipboard
Support atomic bumping
If an error occurs when bumping a version it can be incomplete, in such cases the result can be that the CHANGELOG.md
, package.json
, and package-lock.json
files are updated but no tags are added.
Here is an example of hook throwing an error relating to the Node.js version:
$ bump minor
Bumping the version...
Updating the changelog...
Making the commit...
{ Error: Command failed: git commit -a -m Bump version to 0.9.0
lint-staged requires at least version 12.13.0 of Node, please upgrade
husky - pre-commit hook exited with code 1 (error)
at makeError (/Users/dave/.asdf/installs/nodejs/10.18.0/.npm/lib/node_modules/@fabiospampinato/bump/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/Users/dave/.asdf/installs/nodejs/10.18.0/.npm/lib/node_modules/@fabiospampinato/bump/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: 1,
stdout: '',
stderr:
'lint-staged requires at least version 12.13.0 of Node, please upgrade\nhusky - pre-commit hook exited with code 1 (error)\n',
failed: true,
signal: null,
cmd: 'git commit -a -m Bump version to 0.9.0',
timedOut: false,
killed: false }
[commit] An error occurred while making the commit
Atomic bumping is not really possible, in the sense that it can't be implemented in a way that no matter what you never see an half-done state, but trying to revert changes if a future step fails seems worthwhile.