bump-regex
bump-regex copied to clipboard
Cannot bump a prerelease identifier containing a dot when preid is specified
Given a version with a prerelease identifier containing a dot, such as 1.0.0-foo.bar.0
, if bump()
is called with preid
specified, the version is unchanged:
const bump = require("bump-regex");
const bumpOpts = {
str: 'version: "1.0.0-foo.bar.0"',
type: "prerelease",
preid: "foo.bar"
};
bump(bumpOpts, (err, out) => console.log(out));
Output:
{ key: 'version',
type: 'prerelease',
case: false,
keys: null,
str: 'version: "1.0.0-foo.bar.0"',
preid: 'foo.bar',
prev: '1.0.0-foo.bar.0',
new: '1.0.0-foo.bar.0' }
Notice that out.prev === out.new
.
I've found that if I omit the preid
option, it is bumped correctly:
const bump = require("bump-regex");
const bumpOpts = {
str: 'version: "1.0.0-foo.bar.0"',
type: "prerelease"
};
bump(bumpOpts, (err, out) => console.log(out));
Output:
{ key: 'version',
type: 'prerelease',
case: false,
keys: null,
str: 'version: "1.0.0-foo.bar.1"',
prev: '1.0.0-foo.bar.0',
new: '1.0.0-foo.bar.1' }
I would expect that specifying preid
would not cause the bump to fail.
Seems to be an issue with semver, I opened an issue to confirm