npm-bump icon indicating copy to clipboard operation
npm-bump copied to clipboard

A better rollback when something fails

Open mgol opened this issue 10 years ago • 4 comments

If anything throws in a process before we publish on npm, a full rollback should happen (including a push --force on a branch to the previous version?)

mgol avatar Dec 30 '14 15:12 mgol

screen shot 2016-03-09 at 11 59 52 am

Hey @mgol, it would definitely be nice to rollback when something fails.

agonbina avatar Mar 09 '16 11:03 agonbina

Hmm, it should be enough to wrap https://github.com/mgol/npm-bump/blob/e665175404c767d7fc986ccdfcc64690831b0c67/lib/cli.js#L86-L89 in try-catch and do the rollback on error. Wrapping more things would be problematic as it npm publish succeeded and next Git operations failed we can't revert the npm publish (we could unpublish but you can't then re-publish the same version).

Thoughts? Would you like to prepare a PR?

mgol avatar Mar 09 '16 11:03 mgol

Or maybe npm publish should be moved to be the last operation so that we always can fully rollback unless we finish all remote operations.

mgol avatar Mar 09 '16 12:03 mgol

@mgol I agree, npm publish should definitely be the last thing we do.

aj-dev avatar Jul 28 '16 09:07 aj-dev