-
Notifications
You must be signed in to change notification settings - Fork 2
/
.auto-changelog-template.hbs
176 lines (144 loc) · 9.47 KB
/
.auto-changelog-template.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Changelog
{{!--
Introduction
• This template tries to follow conventional commits format https://www.conventionalcommits.org/en/v1.0.0/
• The template uses regex to filter commit types into their own headings (this is more than just fixes and features headings)
• It also uses the replaceText function in package.json to remove the commit type text from the message, because the headers are shown instead.
• The text 'Breaking:' or 'Breaking changes:' can be located anywhere in the commit.
• The types feat:, fix:, chore:, docs:, refactor:, test:, style:, perf: must be at the beginning of the commit subject with an : on end.
• They can optionally have a scope set to outline the module or component that is affected eg feat(bldAssess):
• There is a short hash on the end of every commit that is currently commented out so that change log did not grow too long (due to some system's file size limitations). You can uncomment if you wish [`{{shorthash}}`]({{href}})
Example Definitions
• feat: A new feature
• fix: A bug fix
• perf: A code change that improves performance
• refactor: A code change that neither fixes a bug nor adds a feature
• style: Changes that do not affect the meaning of the code (white-space, formatting, spelling mistakes, missing semi-colons, etc)
• test: Adding missing tests or correcting existing tests
• docs: Adding/updating documentation
• chore: Something like updating a library version, or moving files to be in a better location and updating all file refs
--}}
{{!-- In package.json need to add this to remove label text from the change log output (because the markdown headers are now used to group them).
NOTES • Individual brackets have been escaped twice to be Json compliant.
• For items that define a scope eg feat(bldAssess): We remove the 1st bracket and then re-add it so we can select the right piece of text
{
"name": "my-awesome-package",
"auto-changelog": {
"replaceText": {
"([bB]reaking:)": "",
"([bB]reaking change:)": "",
"(^[fF]eat:)": "",
"(^[fF]eat\\()": "\\(",
"(^[fF]ix:)": "",
"(^[fF]ix\\()": "\\(",
"(^[cC]hore:)": "",
"(^[cC]hore\\()": "\\(",
"(^[dD]ocs:)": "",
"(^[dD]ocs\\()": "\\(",
"(^[rR]efactor:)": "",
"(^[rR]efactor\\()": "\\(",
"(^[tT]est:)": "",
"(^[tT]est\\()": "\\(",
"(^[sS]tyle:)": "",
"(^[sS]tyle\\()": "\\(",
"(^[pP]erf:)": "",
"(^[pP]erf\\()": "\\("
}
}
}
--}}
{{!--
Regex reminders
^ = starts with
\( = ( character (otherwise it is interpreted as a regex lookup group)
* = zero or more of the previous character
\s = whitespace
. = any character except newline
| = or
[aA] = charcter a or character A
--}}
{{#each releases}}
{{#if href}}
## [{{title}}]({{href}})
{{else}}
## {{title}}
{{/if}}
> {{niceDate}}
{{#if summary}}
{{summary}}
{{/if}}
{{! List commits that fix a given issues}}
{{#each fixes}}
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}}{{#each fixes}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}}){{/each}}
{{/each}}
{{! List commits with 'breaking:' or 'Breaking change:' anywhere in the message under a heading}}
{{#commit-list merges heading='### Breaking Changes :warning:' message='[bB]reaking [cC]hange:|[bB]reaking:' exclude='\[skip-changelog\]'}}
- {{message}} @{{author}} <!--[`#{{id}}`]({{href}}) -->
{{/commit-list}}
{{! List commits organised under a heading, but not those already listed in the breaking section }}
{{#commit-list merges heading='### New Features' message='^[fF]eat:|[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Fixes' message='^[fF]ix:|^[fF]ix\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Chores And Housekeeping' message='^[cC]hore:|^[cC]hore\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Documentation Changes' message='^[dD]ocs:|^[dD]ocs\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Refactoring and Updates' message='^[rR]efactor:|^[rR]efactor\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Changes to Test Assests' message='^[tT]est:|^[tT]est\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Tidying of Code eg Whitespace' message='^[sS]tyle:|^[sS]tyle\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Performance Improvements' message='^[pP]erf:|^[pP]erf\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### CI Improvements' message='^[cC][iI]:|^[cC][iI]\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list merges heading='### Uncategorized Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}
{{! List commits with 'breaking:' or 'Breaking change:' anywhere in the message under a heading}}
{{#commit-list commits heading='### Breaking Changes :warning:' message='[bB]reaking [cC]hange:|[bB]reaking:' exclude='\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{! List commits organised under a heading, but not those already listed in the breaking section }}
{{#commit-list commits heading='### New Features' message='^[fF]eat:|[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Fixes' message='^[fF]ix:|^[fF]ix\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Chores And Housekeeping' message='^[cC]hore:|^[cC]hore\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Documentation Changes' message='^[dD]ocs:|^[dD]ocs\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Refactoring and Updates' message='^[rR]efactor:|^[rR]efactor\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Changes to Test Assests' message='^[tT]est:|^[tT]est\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Tidying of Code eg Whitespace' message='^[sS]tyle:|^[sS]tyle\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Performance Improvements' message='^[pP]erf:|^[pP]erf\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### CI Improvements' message='^[cC][iI]:|^[cC][iI]\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{#commit-list commits heading='### Uncategorized Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}
{{/each}}