conventional-changelog-angular 8.2.0 → 8.3.1
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/package.json +1 -1
- package/src/index.js +2 -2
- package/src/{templates/commit.hbs → templates.js} +58 -1
- package/src/writer.js +16 -28
- package/src/templates/footer.hbs +0 -11
- package/src/templates/header.hbs +0 -25
- package/src/templates/template.hbs +0 -14
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import { createParserOpts } from './parser.js'
|
|
|
2
2
|
import { createWriterOpts } from './writer.js'
|
|
3
3
|
import { whatBump } from './whatBump.js'
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default function createPreset(config) {
|
|
6
6
|
return {
|
|
7
7
|
commits: {
|
|
8
8
|
ignore: config?.ignoreCommits,
|
|
9
9
|
merges: false
|
|
10
10
|
},
|
|
11
11
|
parser: createParserOpts(),
|
|
12
|
-
writer:
|
|
12
|
+
writer: createWriterOpts(),
|
|
13
13
|
whatBump
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,4 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
export const mainTemplate = `{{> header}}
|
|
2
|
+
|
|
3
|
+
{{#each commitGroups}}
|
|
4
|
+
|
|
5
|
+
{{#if title}}
|
|
6
|
+
### {{title}}
|
|
7
|
+
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#each commits}}
|
|
10
|
+
{{> commit root=@root}}
|
|
11
|
+
{{/each}}
|
|
12
|
+
|
|
13
|
+
{{/each}}
|
|
14
|
+
{{> footer}}
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
export const headerPartial = `{{#if isPatch~}}
|
|
18
|
+
##
|
|
19
|
+
{{~else~}}
|
|
20
|
+
#
|
|
21
|
+
{{~/if}} {{#if @root.linkCompare~}}
|
|
22
|
+
[{{version}}](
|
|
23
|
+
{{~#if @root.repository~}}
|
|
24
|
+
{{~#if @root.host}}
|
|
25
|
+
{{~@root.host}}/
|
|
26
|
+
{{~/if}}
|
|
27
|
+
{{~#if @root.owner}}
|
|
28
|
+
{{~@root.owner}}/
|
|
29
|
+
{{~/if}}
|
|
30
|
+
{{~@root.repository}}
|
|
31
|
+
{{~else}}
|
|
32
|
+
{{~@root.repoUrl}}
|
|
33
|
+
{{~/if~}}
|
|
34
|
+
/compare/{{previousTag}}...{{currentTag}})
|
|
35
|
+
{{~else}}
|
|
36
|
+
{{~version}}
|
|
37
|
+
{{~/if}}
|
|
38
|
+
{{~#if title}} "{{title}}"
|
|
39
|
+
{{~/if}}
|
|
40
|
+
{{~#if date}} ({{date}})
|
|
41
|
+
{{/if}}
|
|
42
|
+
`
|
|
43
|
+
|
|
44
|
+
export const commitPartial = `*{{#if scope}} **{{scope}}:**
|
|
2
45
|
{{~/if}} {{#if subject}}
|
|
3
46
|
{{~subject}}
|
|
4
47
|
{{~else}}
|
|
@@ -59,3 +102,17 @@
|
|
|
59
102
|
{{~/if}}{{/each}}
|
|
60
103
|
{{~/if}}
|
|
61
104
|
|
|
105
|
+
`
|
|
106
|
+
|
|
107
|
+
export const footerPartial = `{{#if noteGroups}}
|
|
108
|
+
{{#each noteGroups}}
|
|
109
|
+
|
|
110
|
+
### {{title}}
|
|
111
|
+
|
|
112
|
+
{{#each notes}}
|
|
113
|
+
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
|
|
114
|
+
{{/each}}
|
|
115
|
+
{{/each}}
|
|
116
|
+
|
|
117
|
+
{{/if}}
|
|
118
|
+
`
|
package/src/writer.js
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises'
|
|
2
|
-
import { resolve } from 'path'
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
1
|
import compareFunc from 'compare-func'
|
|
2
|
+
import {
|
|
3
|
+
mainTemplate,
|
|
4
|
+
headerPartial,
|
|
5
|
+
commitPartial,
|
|
6
|
+
footerPartial
|
|
7
|
+
} from './templates.js'
|
|
5
8
|
|
|
6
|
-
const dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
7
9
|
const COMMIT_HASH_LENGTH = 7
|
|
8
10
|
|
|
9
|
-
export
|
|
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() {
|
|
11
|
+
export function createWriterOpts() {
|
|
32
12
|
return {
|
|
13
|
+
mainTemplate,
|
|
14
|
+
headerPartial,
|
|
15
|
+
commitPartial,
|
|
16
|
+
footerPartial,
|
|
33
17
|
transform: (commit, context) => {
|
|
34
18
|
let discard = true
|
|
35
19
|
const notes = commit.notes.map((note) => {
|
|
@@ -89,7 +73,11 @@ function getWriterOpts() {
|
|
|
89
73
|
|
|
90
74
|
if (context.host) {
|
|
91
75
|
// User URLs.
|
|
92
|
-
subject = subject.replace(
|
|
76
|
+
subject = subject.replace(/`[^`]*`|\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (match, username) => {
|
|
77
|
+
if (!username) {
|
|
78
|
+
return match
|
|
79
|
+
}
|
|
80
|
+
|
|
93
81
|
if (username.includes('/')) {
|
|
94
82
|
return `@${username}`
|
|
95
83
|
}
|
package/src/templates/footer.hbs
DELETED
package/src/templates/header.hbs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{{#if isPatch~}}
|
|
2
|
-
##
|
|
3
|
-
{{~else~}}
|
|
4
|
-
#
|
|
5
|
-
{{~/if}} {{#if @root.linkCompare~}}
|
|
6
|
-
[{{version}}](
|
|
7
|
-
{{~#if @root.repository~}}
|
|
8
|
-
{{~#if @root.host}}
|
|
9
|
-
{{~@root.host}}/
|
|
10
|
-
{{~/if}}
|
|
11
|
-
{{~#if @root.owner}}
|
|
12
|
-
{{~@root.owner}}/
|
|
13
|
-
{{~/if}}
|
|
14
|
-
{{~@root.repository}}
|
|
15
|
-
{{~else}}
|
|
16
|
-
{{~@root.repoUrl}}
|
|
17
|
-
{{~/if~}}
|
|
18
|
-
/compare/{{previousTag}}...{{currentTag}})
|
|
19
|
-
{{~else}}
|
|
20
|
-
{{~version}}
|
|
21
|
-
{{~/if}}
|
|
22
|
-
{{~#if title}} "{{title}}"
|
|
23
|
-
{{~/if}}
|
|
24
|
-
{{~#if date}} ({{date}})
|
|
25
|
-
{{/if}}
|