Socket
Socket
Sign inDemoInstall

git-semver-tags

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-semver-tags - npm Package Compare versions

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
});

@@ -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 @@ }

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc