git-semver-tags
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="1.3.5"></a> | ||
## [1.3.5](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@1.3.4...git-semver-tags@1.3.5) (2018-03-22) | ||
**Note:** Version bump only for package git-semver-tags | ||
<a name="1.3.4"></a> | ||
@@ -8,0 +16,0 @@ ## [1.3.4](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@1.3.3...git-semver-tags@1.3.4) (2018-02-24) |
18
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var meow = require('meow'); | ||
var gitSemverTags = require('./'); | ||
'use strict' | ||
var meow = require('meow') | ||
var gitSemverTags = require('./') | ||
@@ -13,11 +13,11 @@ var args = meow(` | ||
--tagPrefix prefix to remove from the tags during their processing` | ||
); | ||
) | ||
gitSemverTags(function(err, tags) { | ||
gitSemverTags(function (err, tags) { | ||
if (err) { | ||
console.error(err.toString()); | ||
process.exit(1); | ||
console.error(err.toString()) | ||
process.exit(1) | ||
} | ||
console.log(tags.join('\n')); | ||
console.log(tags.join('\n')) | ||
}, { | ||
@@ -27,2 +27,2 @@ lernaTags: args.flags.lerna, | ||
tagPrefix: args.flags.tagPrefix | ||
}); | ||
}) |
60
index.js
@@ -1,22 +0,22 @@ | ||
'use strict'; | ||
'use strict' | ||
var exec = require('child_process').exec; | ||
var semverValid = require('semver').valid; | ||
var regex = /tag:\s*(.+?)[,\)]/gi; | ||
var cmd = 'git log --decorate --no-color'; | ||
var exec = require('child_process').exec | ||
var semverValid = require('semver').valid | ||
var regex = /tag:\s*(.+?)[,)]/gi | ||
var cmd = 'git log --decorate --no-color' | ||
function lernaTag(tag, pkg) { | ||
function lernaTag (tag, pkg) { | ||
if (pkg && !(new RegExp('^' + pkg + '@')).test(tag)) { | ||
return false; | ||
return false | ||
} else { | ||
return /^.+@[0-9]+\.[0-9]+\.[0-9]+(-.+)?$/.test(tag); | ||
return /^.+@[0-9]+\.[0-9]+\.[0-9]+(-.+)?$/.test(tag) | ||
} | ||
} | ||
module.exports = function(callback, opts) { | ||
opts = opts || {}; | ||
module.exports = function (callback, opts) { | ||
opts = opts || {} | ||
if (opts.package && !opts.lernaTags) { | ||
callback(Error('opts.package should only be used when running in lerna mode')); | ||
return; | ||
callback(Error('opts.package should only be used when running in lerna mode')) | ||
return | ||
} | ||
@@ -26,34 +26,34 @@ | ||
maxBuffer: Infinity | ||
}, function(err, data) { | ||
}, function (err, data) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
callback(err) | ||
return | ||
} | ||
var tags = []; | ||
var tagPrefixRegexp; | ||
var tags = [] | ||
var tagPrefixRegexp | ||
if (opts.tagPrefix) { | ||
tagPrefixRegexp = new RegExp('^' + opts.tagPrefix + '(.*)'); | ||
tagPrefixRegexp = new RegExp('^' + opts.tagPrefix + '(.*)') | ||
} | ||
data.split('\n').forEach(function(decorations) { | ||
var match; | ||
while (match = regex.exec(decorations)) { | ||
var tag = match[1]; | ||
data.split('\n').forEach(function (decorations) { | ||
var match | ||
while ((match = regex.exec(decorations))) { | ||
var tag = match[1] | ||
if (opts.lernaTags) { | ||
if (lernaTag(tag, opts.package)) { | ||
tags.push(tag); | ||
tags.push(tag) | ||
} | ||
} else if (opts.tagPrefix) { | ||
var matches = tag.match(tagPrefixRegexp); | ||
var matches = tag.match(tagPrefixRegexp) | ||
if (matches && semverValid(matches[1])) { | ||
tags.push(tag); | ||
tags.push(tag) | ||
} | ||
} else if (semverValid(tag)) { | ||
tags.push(tag); | ||
tags.push(tag) | ||
} | ||
} | ||
}); | ||
}) | ||
callback(null, tags); | ||
}); | ||
}; | ||
callback(null, tags) | ||
}) | ||
} |
{ | ||
"name": "git-semver-tags", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Get all git semver tags of your repository in reverse chronological order", | ||
@@ -40,3 +40,3 @@ "bugs": { | ||
"scripts": { | ||
"lint": "jshint *.js --exclude node_modules && jscs *.js", | ||
"lint": "eslint --fix .", | ||
"test": "npm run-script lint && mocha --timeout 30000", | ||
@@ -43,0 +43,0 @@ "test-windows": "mocha --timeout 30000" |
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
7661