git-semver-tags 3.0.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/cli.js +21 -5
  3. package/index.js +18 -11
  4. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,56 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.1.1](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@4.1.0...git-semver-tags@4.1.1) (2020-11-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bug in unstableTagTest causing a mismatch on beta release higher then beta-9 ([#679](https://github.com/conventional-changelog/conventional-changelog/issues/679)) ([cd4c726](https://github.com/conventional-changelog/conventional-changelog/commit/cd4c726b1ca227a132ec2eadac5d0cfdd75d9e81))
12
+
13
+
14
+
15
+
16
+
17
+ # [4.1.0](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@4.0.0...git-semver-tags@4.1.0) (2020-08-12)
18
+
19
+
20
+ ### Features
21
+
22
+ * add support for '--skip-unstable' option ([#656](https://github.com/conventional-changelog/conventional-changelog/issues/656)) ([#656](https://github.com/conventional-changelog/conventional-changelog/issues/656)) ([0679d7a](https://github.com/conventional-changelog/conventional-changelog/commit/0679d7a1d7a8715918326f31ec3f6168c2341fd6))
23
+
24
+
25
+
26
+
27
+
28
+ # [4.0.0](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@3.0.1...git-semver-tags@4.0.0) (2020-05-08)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **deps:** update yargs-parser to move off a flagged-vulnerable version. ([#635](https://github.com/conventional-changelog/conventional-changelog/issues/635)) ([aafc0f0](https://github.com/conventional-changelog/conventional-changelog/commit/aafc0f00412c3e4b23b8418300e5a570a48fe24d))
34
+ * **git-semver-tags:** change --tagPrefix flag to --tag-prefix ([#566](https://github.com/conventional-changelog/conventional-changelog/issues/566)) ([490cda6](https://github.com/conventional-changelog/conventional-changelog/commit/490cda6cff74abe63617f982765b63aebdf3b4b6)), closes [#553](https://github.com/conventional-changelog/conventional-changelog/issues/553)
35
+
36
+
37
+ ### BREAKING CHANGES
38
+
39
+ * **git-semver-tags:** --tagPrefix flag was changed to --tag-prefix
40
+
41
+
42
+
43
+
44
+
45
+ ## [3.0.1](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@3.0.0...git-semver-tags@3.0.1) (2019-11-14)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * add types for cli flags ([#551](https://github.com/conventional-changelog/conventional-changelog/issues/551)) ([bf1d64a](https://github.com/conventional-changelog/conventional-changelog/commit/bf1d64aeaf8f262d4b2beec02d2aebb78df7343b))
51
+
52
+
53
+
54
+
55
+
6
56
  # [3.0.0](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@2.0.3...git-semver-tags@3.0.0) (2019-07-29)
7
57
 
8
58
 
package/cli.js CHANGED
@@ -1,17 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict'
3
- var meow = require('meow')
4
- var gitSemverTags = require('./')
3
+ const meow = require('meow')
4
+ const gitSemverTags = require('./')
5
5
 
6
- var args = meow(`
6
+ const args = meow(`
7
7
  Usage
8
8
  git-semver-tags
9
9
  Options
10
10
  --cwd path to git repository to be searched
11
11
  --lerna parse lerna style git tags
12
12
  --package <name> when listing lerna style tags, filter by a package
13
- --tagPrefix <prefix> prefix to remove from the tags during their processing`
14
- )
13
+ --tag-prefix <prefix> prefix to remove from the tags during their processing`,
14
+ {
15
+ booleanDefault: undefined,
16
+ flags: {
17
+ cwd: {
18
+ type: 'string'
19
+ },
20
+ lerna: {
21
+ type: 'boolean'
22
+ },
23
+ package: {
24
+ type: 'string'
25
+ },
26
+ tagPrefix: {
27
+ type: 'string'
28
+ }
29
+ }
30
+ })
15
31
 
16
32
  gitSemverTags({
17
33
  lernaTags: args.flags.lerna,
package/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  'use strict'
2
2
 
3
- var proc = require('process')
4
- var exec = require('child_process').exec
5
- var semverValid = require('semver').valid
6
- var regex = /tag:\s*(.+?)[,)]/gi
7
- var cmd = 'git log --decorate --no-color'
3
+ const proc = require('process')
4
+ const exec = require('child_process').exec
5
+ const semverValid = require('semver').valid
6
+ const regex = /tag:\s*(.+?)[,)]/gi
7
+ const cmd = 'git log --decorate --no-color'
8
+ const unstableTagTest = /.+-\w+\.\d+$/
8
9
 
9
10
  function lernaTag (tag, pkg) {
10
11
  if (pkg && !(new RegExp('^' + pkg + '@')).test(tag)) {
@@ -19,7 +20,7 @@ module.exports = function gitSemverTags (opts, callback) {
19
20
  callback = opts
20
21
  opts = {}
21
22
  }
22
- var options = Object.assign({ maxBuffer: Infinity, cwd: proc.cwd() }, opts)
23
+ const options = Object.assign({ maxBuffer: Infinity, cwd: proc.cwd() }, opts)
23
24
 
24
25
  if (options.package && !options.lernaTags) {
25
26
  callback(new Error('opts.package should only be used when running in lerna mode'))
@@ -32,21 +33,27 @@ module.exports = function gitSemverTags (opts, callback) {
32
33
  return
33
34
  }
34
35
 
35
- var tags = []
36
- var tagPrefixRegexp
36
+ const tags = []
37
+ let tagPrefixRegexp
37
38
  if (options.tagPrefix) {
38
39
  tagPrefixRegexp = new RegExp('^' + options.tagPrefix + '(.*)')
39
40
  }
40
41
  data.split('\n').forEach(function (decorations) {
41
- var match
42
+ let match
42
43
  while ((match = regex.exec(decorations))) {
43
- var tag = match[1]
44
+ const tag = match[1]
45
+
46
+ if (options.skipUnstable && unstableTagTest.test(tag)) {
47
+ // skip unstable tag
48
+ continue
49
+ }
50
+
44
51
  if (options.lernaTags) {
45
52
  if (lernaTag(tag, options.package)) {
46
53
  tags.push(tag)
47
54
  }
48
55
  } else if (options.tagPrefix) {
49
- var matches = tag.match(tagPrefixRegexp)
56
+ const matches = tag.match(tagPrefixRegexp)
50
57
  if (matches && semverValid(matches[1])) {
51
58
  tags.push(tag)
52
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-semver-tags",
3
- "version": "3.0.0",
3
+ "version": "4.1.1",
4
4
  "description": "Get all git semver tags of your repository in reverse chronological order",
5
5
  "bugs": {
6
6
  "url": "https://github.com/conventional-changelog/conventional-changelog/issues"
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "engines": {
20
- "node": ">=6.9.0"
20
+ "node": ">=10"
21
21
  },
22
22
  "files": [
23
23
  "index.js",
@@ -32,7 +32,7 @@
32
32
  "git"
33
33
  ],
34
34
  "dependencies": {
35
- "meow": "^4.0.0",
35
+ "meow": "^8.0.0",
36
36
  "semver": "^6.0.0"
37
37
  },
38
38
  "scripts": {
@@ -41,5 +41,5 @@
41
41
  "bin": {
42
42
  "git-semver-tags": "cli.js"
43
43
  },
44
- "gitHead": "dadbbf8b1acbe4b3a8f345633bde3f4a4ad0bea4"
44
+ "gitHead": "cc567b98facf71315f4b1620d81ce01d155efaca"
45
45
  }