conventional-changelog-angular 7.0.0 → 8.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/README.md +15 -1
- package/package.json +16 -19
- package/src/index.js +15 -0
- package/{parserOpts.js → src/parser.js} +2 -6
- package/src/whatBump.js +25 -0
- package/src/writer.js +120 -0
- package/conventionalChangelog.js +0 -10
- package/conventionalRecommendedBump.js +0 -34
- package/index.js +0 -22
- package/writerOpts.js +0 -110
- /package/{templates → src/templates}/commit.hbs +0 -0
- /package/{templates → src/templates}/footer.hbs +0 -0
- /package/{templates → src/templates}/header.hbs +0 -0
- /package/{templates → src/templates}/template.hbs +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# conventional-changelog-angular
|
|
2
2
|
|
|
3
|
+
[![ESM-only package][package]][package-url]
|
|
3
4
|
[![NPM version][npm]][npm-url]
|
|
4
5
|
[![Node version][node]][node-url]
|
|
5
6
|
[![Dependencies status][deps]][deps-url]
|
|
7
|
+
[![Install size][size]][size-url]
|
|
6
8
|
[![Build status][build]][build-url]
|
|
7
9
|
[![Coverage status][coverage]][coverage-url]
|
|
8
10
|
|
|
11
|
+
[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
|
|
12
|
+
[package-url]: https://nodejs.org/api/esm.html
|
|
13
|
+
|
|
9
14
|
[npm]: https://img.shields.io/npm/v/conventional-changelog-angular.svg
|
|
10
15
|
[npm-url]: https://npmjs.com/package/conventional-changelog-angular
|
|
11
16
|
|
|
@@ -15,7 +20,10 @@
|
|
|
15
20
|
[deps]: https://img.shields.io/librariesio/release/npm/conventional-changelog-angular
|
|
16
21
|
[deps-url]: https://libraries.io/npm/conventional-changelog-angular/tree
|
|
17
22
|
|
|
18
|
-
[
|
|
23
|
+
[size]: https://packagephobia.com/badge?p=conventional-changelog-angular
|
|
24
|
+
[size-url]: https://packagephobia.com/result?p=conventional-changelog-angular
|
|
25
|
+
|
|
26
|
+
[build]: https://img.shields.io/github/actions/workflow/status/conventional-changelog/conventional-changelog/tests.yaml?branch=master
|
|
19
27
|
[build-url]: https://github.com/conventional-changelog/conventional-changelog/actions
|
|
20
28
|
|
|
21
29
|
[coverage]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
|
|
@@ -124,3 +132,9 @@ reference GitHub issues that this commit **Closes**.
|
|
|
124
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.
|
|
125
133
|
|
|
126
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
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conventional-changelog-angular",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "8.1.0",
|
|
5
|
+
"description": "Angular preset for conventional-changelog.",
|
|
6
|
+
"author": "Steve Mao",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme",
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/conventional-changelog/conventional-changelog.git"
|
|
11
|
+
"url": "https://github.com/conventional-changelog/conventional-changelog.git",
|
|
12
|
+
"directory": "packages/conventional-changelog-angular"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/conventional-changelog/conventional-changelog/issues"
|
|
9
16
|
},
|
|
10
17
|
"keywords": [
|
|
11
18
|
"conventional-changelog",
|
|
12
19
|
"angular",
|
|
13
20
|
"preset"
|
|
14
21
|
],
|
|
15
|
-
"files": [
|
|
16
|
-
"conventionalChangelog.js",
|
|
17
|
-
"conventionalRecommendedBump.js",
|
|
18
|
-
"index.js",
|
|
19
|
-
"parserOpts.js",
|
|
20
|
-
"writerOpts.js",
|
|
21
|
-
"templates"
|
|
22
|
-
],
|
|
23
|
-
"author": "Steve Mao",
|
|
24
22
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
26
|
-
},
|
|
27
|
-
"license": "ISC",
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/conventional-changelog/conventional-changelog/issues"
|
|
23
|
+
"node": ">=18"
|
|
30
24
|
},
|
|
31
|
-
"
|
|
25
|
+
"exports": "./src/index.js",
|
|
26
|
+
"files": [
|
|
27
|
+
"src"
|
|
28
|
+
],
|
|
32
29
|
"dependencies": {
|
|
33
30
|
"compare-func": "^2.0.0"
|
|
34
31
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createParserOpts } from './parser.js'
|
|
2
|
+
import { createWriterOpts } from './writer.js'
|
|
3
|
+
import { whatBump } from './whatBump.js'
|
|
4
|
+
|
|
5
|
+
export default async function createPreset(config) {
|
|
6
|
+
return {
|
|
7
|
+
commits: {
|
|
8
|
+
ignore: config?.ignoreCommits,
|
|
9
|
+
merges: false
|
|
10
|
+
},
|
|
11
|
+
parser: createParserOpts(),
|
|
12
|
+
writer: await createWriterOpts(),
|
|
13
|
+
whatBump
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function createParserOpts () {
|
|
1
|
+
export function createParserOpts() {
|
|
4
2
|
return {
|
|
5
3
|
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
|
|
6
4
|
headerCorrespondence: [
|
|
@@ -9,9 +7,7 @@ function createParserOpts () {
|
|
|
9
7
|
'subject'
|
|
10
8
|
],
|
|
11
9
|
noteKeywords: ['BREAKING CHANGE'],
|
|
12
|
-
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w
|
|
10
|
+
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w{7,40})\b/i,
|
|
13
11
|
revertCorrespondence: ['header', 'hash']
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
module.exports.createParserOpts = createParserOpts
|
package/src/whatBump.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function whatBump(commits) {
|
|
2
|
+
let level = 2
|
|
3
|
+
let breakings = 0
|
|
4
|
+
let features = 0
|
|
5
|
+
|
|
6
|
+
commits.forEach((commit) => {
|
|
7
|
+
if (commit.notes.length > 0) {
|
|
8
|
+
breakings += commit.notes.length
|
|
9
|
+
level = 0
|
|
10
|
+
} else if (commit.type === 'feat') {
|
|
11
|
+
features += 1
|
|
12
|
+
|
|
13
|
+
if (level === 2) {
|
|
14
|
+
level = 1
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
level,
|
|
21
|
+
reason: breakings === 1
|
|
22
|
+
? `There is ${breakings} BREAKING CHANGE and ${features} features`
|
|
23
|
+
: `There are ${breakings} BREAKING CHANGES and ${features} features`
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/writer.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { readFile } from 'fs/promises'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
import { fileURLToPath } from 'url'
|
|
4
|
+
import compareFunc from 'compare-func'
|
|
5
|
+
|
|
6
|
+
const dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
7
|
+
const COMMIT_HASH_LENGTH = 7
|
|
8
|
+
|
|
9
|
+
export async function createWriterOpts() {
|
|
10
|
+
const [
|
|
11
|
+
template,
|
|
12
|
+
header,
|
|
13
|
+
commit,
|
|
14
|
+
footer
|
|
15
|
+
] = await Promise.all([
|
|
16
|
+
readFile(resolve(dirname, './templates/template.hbs'), 'utf-8'),
|
|
17
|
+
readFile(resolve(dirname, './templates/header.hbs'), 'utf-8'),
|
|
18
|
+
readFile(resolve(dirname, './templates/commit.hbs'), 'utf-8'),
|
|
19
|
+
readFile(resolve(dirname, './templates/footer.hbs'), 'utf-8')
|
|
20
|
+
])
|
|
21
|
+
const writerOpts = getWriterOpts()
|
|
22
|
+
|
|
23
|
+
writerOpts.mainTemplate = template
|
|
24
|
+
writerOpts.headerPartial = header
|
|
25
|
+
writerOpts.commitPartial = commit
|
|
26
|
+
writerOpts.footerPartial = footer
|
|
27
|
+
|
|
28
|
+
return writerOpts
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getWriterOpts() {
|
|
32
|
+
return {
|
|
33
|
+
transform: (commit, context) => {
|
|
34
|
+
let discard = true
|
|
35
|
+
const notes = commit.notes.map((note) => {
|
|
36
|
+
discard = false
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
...note,
|
|
40
|
+
title: 'BREAKING CHANGES'
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
let { type } = commit
|
|
44
|
+
|
|
45
|
+
if (commit.type === 'feat') {
|
|
46
|
+
type = 'Features'
|
|
47
|
+
} else if (commit.type === 'fix') {
|
|
48
|
+
type = 'Bug Fixes'
|
|
49
|
+
} else if (commit.type === 'perf') {
|
|
50
|
+
type = 'Performance Improvements'
|
|
51
|
+
} else if (commit.type === 'revert' || commit.revert) {
|
|
52
|
+
type = 'Reverts'
|
|
53
|
+
} else if (discard) {
|
|
54
|
+
return undefined
|
|
55
|
+
} else if (commit.type === 'docs') {
|
|
56
|
+
type = 'Documentation'
|
|
57
|
+
} else if (commit.type === 'style') {
|
|
58
|
+
type = 'Styles'
|
|
59
|
+
} else if (commit.type === 'refactor') {
|
|
60
|
+
type = 'Code Refactoring'
|
|
61
|
+
} else if (commit.type === 'test') {
|
|
62
|
+
type = 'Tests'
|
|
63
|
+
} else if (commit.type === 'build') {
|
|
64
|
+
type = 'Build System'
|
|
65
|
+
} else if (commit.type === 'ci') {
|
|
66
|
+
type = 'Continuous Integration'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const scope = commit.scope === '*' ? '' : commit.scope
|
|
70
|
+
const shortHash = typeof commit.hash === 'string'
|
|
71
|
+
? commit.hash.substring(0, COMMIT_HASH_LENGTH)
|
|
72
|
+
: commit.shortHash
|
|
73
|
+
const issues = []
|
|
74
|
+
let { subject } = commit
|
|
75
|
+
|
|
76
|
+
if (typeof subject === 'string') {
|
|
77
|
+
let url = context.repository
|
|
78
|
+
? `${context.host}/${context.owner}/${context.repository}`
|
|
79
|
+
: context.repoUrl
|
|
80
|
+
|
|
81
|
+
if (url) {
|
|
82
|
+
url = `${url}/issues/`
|
|
83
|
+
// Issue URLs.
|
|
84
|
+
subject = subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
85
|
+
issues.push(issue)
|
|
86
|
+
return `[#${issue}](${url}${issue})`
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (context.host) {
|
|
91
|
+
// User URLs.
|
|
92
|
+
subject = subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
|
93
|
+
if (username.includes('/')) {
|
|
94
|
+
return `@${username}`
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return `[@${username}](${context.host}/${username})`
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// remove references that already appear in the subject
|
|
103
|
+
const references = commit.references.filter(reference => !issues.includes(reference.issue))
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
notes,
|
|
107
|
+
type,
|
|
108
|
+
scope,
|
|
109
|
+
shortHash,
|
|
110
|
+
subject,
|
|
111
|
+
references
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
groupBy: 'type',
|
|
115
|
+
commitGroupsSort: 'title',
|
|
116
|
+
commitsSort: ['scope', 'subject'],
|
|
117
|
+
noteGroupsSort: 'title',
|
|
118
|
+
notesSort: compareFunc
|
|
119
|
+
}
|
|
120
|
+
}
|
package/conventionalChangelog.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
function createConventionalRecommendedBumpOpts (parserOpts) {
|
|
4
|
-
return {
|
|
5
|
-
parserOpts,
|
|
6
|
-
|
|
7
|
-
whatBump (commits) {
|
|
8
|
-
let level = 2
|
|
9
|
-
let breakings = 0
|
|
10
|
-
let features = 0
|
|
11
|
-
|
|
12
|
-
commits.forEach(commit => {
|
|
13
|
-
if (commit.notes.length > 0) {
|
|
14
|
-
breakings += commit.notes.length
|
|
15
|
-
level = 0
|
|
16
|
-
} else if (commit.type === 'feat') {
|
|
17
|
-
features += 1
|
|
18
|
-
if (level === 2) {
|
|
19
|
-
level = 1
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
level,
|
|
26
|
-
reason: breakings === 1
|
|
27
|
-
? `There is ${breakings} BREAKING CHANGE and ${features} features`
|
|
28
|
-
: `There are ${breakings} BREAKING CHANGES and ${features} features`
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports.createConventionalRecommendedBumpOpts = createConventionalRecommendedBumpOpts
|
package/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { createParserOpts } = require('./parserOpts')
|
|
4
|
-
const { createWriterOpts } = require('./writerOpts')
|
|
5
|
-
const { createConventionalChangelogOpts } = require('./conventionalChangelog')
|
|
6
|
-
const { createConventionalRecommendedBumpOpts } = require('./conventionalRecommendedBump')
|
|
7
|
-
|
|
8
|
-
async function createPreset () {
|
|
9
|
-
const parserOpts = createParserOpts()
|
|
10
|
-
const writerOpts = await createWriterOpts()
|
|
11
|
-
const recommendedBumpOpts = createConventionalRecommendedBumpOpts(parserOpts)
|
|
12
|
-
const conventionalChangelog = createConventionalChangelogOpts(parserOpts, writerOpts)
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
parserOpts,
|
|
16
|
-
writerOpts,
|
|
17
|
-
recommendedBumpOpts,
|
|
18
|
-
conventionalChangelog
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = createPreset
|
package/writerOpts.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const compareFunc = require('compare-func')
|
|
4
|
-
const { readFile } = require('fs').promises
|
|
5
|
-
const { resolve } = require('path')
|
|
6
|
-
|
|
7
|
-
async function createWriterOpts () {
|
|
8
|
-
const [template, header, commit, footer] = await Promise.all([
|
|
9
|
-
readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'),
|
|
10
|
-
readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'),
|
|
11
|
-
readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8'),
|
|
12
|
-
readFile(resolve(__dirname, './templates/footer.hbs'), 'utf-8')
|
|
13
|
-
])
|
|
14
|
-
const writerOpts = getWriterOpts()
|
|
15
|
-
|
|
16
|
-
writerOpts.mainTemplate = template
|
|
17
|
-
writerOpts.headerPartial = header
|
|
18
|
-
writerOpts.commitPartial = commit
|
|
19
|
-
writerOpts.footerPartial = footer
|
|
20
|
-
|
|
21
|
-
return writerOpts
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports.createWriterOpts = createWriterOpts
|
|
25
|
-
|
|
26
|
-
function getWriterOpts () {
|
|
27
|
-
return {
|
|
28
|
-
transform: (commit, context) => {
|
|
29
|
-
let discard = true
|
|
30
|
-
const issues = []
|
|
31
|
-
|
|
32
|
-
commit.notes.forEach(note => {
|
|
33
|
-
note.title = 'BREAKING CHANGES'
|
|
34
|
-
discard = false
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
if (commit.type === 'feat') {
|
|
38
|
-
commit.type = 'Features'
|
|
39
|
-
} else if (commit.type === 'fix') {
|
|
40
|
-
commit.type = 'Bug Fixes'
|
|
41
|
-
} else if (commit.type === 'perf') {
|
|
42
|
-
commit.type = 'Performance Improvements'
|
|
43
|
-
} else if (commit.type === 'revert' || commit.revert) {
|
|
44
|
-
commit.type = 'Reverts'
|
|
45
|
-
} else if (discard) {
|
|
46
|
-
return
|
|
47
|
-
} else if (commit.type === 'docs') {
|
|
48
|
-
commit.type = 'Documentation'
|
|
49
|
-
} else if (commit.type === 'style') {
|
|
50
|
-
commit.type = 'Styles'
|
|
51
|
-
} else if (commit.type === 'refactor') {
|
|
52
|
-
commit.type = 'Code Refactoring'
|
|
53
|
-
} else if (commit.type === 'test') {
|
|
54
|
-
commit.type = 'Tests'
|
|
55
|
-
} else if (commit.type === 'build') {
|
|
56
|
-
commit.type = 'Build System'
|
|
57
|
-
} else if (commit.type === 'ci') {
|
|
58
|
-
commit.type = 'Continuous Integration'
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (commit.scope === '*') {
|
|
62
|
-
commit.scope = ''
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (typeof commit.hash === 'string') {
|
|
66
|
-
commit.shortHash = commit.hash.substring(0, 7)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (typeof commit.subject === 'string') {
|
|
70
|
-
let url = context.repository
|
|
71
|
-
? `${context.host}/${context.owner}/${context.repository}`
|
|
72
|
-
: context.repoUrl
|
|
73
|
-
if (url) {
|
|
74
|
-
url = `${url}/issues/`
|
|
75
|
-
// Issue URLs.
|
|
76
|
-
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
77
|
-
issues.push(issue)
|
|
78
|
-
return `[#${issue}](${url}${issue})`
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
if (context.host) {
|
|
82
|
-
// User URLs.
|
|
83
|
-
commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
|
84
|
-
if (username.includes('/')) {
|
|
85
|
-
return `@${username}`
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return `[@${username}](${context.host}/${username})`
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// remove references that already appear in the subject
|
|
94
|
-
commit.references = commit.references.filter(reference => {
|
|
95
|
-
if (issues.indexOf(reference.issue) === -1) {
|
|
96
|
-
return true
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return false
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
return commit
|
|
103
|
-
},
|
|
104
|
-
groupBy: 'type',
|
|
105
|
-
commitGroupsSort: 'title',
|
|
106
|
-
commitsSort: ['scope', 'subject'],
|
|
107
|
-
noteGroupsSort: 'title',
|
|
108
|
-
notesSort: compareFunc
|
|
109
|
-
}
|
|
110
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|