conventional-commits-parser 3.0.5 → 3.1.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 +52 -0
- package/README.md +6 -0
- package/cli.js +34 -16
- package/index.js +1 -1
- package/lib/parser.js +11 -0
- package/lib/regex.js +4 -3
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,58 @@
|
|
|
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.1.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser@3.0.8...conventional-commits-parser@3.1.0) (2020-05-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **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))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **conventional-commits-parser:** add issuePrefixesCaseSensitive parser option ([#580](https://github.com/conventional-changelog/conventional-changelog/issues/580)) ([526b282](https://github.com/conventional-changelog/conventional-changelog/commit/526b28214d12c55158eb2e4d44408378587ceb97))
|
|
17
|
+
* support slash in headerPattern default options ([93a547d](https://github.com/conventional-changelog/conventional-changelog/commit/93a547d742634d8676f499cfa2a274bc3792d020))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [3.0.8](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser@3.0.7...conventional-commits-parser@3.0.8) (2019-11-14)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* 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))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [3.0.7](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser@3.0.6...conventional-commits-parser@3.0.7) (2019-11-07)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **conventional-commits-parser:** add breaking change notes if header match `breakingHeaderPattern` ([#544](https://github.com/conventional-changelog/conventional-changelog/issues/544)) ([efdf3cb](https://github.com/conventional-changelog/conventional-changelog/commit/efdf3cbc9de3278b180a48beebb74e596e3c5f94))
|
|
40
|
+
* **conventional-commits-parser:** add missing separator pipe to non tty parser ([#546](https://github.com/conventional-changelog/conventional-changelog/issues/546)) ([c522743](https://github.com/conventional-changelog/conventional-changelog/commit/c5227437b0b300f30a57e8ba5df2a8ab8d163af0))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [3.0.6](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser@3.0.5...conventional-commits-parser@3.0.6) (2019-10-24)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* **conventional-commits-parser:** downgrade is-text-path due to node 6 incompatibility ([#536](https://github.com/conventional-changelog/conventional-changelog/issues/536)) ([3aa2637](https://github.com/conventional-changelog/conventional-changelog/commit/3aa2637a1c65bb4db3d8bf2c6ce17e6f5abe1ca1))
|
|
52
|
+
* **deps:** update lodash to fix security issues ([#535](https://github.com/conventional-changelog/conventional-changelog/issues/535)) ([ac43f51](https://github.com/conventional-changelog/conventional-changelog/commit/ac43f51de1f3b597c32f7f8442917a2d06199018))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
6
58
|
## [3.0.4](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-commits-parser@3.0.3...conventional-commits-parser@3.0.4) (2019-10-02)
|
|
7
59
|
|
|
8
60
|
**Note:** Version bump only for package conventional-commits-parser
|
package/README.md
CHANGED
|
@@ -193,6 +193,12 @@ Type: `array` of `string` or `string` Default: `['#']`
|
|
|
193
193
|
|
|
194
194
|
The prefixes of an issue. EG: In `gh-123` `gh-` is the prefix.
|
|
195
195
|
|
|
196
|
+
##### issuePrefixesCaseSensitive
|
|
197
|
+
|
|
198
|
+
Type: `boolean` Default: false
|
|
199
|
+
|
|
200
|
+
Used to define if `issuePrefixes` should be considered case sensitive.
|
|
201
|
+
|
|
196
202
|
##### noteKeywords
|
|
197
203
|
|
|
198
204
|
Type: `array` of `string` or `string` Default: `['BREAKING CHANGE']`
|
package/cli.js
CHANGED
|
@@ -31,37 +31,54 @@ var cli = meow(`
|
|
|
31
31
|
conventional-commits-parser log2.txt '===' >> parsed.txt
|
|
32
32
|
|
|
33
33
|
Options
|
|
34
|
-
-p, --header-pattern
|
|
35
|
-
-c, --header-correspondence
|
|
36
|
-
-r, --reference-actions
|
|
37
|
-
-i, --issue-prefixes
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
--
|
|
41
|
-
--revert-
|
|
42
|
-
-
|
|
34
|
+
-p, --header-pattern Regex to match header pattern
|
|
35
|
+
-c, --header-correspondence Comma separated parts used to define what capturing group of 'headerPattern' captures what
|
|
36
|
+
-r, --reference-actions Comma separated keywords that used to reference issues
|
|
37
|
+
-i, --issue-prefixes Comma separated prefixes of an issue
|
|
38
|
+
--issue-prefixes-case-sensitive Treat issue prefixes as case sensitive
|
|
39
|
+
-n, --note-keywords Comma separated keywords for important notes
|
|
40
|
+
-f, --field-pattern Regex to match other fields
|
|
41
|
+
--revert-pattern Regex to match revert pattern
|
|
42
|
+
--revert-correspondence Comma separated fields used to define what the commit reverts
|
|
43
|
+
-v, --verbose Verbose output
|
|
43
44
|
`, {
|
|
44
45
|
flags: {
|
|
45
46
|
'header-pattern': {
|
|
46
|
-
alias:
|
|
47
|
+
alias: 'p',
|
|
48
|
+
type: 'string'
|
|
47
49
|
},
|
|
48
50
|
'header-correspondence': {
|
|
49
|
-
alias:
|
|
51
|
+
alias: 'c',
|
|
52
|
+
type: 'string'
|
|
50
53
|
},
|
|
51
54
|
'reference-actions': {
|
|
52
|
-
alias:
|
|
55
|
+
alias: 'r',
|
|
56
|
+
type: 'string'
|
|
53
57
|
},
|
|
54
58
|
'issue-prefixes': {
|
|
55
|
-
alias:
|
|
59
|
+
alias: 'i',
|
|
60
|
+
type: 'string'
|
|
61
|
+
},
|
|
62
|
+
'issue-prefixes-case-sensitive': {
|
|
63
|
+
type: 'boolean'
|
|
56
64
|
},
|
|
57
65
|
'note-keywords': {
|
|
58
|
-
alias:
|
|
66
|
+
alias: 'n',
|
|
67
|
+
type: 'string'
|
|
59
68
|
},
|
|
60
69
|
'field-pattern': {
|
|
61
|
-
alias:
|
|
70
|
+
alias: 'f',
|
|
71
|
+
type: 'string'
|
|
72
|
+
},
|
|
73
|
+
'revert-pattern': {
|
|
74
|
+
type: 'string'
|
|
75
|
+
},
|
|
76
|
+
'revert-correspondence': {
|
|
77
|
+
type: 'string'
|
|
62
78
|
},
|
|
63
79
|
verbose: {
|
|
64
|
-
alias:
|
|
80
|
+
alias: 'v',
|
|
81
|
+
type: 'boolean'
|
|
65
82
|
}
|
|
66
83
|
}
|
|
67
84
|
})
|
|
@@ -137,6 +154,7 @@ if (process.stdin.isTTY) {
|
|
|
137
154
|
} else {
|
|
138
155
|
options.warn = true
|
|
139
156
|
process.stdin
|
|
157
|
+
.pipe(split(separator))
|
|
140
158
|
.pipe(conventionalCommitsParser(options))
|
|
141
159
|
.on('error', function (err) {
|
|
142
160
|
console.error(err.toString())
|
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var _ = require('lodash')
|
|
|
7
7
|
|
|
8
8
|
function assignOpts (options) {
|
|
9
9
|
options = _.extend({
|
|
10
|
-
headerPattern: /^(\w*)(?:\(([\w
|
|
10
|
+
headerPattern: /^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$/,
|
|
11
11
|
headerCorrespondence: ['type', 'scope', 'subject'],
|
|
12
12
|
referenceActions: [
|
|
13
13
|
'close',
|
package/lib/parser.js
CHANGED
|
@@ -253,6 +253,17 @@ function parser (raw, options, regex) {
|
|
|
253
253
|
}
|
|
254
254
|
})
|
|
255
255
|
|
|
256
|
+
if (options.breakingHeaderPattern && notes.length === 0) {
|
|
257
|
+
var breakingHeader = header.match(options.breakingHeaderPattern)
|
|
258
|
+
if (breakingHeader) {
|
|
259
|
+
const noteText = breakingHeader[3] // the description of the change.
|
|
260
|
+
notes.push({
|
|
261
|
+
title: 'BREAKING CHANGE',
|
|
262
|
+
text: noteText
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
256
267
|
while ((mentionsMatch = regex.mentions.exec(raw))) {
|
|
257
268
|
mentions.push(mentionsMatch[1])
|
|
258
269
|
}
|
package/lib/regex.js
CHANGED
|
@@ -21,12 +21,13 @@ function getNotesRegex (noteKeywords) {
|
|
|
21
21
|
return new RegExp('^[\\s|*]*(' + join(noteKeywords, '|') + ')[:\\s]+(.*)', 'i')
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function getReferencePartsRegex (issuePrefixes) {
|
|
24
|
+
function getReferencePartsRegex (issuePrefixes, issuePrefixesCaseSensitive) {
|
|
25
25
|
if (!issuePrefixes) {
|
|
26
26
|
return reNomatch
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
var flags = issuePrefixesCaseSensitive ? 'g' : 'gi'
|
|
30
|
+
return new RegExp('(?:.*?)??\\s*([\\w-\\.\\/]*?)??(' + join(issuePrefixes, '|') + ')([\\w-]*\\d+)', flags)
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function getReferencesRegex (referenceActions) {
|
|
@@ -42,7 +43,7 @@ function getReferencesRegex (referenceActions) {
|
|
|
42
43
|
module.exports = function (options) {
|
|
43
44
|
options = options || {}
|
|
44
45
|
var reNotes = getNotesRegex(options.noteKeywords)
|
|
45
|
-
var reReferenceParts = getReferencePartsRegex(options.issuePrefixes)
|
|
46
|
+
var reReferenceParts = getReferencePartsRegex(options.issuePrefixes, options.issuePrefixesCaseSensitive)
|
|
46
47
|
var reReferences = getReferencesRegex(options.referenceActions)
|
|
47
48
|
|
|
48
49
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conventional-commits-parser",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Parse raw conventional commits",
|
|
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": ">=
|
|
20
|
+
"node": ">=10"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"JSONStream": "^1.0.4",
|
|
37
|
-
"is-text-path": "^
|
|
38
|
-
"lodash": "^4.
|
|
39
|
-
"meow": "^
|
|
37
|
+
"is-text-path": "^1.0.1",
|
|
38
|
+
"lodash": "^4.17.15",
|
|
39
|
+
"meow": "^7.0.0",
|
|
40
40
|
"split2": "^2.0.0",
|
|
41
41
|
"through2": "^3.0.0",
|
|
42
42
|
"trim-off-newlines": "^1.0.0"
|
|
@@ -47,5 +47,8 @@
|
|
|
47
47
|
"bin": {
|
|
48
48
|
"conventional-commits-parser": "cli.js"
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"forceable-tty": "^0.1.0"
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "83643c5a0d2c4d7c9ba14cbf990ffbc577a51e8c"
|
|
51
54
|
}
|