diff --git a/scripts/changelog.ts b/scripts/changelog.ts
index eeb618e584da..88e8c8030bf2 100644
--- a/scripts/changelog.ts
+++ b/scripts/changelog.ts
@@ -10,6 +10,7 @@ import { JsonObject, logging } from '@angular-devkit/core';
import * as fs from 'fs';
import * as path from 'path';
import * as semver from 'semver';
+import { packages } from '../lib/packages';
const changelogTemplate = require('./templates/changelog').default;
@@ -86,6 +87,7 @@ export default function(args: ChangelogOptions, logger: logging.Logger) {
...args,
include: (x: string, v: {}) => require('./' + path.join('templates', x)).default(v),
commits,
+ packages,
});
if (args.stdout || !githubToken) {
diff --git a/scripts/templates/changelog-feat.ejs b/scripts/templates/changelog-feat.ejs
index 041254099408..17ccb75d33cc 100644
--- a/scripts/templates/changelog-feat.ejs
+++ b/scripts/templates/changelog-feat.ejs
@@ -4,20 +4,36 @@
}
const shortSha = hash && hash.slice(0, 7);
-%>| <%# Commit: %><%
+%>
+
+ <%# Commit: %>
+ <%
if (shortSha) {
- %>[](https://github.com/angular/angular-cli/commit/<%= hash %>)<%
- } %><%
-%>| <%# 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 %>](https://github.com/<%= owner %>/<%= repository %>/issues/<%= issue %>)<%
- }
-%>
+ <%# 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-fix.ejs b/scripts/templates/changelog-fix.ejs
index 9ea8af7f98d0..8ccfbe25f919 100644
--- a/scripts/templates/changelog-fix.ejs
+++ b/scripts/templates/changelog-fix.ejs
@@ -4,20 +4,37 @@
}
const shortSha = hash && hash.slice(0, 7);
-%>| <%# Commit: %><%
+%>
+
+ <%# Commit: %>
+ <%
if (shortSha) {
- %>[](https://github.com/angular/angular-cli/commit/<%= hash %>)<%
- } %><%
-%>| <%# 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 %>](https://github.com/<%= owner %>/<%= repository %>/issues/<%= issue %>)<%
- }
-%>
+ <%# 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 25337d7adc45..6dab1fd6906e 100644
--- a/scripts/templates/changelog.ejs
+++ b/scripts/templates/changelog.ejs
@@ -3,6 +3,7 @@
{
from: 'v1.2.3',
to: 'v1.2.4',
+ packages: { /* The PackageInfoMap from "lib/packages.ts" */
// For a commit with description:
// ------------------------------------------------------
// feat(@angular/pwa): add something to this
@@ -29,12 +30,30 @@
],
} ]
}
-%># Commits
+%><%
+ // Sort those packages to the top, in those orders. Others will be sorted alphabetically.
+ const CUSTOM_SORT_ORDER = [
+ '@angular/cli',
+ '@schematics/angular',
+ '@angular-devkit/architect-cli',
+ '@angular-devkit/schematics-cli',
+ ];
+%>
+# Commits
+
+
+
<%
// Get unique scopes.
const scopes = commits.map(x => x.scope)
.sort()
- .filter((v, i, a) => v !== a[i - 1]);
+ .filter((v, i, a) => v !== a[i - 1])
+ .sort((a, b) => {
+ // Sort using the sorting order above, or against each others if undefined.
+ const aOrder = CUSTOM_SORT_ORDER.indexOf(a);
+ const bOrder = CUSTOM_SORT_ORDER.indexOf(b);
+ return aOrder == -1 ? bOrder == -1 ? (a || '').localeCompare(b || '') : 1 : aOrder - bOrder;
+ });
for (const scope of scopes) {
const scopeCommits = commits
@@ -45,19 +64,35 @@
continue;
}
%>
-## `<%= scope || 'Misc' %>`
-
-| Commit | Description | Notes |
-|:------:| ----------- | -----:|
+<%
+ if (scope) {
+ %><%= scope %> (<%= packages[scope].version %>)<%
+ } else {
+ %>Misc<%
+ }
+%> |
+
+ Commit
+ | Description
+ | Notes
+ |
<%
+ 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;
}
}
-%>
+
+ // Add an empty row to get the alternating colors in sync.
+ if (scope != scopes[scopes.length - 1] && nbRows % 2) { %>
+
+ <% } %>
<% } %>
+
+
----