conventional-changelog-angular 8.0.0 → 8.2.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/README.md +7 -1
- package/package.json +1 -1
- package/src/index.js +5 -1
- package/src/parser.js +1 -1
- package/src/templates/template.hbs +0 -2
- package/src/whatBump.js +3 -2
- package/src/writer.js +16 -10
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
[node-url]: https://nodejs.org
|
|
19
19
|
|
|
20
20
|
[deps]: https://img.shields.io/librariesio/release/npm/conventional-changelog-angular
|
|
21
|
-
[deps-url]: https://libraries.io/npm/conventional-changelog-angular
|
|
21
|
+
[deps-url]: https://libraries.io/npm/conventional-changelog-angular
|
|
22
22
|
|
|
23
23
|
[size]: https://packagephobia.com/badge?p=conventional-changelog-angular
|
|
24
24
|
[size-url]: https://packagephobia.com/result?p=conventional-changelog-angular
|
|
@@ -132,3 +132,9 @@ reference GitHub issues that this commit **Closes**.
|
|
|
132
132
|
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
|
|
133
133
|
|
|
134
134
|
A detailed explanation can be found in this [document](#commit-message-format).
|
|
135
|
+
|
|
136
|
+
## Specific Options
|
|
137
|
+
|
|
138
|
+
| Option | Description |
|
|
139
|
+
|--------|-------------|
|
|
140
|
+
| ignoreCommits | Regular expression to match and exclude commits from the changelog. Commits matching this pattern will be ignored. |
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2,8 +2,12 @@ import { createParserOpts } from './parser.js'
|
|
|
2
2
|
import { createWriterOpts } from './writer.js'
|
|
3
3
|
import { whatBump } from './whatBump.js'
|
|
4
4
|
|
|
5
|
-
export default async function createPreset
|
|
5
|
+
export default async function createPreset(config) {
|
|
6
6
|
return {
|
|
7
|
+
commits: {
|
|
8
|
+
ignore: config?.ignoreCommits,
|
|
9
|
+
merges: false
|
|
10
|
+
},
|
|
7
11
|
parser: createParserOpts(),
|
|
8
12
|
writer: await createWriterOpts(),
|
|
9
13
|
whatBump
|
package/src/parser.js
CHANGED
package/src/whatBump.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export function whatBump
|
|
1
|
+
export function whatBump(commits) {
|
|
2
2
|
let level = 2
|
|
3
3
|
let breakings = 0
|
|
4
4
|
let features = 0
|
|
5
5
|
|
|
6
|
-
commits.forEach(commit => {
|
|
6
|
+
commits.forEach((commit) => {
|
|
7
7
|
if (commit.notes.length > 0) {
|
|
8
8
|
breakings += commit.notes.length
|
|
9
9
|
level = 0
|
|
10
10
|
} else if (commit.type === 'feat') {
|
|
11
11
|
features += 1
|
|
12
|
+
|
|
12
13
|
if (level === 2) {
|
|
13
14
|
level = 1
|
|
14
15
|
}
|
package/src/writer.js
CHANGED
|
@@ -4,9 +4,15 @@ import { fileURLToPath } from 'url'
|
|
|
4
4
|
import compareFunc from 'compare-func'
|
|
5
5
|
|
|
6
6
|
const dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
7
|
+
const COMMIT_HASH_LENGTH = 7
|
|
7
8
|
|
|
8
|
-
export async function createWriterOpts
|
|
9
|
-
const [
|
|
9
|
+
export async function createWriterOpts() {
|
|
10
|
+
const [
|
|
11
|
+
template,
|
|
12
|
+
header,
|
|
13
|
+
commit,
|
|
14
|
+
footer
|
|
15
|
+
] = await Promise.all([
|
|
10
16
|
readFile(resolve(dirname, './templates/template.hbs'), 'utf-8'),
|
|
11
17
|
readFile(resolve(dirname, './templates/header.hbs'), 'utf-8'),
|
|
12
18
|
readFile(resolve(dirname, './templates/commit.hbs'), 'utf-8'),
|
|
@@ -22,11 +28,11 @@ export async function createWriterOpts () {
|
|
|
22
28
|
return writerOpts
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
function getWriterOpts
|
|
31
|
+
function getWriterOpts() {
|
|
26
32
|
return {
|
|
27
33
|
transform: (commit, context) => {
|
|
28
34
|
let discard = true
|
|
29
|
-
const notes = commit.notes.map(note => {
|
|
35
|
+
const notes = commit.notes.map((note) => {
|
|
30
36
|
discard = false
|
|
31
37
|
|
|
32
38
|
return {
|
|
@@ -34,8 +40,7 @@ function getWriterOpts () {
|
|
|
34
40
|
title: 'BREAKING CHANGES'
|
|
35
41
|
}
|
|
36
42
|
})
|
|
37
|
-
|
|
38
|
-
let type = commit.type
|
|
43
|
+
let { type } = commit
|
|
39
44
|
|
|
40
45
|
if (commit.type === 'feat') {
|
|
41
46
|
type = 'Features'
|
|
@@ -46,7 +51,7 @@ function getWriterOpts () {
|
|
|
46
51
|
} else if (commit.type === 'revert' || commit.revert) {
|
|
47
52
|
type = 'Reverts'
|
|
48
53
|
} else if (discard) {
|
|
49
|
-
return
|
|
54
|
+
return undefined
|
|
50
55
|
} else if (commit.type === 'docs') {
|
|
51
56
|
type = 'Documentation'
|
|
52
57
|
} else if (commit.type === 'style') {
|
|
@@ -63,16 +68,16 @@ function getWriterOpts () {
|
|
|
63
68
|
|
|
64
69
|
const scope = commit.scope === '*' ? '' : commit.scope
|
|
65
70
|
const shortHash = typeof commit.hash === 'string'
|
|
66
|
-
? commit.hash.substring(0,
|
|
71
|
+
? commit.hash.substring(0, COMMIT_HASH_LENGTH)
|
|
67
72
|
: commit.shortHash
|
|
68
|
-
|
|
69
73
|
const issues = []
|
|
70
|
-
let subject = commit
|
|
74
|
+
let { subject } = commit
|
|
71
75
|
|
|
72
76
|
if (typeof subject === 'string') {
|
|
73
77
|
let url = context.repository
|
|
74
78
|
? `${context.host}/${context.owner}/${context.repository}`
|
|
75
79
|
: context.repoUrl
|
|
80
|
+
|
|
76
81
|
if (url) {
|
|
77
82
|
url = `${url}/issues/`
|
|
78
83
|
// Issue URLs.
|
|
@@ -81,6 +86,7 @@ function getWriterOpts () {
|
|
|
81
86
|
return `[#${issue}](${url}${issue})`
|
|
82
87
|
})
|
|
83
88
|
}
|
|
89
|
+
|
|
84
90
|
if (context.host) {
|
|
85
91
|
// User URLs.
|
|
86
92
|
subject = subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|