conventional-github-releaser
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -38,7 +38,6 @@ { | ||
}, | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"dependencies": { | ||
"conventional-changelog": "^1.1.0", | ||
"dateformat": "^1.0.11", | ||
"find-versions": "^2.0.0", | ||
"git-semver-tags": "^1.0.0", | ||
@@ -51,2 +50,3 @@ "github": "^0.2.4", | ||
"semver": "^5.0.1", | ||
"semver-regex": "^1.0.0", | ||
"through2": "^2.0.0" | ||
@@ -53,0 +53,0 @@ }, |
'use strict'; | ||
var dateFormat = require('dateformat'); | ||
var findVersions = require('find-versions'); | ||
var semverRegex = require('semver-regex'); | ||
function transform(chunk, cb) { | ||
if (typeof chunk.gitTags === 'string') { | ||
chunk.version = findVersions(chunk.gitTags)[0]; | ||
chunk.version = (chunk.gitTags.match(semverRegex()) || [])[0]; | ||
} | ||
@@ -10,0 +10,0 @@ |
@@ -10,2 +10,20 @@ 'use strict'; | ||
/* | ||
The contents of `gitTags` is generated by the `git-raw-commits` package, which runs the following command: | ||
git log --format=%B%n-hash-%n%H%n-gitTags-%n%d%n-committerDate-%n%ci | ||
That command returns a list of log entries with output in the following form per commit: | ||
-hash- | ||
e26c9a71a638ef9d4e12c2512fcdf813399559a1 | ||
-gitTags- | ||
(tag: 1.1.8) | ||
-committerDate- | ||
2017-05-29 13:42:41 -0500 | ||
1.1.8 | ||
The value of `gitTags` is the line between `-gitTags-` and `-committerDate-`. | ||
*/ | ||
describe('transform', function() { | ||
@@ -35,3 +53,3 @@ beforeEach(function() { | ||
it('should not match invalid semantic version tag', function(done) { | ||
this.chunk.gitTags = ' tag: release-18'; | ||
this.chunk.gitTags = ' (tag: release-18)'; | ||
@@ -45,3 +63,3 @@ transform(this.chunk, function(err, chunk) { | ||
it('should match valid semantic version tag', function(done) { | ||
this.chunk.gitTags = ' tag: release-18, tag: 1.1.20'; | ||
this.chunk.gitTags = ' (tag: 1.1.20)'; | ||
@@ -53,2 +71,29 @@ transform(this.chunk, function(err, chunk) { | ||
}); | ||
it('should match valid semantic version tag containing a leading `v`', function(done) { | ||
this.chunk.gitTags = ' (tag: v1.1.20)'; | ||
transform(this.chunk, function(err, chunk) { | ||
expect(chunk.version).to.equal('v1.1.20'); | ||
done(); | ||
}); | ||
}); | ||
it('should find valid semantic version tag out of many tags', function(done) { | ||
this.chunk.gitTags = ' (HEAD -> master, tag: something, tag: 1.1.20, origin/master, origin/HEAD)'; | ||
transform(this.chunk, function(err, chunk) { | ||
expect(chunk.version).to.equal('1.1.20'); | ||
done(); | ||
}); | ||
}); | ||
it('should match first semantic version tag when there are multiple valid tags', function(done) { | ||
this.chunk.gitTags = ' (tag: 1.1.19, tag: 1.1.20)'; | ||
transform(this.chunk, function(err, chunk) { | ||
expect(chunk.version).to.equal('1.1.19'); | ||
done(); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18908
296
+ Addedsemver-regex@^1.0.0
- Removedfind-versions@^2.0.0
- Removedarray-uniq@1.0.3(transitive)
- Removedfind-versions@2.0.0(transitive)