I ran into an interesting bug when trying to bump a version using a key that contains one or mode - (dashes).
Code
var bump = require('bump-regex');
const name = 'latest-release';
bump({ key: 'latest-release', str: 'latest-release:1.6.0' }, function(err, out) {
console.log(err, out);
});
Output
var regex = opts.regex || new RegExp(
^
SyntaxError: Invalid regular expression: /([<|'|"]?latest-release[>|'|"]?[ ]*[:=]?[ ]*['|"]?[a-z]?)(\d+\.\d+\.\d+)(-[0-9A-Za-z.-]+)?(['|"|<latest-release>]?)/: Range out of order in character class
It treats the -(dash) within the last key as a range (['|"|<latest-release>]?), and t-r is not a valid range.
I ran into an interesting bug when trying to bump a version using a key that contains one or mode
-
(dashes).Code
Output
It treats the
-
(dash) within the last key as a range(['|"|<latest-release>]?)
, andt-r
is not a valid range.The sample code stopped working when versioning xml content was added in v2.6.0