diff --git a/scripts/templates/changelog-feat.ejs b/scripts/templates/changelog-commit.ejs
similarity index 59%
rename from scripts/templates/changelog-feat.ejs
rename to scripts/templates/changelog-commit.ejs
index d12db7b800ca..9b1049315b1f 100644
--- a/scripts/templates/changelog-feat.ejs
+++ b/scripts/templates/changelog-commit.ejs
@@ -1,28 +1,28 @@
<%
- if (!hash) {
+ if (!commit.hash) {
return;
}
- const shortSha = hash && hash.slice(0, 7);
+ const shortSha = commit.hash.slice(0, 7);
%>
<%# Commit: %>
<%
if (shortSha) {
%>
-![]()
+ title="<%= typeInfo.title %>" src="https://img.shields.io/badge/<%= shortSha %>-<%= commit.type %>-<%= typeInfo.badgeColor %>.svg" />
<%
} %>
|
<%# Desc: %>
- <%= subject %> |
+ <%= commit.subject %> |
<%# Notes: %>
<%
- for (const reference of references) {
+ for (const reference of commit.references) {
if (!reference.action || !reference.issue) {
continue;
}
diff --git a/scripts/templates/changelog-fix.ejs b/scripts/templates/changelog-fix.ejs
deleted file mode 100644
index c7303ff1decb..000000000000
--- a/scripts/templates/changelog-fix.ejs
+++ /dev/null
@@ -1,40 +0,0 @@
-<%
- if (!hash) {
- return;
- }
-
- const shortSha = hash && hash.slice(0, 7);
-%>
- |
- <%# Commit: %>
- <%
- if (shortSha) {
- %>
-
-<%
- } %>
- |
-
- <%# Desc: %>
- <%= subject %> |
-
- <%# Notes: %>
- <%
- for (const reference of references) {
- if (!reference.action || !reference.issue) {
- continue;
- }
-
- const issue = reference.issue;
- const owner = reference.owner || 'angular';
- const repository = reference.repository || 'angular-cli';
- %>
-
-
- [Closes #<%= issue %>]
-
- <% } %>
- |
-
\ No newline at end of file
diff --git a/scripts/templates/changelog.ejs b/scripts/templates/changelog.ejs
index ac72ee5b2d51..70732ed19ca2 100644
--- a/scripts/templates/changelog.ejs
+++ b/scripts/templates/changelog.ejs
@@ -55,18 +55,29 @@
return aOrder == -1 ? bOrder == -1 ? (a || '').localeCompare(b || '') : 1 : aOrder - bOrder;
});
- for (const scope of scopes) {
- // Do feature first, then fixes.
- const allScopeCommits = commits.filter(x => x.scope === scope);
+ const ALLOWED_TYPES = {
+ 'feat': {
+ badgeColor: 'blue',
+ title: 'Feature',
+ },
+ 'fix': {
+ badgeColor: 'green',
+ title: 'Bug Fix',
+ },
+ 'perf': {
+ badgeColor: 'orange',
+ title: 'Performance Improvement',
+ },
+ };
- const scopeCommits = [
- ...allScopeCommits.filter(x => x.type === 'feat'),
- ...allScopeCommits.filter(x => x.type === 'fix'),
- ];
+ for (const scope of scopes) {
+ const scopeCommits = commits.filter(x => x.scope === scope && !!ALLOWED_TYPES[x.type]);
if (scopeCommits.length == 0) {
continue;
}
+
+ scopeCommits.sort((a, b) => a.type - b.type);
%>
<%
if (scope) {
@@ -83,11 +94,9 @@
<%
let nbRows = 0;
for (const commit of scopeCommits) {
- nbRows++;
- switch (commit.type) {
- case 'fix': %><%= include('./changelog-fix', commit) %><% break;
- case 'feat': %><%= include('./changelog-feat', commit) %><% break;
- }
+ nbRows++; %>
+ <%= include('./changelog-commit', { commit, typeInfo: ALLOWED_TYPES[commit.type] }) %>
+ <%
}
// Add an empty row to get the alternating colors in sync.
|