git-semver-tags 5.0.0 → 6.0.0

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.
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- 'use strict'
3
- const meow = require('meow')
4
- const gitSemverTags = require('./')
2
+ import meow from 'meow'
3
+ import gitSemverTags from './index.js'
5
4
 
6
5
  const args = meow(`
7
6
  Usage
@@ -10,8 +9,10 @@ const args = meow(`
10
9
  --cwd path to git repository to be searched
11
10
  --lerna parse lerna style git tags
12
11
  --package <name> when listing lerna style tags, filter by a package
13
- --tag-prefix <prefix> prefix to remove from the tags during their processing`,
12
+ --tag-prefix <prefix> prefix to remove from the tags during their processing
13
+ --skip-unstable if given, unstable tags will be skipped, e.g., x.x.x-alpha.1, x.x.x-rc.2`,
14
14
  {
15
+ importMeta: import.meta,
15
16
  booleanDefault: undefined,
16
17
  flags: {
17
18
  cwd: {
@@ -25,6 +26,9 @@ const args = meow(`
25
26
  },
26
27
  tagPrefix: {
27
28
  type: 'string'
29
+ },
30
+ skipUnstable: {
31
+ type: 'boolean'
28
32
  }
29
33
  }
30
34
  })
@@ -32,8 +36,9 @@ const args = meow(`
32
36
  gitSemverTags({
33
37
  lernaTags: args.flags.lerna,
34
38
  package: args.flags.package,
35
- tagPrefix: args.flags.tagPrefix
36
- }, function (err, tags) {
39
+ tagPrefix: args.flags.tagPrefix,
40
+ skipUnstable: args.flags.skipUnstable
41
+ }, (err, tags) => {
37
42
  if (err) {
38
43
  console.error(err.toString())
39
44
  process.exit(1)
package/index.js CHANGED
@@ -34,10 +34,6 @@ module.exports = function gitSemverTags (opts, callback) {
34
34
  }
35
35
 
36
36
  const tags = []
37
- let tagPrefixRegexp
38
- if (options.tagPrefix) {
39
- tagPrefixRegexp = new RegExp('^' + options.tagPrefix + '(.*)')
40
- }
41
37
  data.split('\n').forEach(function (decorations) {
42
38
  let match
43
39
  while ((match = regex.exec(decorations))) {
@@ -53,9 +49,11 @@ module.exports = function gitSemverTags (opts, callback) {
53
49
  tags.push(tag)
54
50
  }
55
51
  } else if (options.tagPrefix) {
56
- const matches = tag.match(tagPrefixRegexp)
57
- if (matches && semverValid(matches[1])) {
58
- tags.push(tag)
52
+ if (tag.startsWith(options.tagPrefix)) {
53
+ const unprefixedTag = tag.replace(options.tagPrefix, '')
54
+ if (semverValid(unprefixedTag)) {
55
+ tags.push(tag)
56
+ }
59
57
  }
60
58
  } else if (semverValid(tag)) {
61
59
  tags.push(tag)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-semver-tags",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
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,11 +17,11 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "engines": {
20
- "node": ">=14"
20
+ "node": ">=16"
21
21
  },
22
22
  "files": [
23
23
  "index.js",
24
- "cli.js"
24
+ "cli.mjs"
25
25
  ],
26
26
  "keywords": [
27
27
  "git-semver-tags",
@@ -32,13 +32,10 @@
32
32
  "git"
33
33
  ],
34
34
  "dependencies": {
35
- "meow": "^8.1.2",
36
- "semver": "^6.3.0"
35
+ "meow": "^12.0.1",
36
+ "semver": "^7.5.2"
37
37
  },
38
38
  "bin": {
39
- "git-semver-tags": "cli.js"
40
- },
41
- "scripts": {
42
- "test-windows": "mocha --timeout 30000"
39
+ "git-semver-tags": "cli.mjs"
43
40
  }
44
41
  }