git-semver-tags
Advanced tools
Comparing version 1.1.2 to 1.2.0-alpha.1
17
cli.js
@@ -6,9 +6,19 @@ #!/usr/bin/env node | ||
meow({ | ||
var args = meow({ | ||
help: [ | ||
'Usage', | ||
' git-semver-tags' | ||
' git-semver-tags', | ||
'Options', | ||
' --lerna, -l parse lerna style git tags', | ||
' --package, -p when listing lerna style tags, filter by a package' | ||
] | ||
}); | ||
// the package argument only makes sense | ||
// when used in the context of lerna-style git-tags. | ||
if (args.flags.package && !args.flags.lerna) { | ||
console.error('--package should only be used when running in --lerna mode'); | ||
process.exit(1); | ||
} | ||
gitSemverTags(function(err, tags) { | ||
@@ -21,2 +31,5 @@ if (err) { | ||
console.log(tags.join('\n')); | ||
}, { | ||
lernaTags: args.flags.lerna, | ||
package: args.flags.package | ||
}); |
18
index.js
@@ -7,3 +7,13 @@ 'use strict'; | ||
module.exports = function(callback) { | ||
function lernaTag(tag, pkg) { | ||
if (pkg && !(new RegExp('^' + pkg + '@')).test(tag)) { | ||
return false; | ||
} else { | ||
return /^.+@[0-9]+\.[0-9]\.[0-9](-.+)?$/.test(tag); | ||
} | ||
} | ||
module.exports = function(callback, opts) { | ||
opts = opts || {}; | ||
exec(cmd, { | ||
@@ -23,3 +33,7 @@ maxBuffer: Infinity | ||
var tag = match[1]; | ||
if (semverValid(tag)) { | ||
if (opts.lernaTags) { | ||
if (lernaTag(tag, opts.package)) { | ||
tags.push(tag); | ||
} | ||
} else if (semverValid(tag)) { | ||
tags.push(tag); | ||
@@ -26,0 +40,0 @@ } |
{ | ||
"name": "git-semver-tags", | ||
"version": "1.1.2", | ||
"version": "1.2.0-alpha.1", | ||
"description": "Get all git semver tags of your repository in reverse chronological order", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/stevemao/git-semver-tags", |
@@ -18,3 +18,3 @@ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
```js | ||
var gitSemverTags = require('git-semver-tags'); | ||
var gitSemverTags = require('git-semver-tags', [options]); | ||
@@ -34,3 +34,9 @@ gitSemverTags(function(err, tag) { | ||
## Options | ||
* `opts.lernaTags`: extract lerna style tags (`foo-package@2.0.0`) from the | ||
git history, rather than `v1.0.0` format. | ||
* `opts.package`: what package should lerna style tags be listed for, e.g., | ||
`foo-package`. | ||
## License | ||
@@ -43,4 +49,4 @@ | ||
[npm-url]: https://npmjs.org/package/git-semver-tags | ||
[travis-image]: https://travis-ci.org/stevemao/git-semver-tags.svg?branch=master | ||
[travis-url]: https://travis-ci.org/stevemao/git-semver-tags | ||
[travis-image]: https://travis-ci.org/conventional-changelog/git-semver-tags.svg?branch=master | ||
[travis-url]: https://travis-ci.org/conventional-changelog/git-semver-tags | ||
[daviddm-image]: https://david-dm.org/stevemao/git-semver-tags.svg?theme=shields.io | ||
@@ -47,0 +53,0 @@ [daviddm-url]: https://david-dm.org/stevemao/git-semver-tags |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
4430
67
53
1
2