fix: match tag to tagFormat from the begining of the string

This commit is contained in:
Pierre Vanduynslager
2018-04-11 17:11:33 -04:00
parent a8a07b7d51
commit 31ad23125a
2 changed files with 15 additions and 1 deletions
+2 -1
View File
@@ -28,7 +28,8 @@ module.exports = async (tagFormat, logger) => {
// by replacing the `version` variable in the template by `(.+)`.
// The `tagFormat` is compiled with space as the `version` as it's an invalid tag character,
// so it's guaranteed to no be present in the `tagFormat`.
const tagRegexp = escapeRegExp(template(tagFormat)({version: ' '})).replace(' ', '(.+)');
const tagRegexp = `^${escapeRegExp(template(tagFormat)({version: ' '})).replace(' ', '(.+)')}`;
const tags = (await gitTags())
.map(tag => ({gitTag: tag, version: (tag.match(tagRegexp) || new Array(2))[1]}))
.filter(