Skip to content

Commit d50810a

Browse files
committed
build: update changelog to include perf commits
1 parent aec0078 commit d50810a

File tree

3 files changed

+27
-58
lines changed

3 files changed

+27
-58
lines changed

scripts/templates/changelog-feat.ejs renamed to scripts/templates/changelog-commit.ejs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
<%
2-
if (!hash) {
2+
if (!commit.hash) {
33
return;
44
}
55
6-
const shortSha = hash && hash.slice(0, 7);
6+
const shortSha = commit.hash.slice(0, 7);
77
%>
88
<tr>
99
<%# Commit: %>
1010
<td><%
1111
if (shortSha) {
1212
%>
13-
<a href="https://github.com/angular/angular-cli/commit/<%= hash %>"><img
13+
<a href="https://github.com/angular/angular-cli/commit/<%= commit.hash %>"><img
1414
align="top"
15-
title="Feature" src="https://img.shields.io/badge/<%= shortSha %>-feat-blue.svg" />
15+
title="<%= typeInfo.title %>" src="https://img.shields.io/badge/<%= shortSha %>-<%= commit.type %>-<%= typeInfo.badgeColor %>.svg" />
1616
</a><%
1717
} %>
1818
</td>
1919

2020
<%# Desc: %>
21-
<td><%= subject %></td>
21+
<td><%= commit.subject %></td>
2222

2323
<%# Notes: %>
2424
<td><%
25-
for (const reference of references) {
25+
for (const reference of commit.references) {
2626
if (!reference.action || !reference.issue) {
2727
continue;
2828
}

scripts/templates/changelog-fix.ejs

Lines changed: 0 additions & 40 deletions
This file was deleted.

scripts/templates/changelog.ejs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,29 @@
5555
return aOrder == -1 ? bOrder == -1 ? (a || '').localeCompare(b || '') : 1 : aOrder - bOrder;
5656
});
5757
58-
for (const scope of scopes) {
59-
// Do feature first, then fixes.
60-
const allScopeCommits = commits.filter(x => x.scope === scope);
58+
const ALLOWED_TYPES = {
59+
'feat': {
60+
badgeColor: 'blue',
61+
title: 'Feature',
62+
},
63+
'fix': {
64+
badgeColor: 'green',
65+
title: 'Bug Fix',
66+
},
67+
'perf': {
68+
badgeColor: 'orange',
69+
title: 'Performance Improvement',
70+
},
71+
};
6172
62-
const scopeCommits = [
63-
...allScopeCommits.filter(x => x.type === 'feat'),
64-
...allScopeCommits.filter(x => x.type === 'fix'),
65-
];
73+
for (const scope of scopes) {
74+
const scopeCommits = commits.filter(x => x.scope === scope && !!ALLOWED_TYPES[x.type]);
6675
6776
if (scopeCommits.length == 0) {
6877
continue;
6978
}
79+
80+
scopeCommits.sort((a, b) => a.type - b.type);
7081
%>
7182
<tr><td colspan=3><h3><%
7283
if (scope) {
@@ -83,11 +94,9 @@
8394
<%
8495
let nbRows = 0;
8596
for (const commit of scopeCommits) {
86-
nbRows++;
87-
switch (commit.type) {
88-
case 'fix': %><%= include('./changelog-fix', commit) %><% break;
89-
case 'feat': %><%= include('./changelog-feat', commit) %><% break;
90-
}
97+
nbRows++; %>
98+
<%= include('./changelog-commit', { commit, typeInfo: ALLOWED_TYPES[commit.type] }) %>
99+
<%
91100
}
92101
93102
// Add an empty row to get the alternating colors in sync.

0 commit comments

Comments
 (0)