git-semver-tags 2.0.0 → 3.0.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,64 @@
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
+ ## [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)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * 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))
12
+
13
+
14
+
15
+
16
+
17
+ # [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)
18
+
19
+
20
+ * refactor!: modify gitSemverTags to take options first (#390) ([dc8aeda](https://github.com/conventional-changelog/conventional-changelog/commit/dc8aeda)), closes [#390](https://github.com/conventional-changelog/conventional-changelog/issues/390)
21
+
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ * gitSemverTags now takes options followed by callback.
26
+
27
+
28
+
29
+
30
+
31
+ ## [2.0.3](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@2.0.2...git-semver-tags@2.0.3) (2019-05-18)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **deps:** update dependency semver to v6 ([#458](https://github.com/conventional-changelog/conventional-changelog/issues/458)) ([efaa7bb](https://github.com/conventional-changelog/conventional-changelog/commit/efaa7bb))
37
+
38
+
39
+
40
+
41
+
42
+ ## [2.0.2](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@2.0.1...git-semver-tags@2.0.2) (2018-11-01)
43
+
44
+
45
+ ### Bug Fixes
46
+
47
+ * bad release of git-semver-tags ([8827ae4](https://github.com/conventional-changelog/conventional-changelog/commit/8827ae4))
48
+
49
+
50
+
51
+
52
+
53
+ ## [2.0.1](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@2.0.0...git-semver-tags@2.0.1) (2018-11-01)
54
+
55
+
56
+ ### Bug Fixes
57
+
58
+ * Upgrade to Lerna 3, fix Node.js v11 error ([#385](https://github.com/conventional-changelog/conventional-changelog/issues/385)) ([cdef282](https://github.com/conventional-changelog/conventional-changelog/commit/cdef282))
59
+
60
+
61
+
62
+
63
+
6
64
  <a name="2.0.0"></a>
7
65
  # [2.0.0](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@1.3.6...git-semver-tags@2.0.0) (2018-05-29)
8
66
 
package/README.md CHANGED
@@ -11,11 +11,12 @@
11
11
  $ npm install --save git-semver-tags
12
12
  ```
13
13
 
14
-
15
14
  ## Usage
16
15
 
17
16
  ```js
18
- var gitSemverTags = require('git-semver-tags', [options]);
17
+ var gitSemverTags = require('git-semver-tags');
18
+
19
+ // gitSemverTags([options,] callback)
19
20
 
20
21
  gitSemverTags(function(err, tags) {
21
22
  console.log(tags);
package/cli.js CHANGED
@@ -7,20 +7,37 @@ var args = meow(`
7
7
  Usage
8
8
  git-semver-tags
9
9
  Options
10
- --lerna parse lerna style git tags
11
- --package when listing lerna style tags, filter by a package
12
- --tagPrefix prefix to remove from the tags during their processing`
13
- )
10
+ --cwd path to git repository to be searched
11
+ --lerna parse lerna style git tags
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
+ {
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
+ })
14
31
 
15
- gitSemverTags(function (err, tags) {
32
+ gitSemverTags({
33
+ lernaTags: args.flags.lerna,
34
+ package: args.flags.package,
35
+ tagPrefix: args.flags.tagPrefix
36
+ }, function (err, tags) {
16
37
  if (err) {
17
38
  console.error(err.toString())
18
39
  process.exit(1)
19
40
  }
20
41
 
21
42
  console.log(tags.join('\n'))
22
- }, {
23
- lernaTags: args.flags.lerna,
24
- package: args.flags.package,
25
- tagPrefix: args.flags.tagPrefix
26
43
  })
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ var proc = require('process')
3
4
  var exec = require('child_process').exec
4
5
  var semverValid = require('semver').valid
5
6
  var regex = /tag:\s*(.+?)[,)]/gi
@@ -13,17 +14,19 @@ function lernaTag (tag, pkg) {
13
14
  }
14
15
  }
15
16
 
16
- module.exports = function (callback, opts) {
17
- opts = opts || {}
17
+ module.exports = function gitSemverTags (opts, callback) {
18
+ if (typeof opts === 'function') {
19
+ callback = opts
20
+ opts = {}
21
+ }
22
+ var options = Object.assign({ maxBuffer: Infinity, cwd: proc.cwd() }, opts)
18
23
 
19
- if (opts.package && !opts.lernaTags) {
20
- callback(Error('opts.package should only be used when running in lerna mode'))
24
+ if (options.package && !options.lernaTags) {
25
+ callback(new Error('opts.package should only be used when running in lerna mode'))
21
26
  return
22
27
  }
23
28
 
24
- exec(cmd, {
25
- maxBuffer: Infinity
26
- }, function (err, data) {
29
+ exec(cmd, options, function (err, data) {
27
30
  if (err) {
28
31
  callback(err)
29
32
  return
@@ -31,18 +34,18 @@ module.exports = function (callback, opts) {
31
34
 
32
35
  var tags = []
33
36
  var tagPrefixRegexp
34
- if (opts.tagPrefix) {
35
- tagPrefixRegexp = new RegExp('^' + opts.tagPrefix + '(.*)')
37
+ if (options.tagPrefix) {
38
+ tagPrefixRegexp = new RegExp('^' + options.tagPrefix + '(.*)')
36
39
  }
37
40
  data.split('\n').forEach(function (decorations) {
38
41
  var match
39
42
  while ((match = regex.exec(decorations))) {
40
43
  var tag = match[1]
41
- if (opts.lernaTags) {
42
- if (lernaTag(tag, opts.package)) {
44
+ if (options.lernaTags) {
45
+ if (lernaTag(tag, options.package)) {
43
46
  tags.push(tag)
44
47
  }
45
- } else if (opts.tagPrefix) {
48
+ } else if (options.tagPrefix) {
46
49
  var matches = tag.match(tagPrefixRegexp)
47
50
  if (matches && semverValid(matches[1])) {
48
51
  tags.push(tag)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-semver-tags",
3
- "version": "2.0.0",
3
+ "version": "3.0.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"
@@ -32,19 +32,14 @@
32
32
  "git"
33
33
  ],
34
34
  "dependencies": {
35
- "meow": "^4.0.0",
36
- "semver": "^5.5.0"
37
- },
38
- "devDependencies": {
39
- "git-dummy-commit": "^1.2.0",
40
- "shelljs": "^0.8.0"
35
+ "meow": "^5.0.0",
36
+ "semver": "^6.0.0"
41
37
  },
42
38
  "scripts": {
43
- "lint": "eslint --fix .",
44
- "test": "npm run-script lint && mocha --timeout 30000",
45
39
  "test-windows": "mocha --timeout 30000"
46
40
  },
47
41
  "bin": {
48
42
  "git-semver-tags": "cli.js"
49
- }
43
+ },
44
+ "gitHead": "79217815a7ce5f3d3f833961ce9a14bd454e5789"
50
45
  }