Skip to content

Commit

Permalink
fix(build): Cope with tags not conforming to semver format when build…
Browse files Browse the repository at this point in the history
…ing. (#6376)

If a developer had defined a git tag which did not conform to the semver format "vx.y.z", the build
process would take this tag and assume it to be the current version but fail when it does not. The
script now skips these tags. It might also make sense to warn about these tags, as the developer may
have had a typo. But this still enforces the pattern to only have tags in that format.

Before this fix, if such a tag had been defined the following error message appeared:
$ grunt
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: Cannot read property 'match' of null
  • Loading branch information
classix-as authored and mportuga committed Sep 1, 2017
1 parent 5ccd7f3 commit 1248e5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/grunt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ var util = module.exports = {

var v = semver.clean(tag);

if (!v.match(/-.+?$/)) {
if (v && !v.match(/-.+?$/)) {
return v;
}
}
Expand Down

0 comments on commit 1248e5a

Please sign in to comment.