git-semver-tags 1.3.6 → 3.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,71 @@
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.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
+
8
+
9
+ * 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)
10
+
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * gitSemverTags now takes options followed by callback.
15
+
16
+
17
+
18
+
19
+
20
+ ## [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)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **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))
26
+
27
+
28
+
29
+
30
+
31
+ ## [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)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * bad release of git-semver-tags ([8827ae4](https://github.com/conventional-changelog/conventional-changelog/commit/8827ae4))
37
+
38
+
39
+
40
+
41
+
42
+ ## [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)
43
+
44
+
45
+ ### Bug Fixes
46
+
47
+ * 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))
48
+
49
+
50
+
51
+
52
+
53
+ <a name="2.0.0"></a>
54
+ # [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)
55
+
56
+
57
+ ### Chores
58
+
59
+ * **package:** set Node requirement to oldest supported LTS ([#329](https://github.com/conventional-changelog/conventional-changelog/issues/329)) ([cae2fe0](https://github.com/conventional-changelog/conventional-changelog/commit/cae2fe0))
60
+
61
+
62
+ ### BREAKING CHANGES
63
+
64
+ * **package:** Set the package's minimum required Node version to be the oldest LTS
65
+ currently supported by the Node Release working group. At this time,
66
+ that is Node 6 (which is in its Maintenance LTS phase).
67
+
68
+
69
+
70
+
6
71
  <a name="1.3.6"></a>
7
72
  ## [1.3.6](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@1.3.5...git-semver-tags@1.3.6) (2018-03-27)
8
73
 
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,21 @@ 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`
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`
13
14
  )
14
15
 
15
- gitSemverTags(function (err, tags) {
16
+ gitSemverTags({
17
+ lernaTags: args.flags.lerna,
18
+ package: args.flags.package,
19
+ tagPrefix: args.flags.tagPrefix
20
+ }, function (err, tags) {
16
21
  if (err) {
17
22
  console.error(err.toString())
18
23
  process.exit(1)
19
24
  }
20
25
 
21
26
  console.log(tags.join('\n'))
22
- }, {
23
- lernaTags: args.flags.lerna,
24
- package: args.flags.package,
25
- tagPrefix: args.flags.tagPrefix
26
27
  })
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": "1.3.6",
3
+ "version": "3.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"
@@ -16,6 +16,9 @@
16
16
  "url": "https://github.com/conventional-changelog/conventional-changelog.git"
17
17
  },
18
18
  "license": "MIT",
19
+ "engines": {
20
+ "node": ">=6.9.0"
21
+ },
19
22
  "files": [
20
23
  "index.js",
21
24
  "cli.js"
@@ -30,18 +33,13 @@
30
33
  ],
31
34
  "dependencies": {
32
35
  "meow": "^4.0.0",
33
- "semver": "^5.5.0"
34
- },
35
- "devDependencies": {
36
- "git-dummy-commit": "^1.2.0",
37
- "shelljs": "^0.8.0"
36
+ "semver": "^6.0.0"
38
37
  },
39
38
  "scripts": {
40
- "lint": "eslint --fix .",
41
- "test": "npm run-script lint && mocha --timeout 30000",
42
39
  "test-windows": "mocha --timeout 30000"
43
40
  },
44
41
  "bin": {
45
42
  "git-semver-tags": "cli.js"
46
- }
43
+ },
44
+ "gitHead": "dadbbf8b1acbe4b3a8f345633bde3f4a4ad0bea4"
47
45
  }