node-semver icon indicating copy to clipboard operation
node-semver copied to clipboard

CLI accepts invalid increment specifiers with -i/--increment and treats them as 'patch'

Open mklement0 opened this issue 11 years ago • 3 comments

E.g.:

semver -i nonesuch 1.0.0

outputs 1.0.1 and sets exit code to 0; i.e., it acts as if patch (or no argument) had been specified.

mklement0 avatar Oct 23 '14 06:10 mklement0

This is working by design. The default value of -i is patch and invalid versions are filtered out of the input.

lukekarrys avatar Apr 10 '22 06:04 lukekarrys

Quietly accepting invalid input is problematic.

Another way of putting it: if this is by design, please reconsider the design.

Consider reporting an error if an invalid -i argument is specified.

mklement0 avatar Apr 28 '22 01:04 mklement0

@mklement0 Thanks for the feedback. I closed this issue as a first pass through this repo, so maybe "by design" was the wrong choice of words. The code makes it clear that any invalid values passed to -i are ignored but I agree that erroring is a good idea.

For this project I believe in a very cautious approach to versioning, so I think this would be a breaking change so I'm going to tag it as such. I don't have any immediate plans to release a major version but surfacing this as a breaking change will help to batch this in when it's time.

lukekarrys avatar Jun 09 '22 16:06 lukekarrys