conventional-changelog-conventionalcommits 4.2.3 → 4.5.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 +45 -0
- package/README.md +34 -0
- package/conventional-changelog.js +4 -4
- package/conventional-recommended-bump.js +2 -2
- package/index.js +6 -6
- package/package.json +4 -4
- package/parser-opts.js +5 -5
- package/templates/commit.hbs +2 -2
- package/writer-opts.js +36 -26
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
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.5.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.4.0...conventional-changelog-conventionalcommits@4.5.0) (2020-11-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **conventionalcommits:** allow matching scope ([#669](https://github.com/conventional-changelog/conventional-changelog/issues/669)) ([e01e027](https://github.com/conventional-changelog/conventional-changelog/commit/e01e027af60f5fa3e9146223b96797793930aeb4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.4.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.3.1...conventional-changelog-conventionalcommits@4.4.0) (2020-08-12)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **templates:** if hash is nullish, do not display in CHANGELOG ([#664](https://github.com/conventional-changelog/conventional-changelog/issues/664)) ([f10256c](https://github.com/conventional-changelog/conventional-changelog/commit/f10256c635687de0a85c4db2bf06292902924f77))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [4.3.1](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.3.0...conventional-changelog-conventionalcommits@4.3.1) (2020-06-20)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **deps:** update dependency compare-func to v2 ([#647](https://github.com/conventional-changelog/conventional-changelog/issues/647)) ([de4f630](https://github.com/conventional-changelog/conventional-changelog/commit/de4f6309403ca0d46b7c6235052f4dca61ea15bc))
|
|
34
|
+
* pass config to parserOpts and writerOpts ([73c7a1b](https://github.com/conventional-changelog/conventional-changelog/commit/73c7a1b92c2a47c498f42972acbffa156172a341))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# [4.3.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.3...conventional-changelog-conventionalcommits@4.3.0) (2020-05-08)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
* add support for 'feature' as alias for 'feat' ([#582](https://github.com/conventional-changelog/conventional-changelog/issues/582)) ([94c40f7](https://github.com/conventional-changelog/conventional-changelog/commit/94c40f755e6c329311d89a47c634b91cf0276da3))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
## [4.2.3](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.2...conventional-changelog-conventionalcommits@4.2.3) (2019-11-07)
|
|
7
52
|
|
|
8
53
|
|
package/README.md
CHANGED
|
@@ -6,6 +6,40 @@ A concrete implementation of the specification described at
|
|
|
6
6
|
[conventionalcommits.org](https://conventionalcommits.org/) for automated
|
|
7
7
|
CHANGELOG generation and version management.
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
## Indirect Usage (as preset)
|
|
11
|
+
|
|
12
|
+
Use the [Conventional Changelog CLI Quick Start](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli#quick-start) with the `-p conventionalcommits` option.
|
|
13
|
+
|
|
14
|
+
## Direct Usage (as a base preset so you can customize it)
|
|
15
|
+
|
|
16
|
+
If you want to use this package directly and pass options, you can use the [Conventional Changelog CLI Quick Start](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli#quick-start) and with the `--config` or `-n` parameter, pass a js config that looks like this
|
|
17
|
+
```
|
|
18
|
+
'use strict'
|
|
19
|
+
const config = require('conventional-changelog-conventionalcommits')
|
|
20
|
+
|
|
21
|
+
module.exports = config({
|
|
22
|
+
"issuePrefixes": ["TEST-"],
|
|
23
|
+
"issueUrlFormat": "myBugTracker.com/{prefix}{id}"
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
or json config like that:
|
|
28
|
+
```
|
|
29
|
+
{
|
|
30
|
+
"options": {
|
|
31
|
+
"preset": {
|
|
32
|
+
"name": "conventionalchangelog",
|
|
33
|
+
"issuePrefixes": ["TEST-"],
|
|
34
|
+
"issueUrlFormat": "myBugTracker.com/{prefix}{id}"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
This last json config way passes the `preset` object to the `conventional-changelog-preset-loader` package, that in turn, passes this same `preset` object as the config for the `conventional-changelog-conventionalcommits`.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
9
43
|
See [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec) for available
|
|
10
44
|
configuration options.
|
|
11
45
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const Q = require(
|
|
4
|
-
const parserOpts = require(
|
|
5
|
-
const writerOpts = require(
|
|
3
|
+
const Q = require('q')
|
|
4
|
+
const parserOpts = require('./parser-opts')
|
|
5
|
+
const writerOpts = require('./writer-opts')
|
|
6
6
|
|
|
7
7
|
module.exports = function (config) {
|
|
8
|
-
return Q.all([parserOpts, writerOpts])
|
|
8
|
+
return Q.all([parserOpts(config), writerOpts(config)])
|
|
9
9
|
.spread((parserOpts, writerOpts) => {
|
|
10
10
|
return { parserOpts, writerOpts }
|
|
11
11
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const addBangNotes = require('./add-bang-notes')
|
|
4
|
-
const parserOpts = require(
|
|
4
|
+
const parserOpts = require('./parser-opts')
|
|
5
5
|
|
|
6
6
|
module.exports = function (config) {
|
|
7
7
|
return {
|
|
@@ -20,7 +20,7 @@ module.exports = function (config) {
|
|
|
20
20
|
if (commit.notes.length > 0) {
|
|
21
21
|
breakings += commit.notes.length
|
|
22
22
|
level = 0
|
|
23
|
-
} else if (commit.type ===
|
|
23
|
+
} else if (commit.type === 'feat' || commit.type === 'feature') {
|
|
24
24
|
features += 1
|
|
25
25
|
if (level === 2) {
|
|
26
26
|
level = 1
|
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
const Q = require(
|
|
3
|
-
const _ = require(
|
|
4
|
-
const conventionalChangelog = require(
|
|
5
|
-
const parserOpts = require(
|
|
6
|
-
const recommendedBumpOpts = require(
|
|
7
|
-
const writerOpts = require(
|
|
2
|
+
const Q = require('q')
|
|
3
|
+
const _ = require('lodash')
|
|
4
|
+
const conventionalChangelog = require('./conventional-changelog')
|
|
5
|
+
const parserOpts = require('./parser-opts')
|
|
6
|
+
const recommendedBumpOpts = require('./conventional-recommended-bump')
|
|
7
|
+
const writerOpts = require('./writer-opts')
|
|
8
8
|
|
|
9
9
|
module.exports = function (parameter) {
|
|
10
10
|
// parameter passed can be either a config object or a callback function
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conventional-changelog-conventionalcommits",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "conventional-changelog conventionalcommits.org preset",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"author": "Ben Coe",
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=10"
|
|
30
30
|
},
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"bugs": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"compare-func": "^
|
|
37
|
+
"compare-func": "^2.0.0",
|
|
38
38
|
"lodash": "^4.17.15",
|
|
39
39
|
"q": "^1.5.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "cc567b98facf71315f4b1620d81ce01d155efaca"
|
|
42
42
|
}
|
package/parser-opts.js
CHANGED
|
@@ -6,13 +6,13 @@ module.exports = function (config) {
|
|
|
6
6
|
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
|
|
7
7
|
breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
|
|
8
8
|
headerCorrespondence: [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
'type',
|
|
10
|
+
'scope',
|
|
11
|
+
'subject'
|
|
12
12
|
],
|
|
13
|
-
noteKeywords: [
|
|
13
|
+
noteKeywords: ['BREAKING CHANGE'],
|
|
14
14
|
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
|
|
15
|
-
revertCorrespondence: [
|
|
15
|
+
revertCorrespondence: ['header', 'hash'],
|
|
16
16
|
issuePrefixes: config.issuePrefixes
|
|
17
17
|
}
|
|
18
18
|
}
|
package/templates/commit.hbs
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
{{~header}}
|
|
6
6
|
{{~/if}}
|
|
7
7
|
|
|
8
|
-
{{~!-- commit link --}} {{#if @root.linkReferences~}}
|
|
8
|
+
{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
|
|
9
9
|
([{{shortHash}}]({{commitUrlFormat}}))
|
|
10
10
|
{{~else}}
|
|
11
11
|
{{~shortHash}}
|
|
12
|
-
{{~/if}}
|
|
12
|
+
{{~/if}}{{~/if}}
|
|
13
13
|
|
|
14
14
|
{{~!-- commit references --}}
|
|
15
15
|
{{~#if references~}}
|
package/writer-opts.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const addBangNotes = require('./add-bang-notes')
|
|
4
|
-
const compareFunc = require(
|
|
5
|
-
const Q = require(
|
|
6
|
-
const readFile = Q.denodeify(require(
|
|
7
|
-
const resolve = require(
|
|
4
|
+
const compareFunc = require('compare-func')
|
|
5
|
+
const Q = require('q')
|
|
6
|
+
const readFile = Q.denodeify(require('fs').readFile)
|
|
7
|
+
const resolve = require('path').resolve
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Handlebar partials for various property substitutions based on commit context.
|
|
@@ -34,10 +34,10 @@ module.exports = function (config) {
|
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
return Q.all([
|
|
37
|
-
readFile(resolve(__dirname,
|
|
38
|
-
readFile(resolve(__dirname,
|
|
39
|
-
readFile(resolve(__dirname,
|
|
40
|
-
readFile(resolve(__dirname,
|
|
37
|
+
readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'),
|
|
38
|
+
readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'),
|
|
39
|
+
readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8'),
|
|
40
|
+
readFile(resolve(__dirname, './templates/footer.hbs'), 'utf-8')
|
|
41
41
|
])
|
|
42
42
|
.spread((template, header, commit, footer) => {
|
|
43
43
|
const writerOpts = getWriterOpts(config)
|
|
@@ -54,18 +54,27 @@ module.exports = function (config) {
|
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
function findTypeEntry (types, commit) {
|
|
58
|
+
const typeKey = (commit.revert ? 'revert' : (commit.type || '')).toLowerCase()
|
|
59
|
+
return types.find((entry) => {
|
|
60
|
+
if (entry.type !== typeKey) {
|
|
61
|
+
return false
|
|
62
|
+
}
|
|
63
|
+
if (entry.scope && entry.scope !== commit.scope) {
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
66
|
+
return true
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
57
70
|
function getWriterOpts (config) {
|
|
58
71
|
config = defaultConfig(config)
|
|
59
|
-
const typesLookup = {}
|
|
60
|
-
config.types.forEach(type => {
|
|
61
|
-
typesLookup[type.type] = type
|
|
62
|
-
})
|
|
63
72
|
|
|
64
73
|
return {
|
|
65
74
|
transform: (commit, context) => {
|
|
66
75
|
let discard = true
|
|
67
76
|
const issues = []
|
|
68
|
-
const
|
|
77
|
+
const entry = findTypeEntry(config.types, commit)
|
|
69
78
|
|
|
70
79
|
// adds additional breaking change notes
|
|
71
80
|
// for the special case, test(system)!: hello world, where there is
|
|
@@ -73,29 +82,29 @@ function getWriterOpts (config) {
|
|
|
73
82
|
addBangNotes(commit)
|
|
74
83
|
|
|
75
84
|
commit.notes.forEach(note => {
|
|
76
|
-
note.title =
|
|
85
|
+
note.title = 'BREAKING CHANGES'
|
|
77
86
|
discard = false
|
|
78
87
|
})
|
|
79
88
|
|
|
80
89
|
// breaking changes attached to any type are still displayed.
|
|
81
|
-
if (discard && (
|
|
82
|
-
|
|
90
|
+
if (discard && (entry === undefined ||
|
|
91
|
+
entry.hidden)) return
|
|
83
92
|
|
|
84
|
-
if (
|
|
93
|
+
if (entry) commit.type = entry.section
|
|
85
94
|
|
|
86
|
-
if (commit.scope ===
|
|
87
|
-
commit.scope =
|
|
95
|
+
if (commit.scope === '*') {
|
|
96
|
+
commit.scope = ''
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
if (typeof commit.hash ===
|
|
99
|
+
if (typeof commit.hash === 'string') {
|
|
91
100
|
commit.shortHash = commit.hash.substring(0, 7)
|
|
92
101
|
}
|
|
93
102
|
|
|
94
|
-
if (typeof commit.subject ===
|
|
103
|
+
if (typeof commit.subject === 'string') {
|
|
95
104
|
// Issue URLs.
|
|
96
105
|
config.issuePrefixes.join('|')
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
const issueRegEx = '(' + config.issuePrefixes.join('|') + ')' + '([0-9]+)'
|
|
107
|
+
const re = new RegExp(issueRegEx, 'g')
|
|
99
108
|
|
|
100
109
|
commit.subject = commit.subject.replace(re, (_, prefix, issue) => {
|
|
101
110
|
issues.push(prefix + issue)
|
|
@@ -137,7 +146,7 @@ function getWriterOpts (config) {
|
|
|
137
146
|
|
|
138
147
|
return commit
|
|
139
148
|
},
|
|
140
|
-
groupBy:
|
|
149
|
+
groupBy: 'type',
|
|
141
150
|
// the groupings of commit messages, e.g., Features vs., Bug Fixes, are
|
|
142
151
|
// sorted based on their probable importance:
|
|
143
152
|
commitGroupsSort: (a, b) => {
|
|
@@ -150,8 +159,8 @@ function getWriterOpts (config) {
|
|
|
150
159
|
return 1
|
|
151
160
|
}
|
|
152
161
|
},
|
|
153
|
-
commitsSort: [
|
|
154
|
-
noteGroupsSort:
|
|
162
|
+
commitsSort: ['scope', 'subject'],
|
|
163
|
+
noteGroupsSort: 'title',
|
|
155
164
|
notesSort: compareFunc
|
|
156
165
|
}
|
|
157
166
|
}
|
|
@@ -161,6 +170,7 @@ function defaultConfig (config) {
|
|
|
161
170
|
config = config || {}
|
|
162
171
|
config.types = config.types || [
|
|
163
172
|
{ type: 'feat', section: 'Features' },
|
|
173
|
+
{ type: 'feature', section: 'Features' },
|
|
164
174
|
{ type: 'fix', section: 'Bug Fixes' },
|
|
165
175
|
{ type: 'perf', section: 'Performance Improvements' },
|
|
166
176
|
{ type: 'revert', section: 'Reverts' },
|