Skip to content

Commit

Permalink
fix(ng-dev): update changelog generation templates (#1089)
Browse files Browse the repository at this point in the history
Remove the special thanks section and reorder the github release notes for better banner generation.

PR Close #1089
  • Loading branch information
josephperrott committed Apr 10, 2023
1 parent 8b60c89 commit 7dc7d13
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 162 deletions.
73 changes: 16 additions & 57 deletions .github/local-actions/changelog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -64804,13 +64804,6 @@ function compareString(a, b) {

//
var typesToIncludeInReleaseNotes = Object.values(COMMIT_TYPES).filter((type) => type.releaseNotesLevel === ReleaseNotesLevel.Visible).map((type) => type.name);
var botsAuthorNames = [
"dependabot[bot]",
"Renovate Bot",
"angular-robot",
"angular-robot[bot]",
"Angular Robot"
];
var RenderContext = class {
constructor(data) {
this.data = data;
Expand Down Expand Up @@ -64902,9 +64895,6 @@ var RenderContext = class {
bulletizeText(text) {
return "- " + text.replace(/\n/g, "\n ");
}
commitAuthors(commits) {
return [...new Set(commits.map((c) => c.author))].filter((a) => !botsAuthorNames.includes(a)).sort();
}
commitToBadge(commit) {
let color = "yellow";
switch (commit.type) {
Expand Down Expand Up @@ -64997,27 +64987,29 @@ _%>
}
_%>

`;

//
var github_release_default = `
<a name="<%- urlFragmentForRelease %>"></a>
# <%- version %><% if (title) { %> "<%- title %>"<% } %> (<%- dateStamp %>)

<%_
const authors = commitAuthors(commits);
if (authors.length === 1) {
const commitsInChangelog = commits.filter(includeInReleaseNotes());
for (const group of asCommitGroups(commitsInChangelog)) {
_%>
## Special Thanks
<%- authors[0]%>

### <%- group.title %>
| Commit | Description |
| -- | -- |
<%_
}
if (authors.length > 1) {
for (const commit of group.commits) {
_%>
## Special Thanks
<%- authors.slice(0, -1).join(', ') %> and <%- authors.slice(-1)[0] %>
| <%- commitToBadge(commit) %> | <%- commit.description %> |
<%_
}
}
_%>
`;

//
var github_release_default = `
<a name="<%- urlFragmentForRelease %>"></a>
# <%- version %><% if (title) { %> "<%- title %>"<% } %> (<%- dateStamp %>)

<%_
const breakingChanges = commits.filter(hasBreakingChanges);
Expand Down Expand Up @@ -65061,39 +65053,6 @@ _%>
}
}
_%>

<%_
const commitsInChangelog = commits.filter(includeInReleaseNotes());
for (const group of asCommitGroups(commitsInChangelog)) {
_%>

### <%- group.title %>
| Commit | Description |
| -- | -- |
<%_
for (const commit of group.commits) {
_%>
| <%- commitToBadge(commit) %> | <%- commit.description %> |
<%_
}
}
_%>

<%_
const authors = commitAuthors(commits);
if (authors.length === 1) {
_%>
## Special Thanks
<%- authors[0]%>
<%_
}
if (authors.length > 1) {
_%>
## Special Thanks
<%- authors.slice(0, -1).join(', ') %> and <%- authors.slice(-1)[0] %>
<%_
}
_%>
`;

//
Expand Down
9 changes: 0 additions & 9 deletions ng-dev/release/notes/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,6 @@ export class RenderContext {
return '- ' + text.replace(/\n/g, '\n ');
}

/**
* Returns unique, sorted and filtered commit authors.
*/
commitAuthors(commits: CategorizedCommit[]): string[] {
return [...new Set(commits.map((c) => c.author))]
.filter((a) => !botsAuthorNames.includes(a))
.sort();
}

/**
* Convert a commit object to a Markdown linked badged.
*/
Expand Down
15 changes: 0 additions & 15 deletions ng-dev/release/notes/templates/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,4 @@ _%>
}
_%>
<%_
const authors = commitAuthors(commits);
if (authors.length === 1) {
_%>
## Special Thanks
<%- authors[0]%>
<%_
}
if (authors.length > 1) {
_%>
## Special Thanks
<%- authors.slice(0, -1).join(', ') %> and <%- authors.slice(-1)[0] %>
<%_
}
_%>
`;
50 changes: 17 additions & 33 deletions ng-dev/release/notes/templates/github-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ export default `
<a name="<%- urlFragmentForRelease %>"></a>
# <%- version %><% if (title) { %> "<%- title %>"<% } %> (<%- dateStamp %>)
<%_
const commitsInChangelog = commits.filter(includeInReleaseNotes());
for (const group of asCommitGroups(commitsInChangelog)) {
_%>
### <%- group.title %>
| Commit | Description |
| -- | -- |
<%_
for (const commit of group.commits) {
_%>
| <%- commitToBadge(commit) %> | <%- commit.description %> |
<%_
}
}
_%>
<%_
const breakingChanges = commits.filter(hasBreakingChanges);
if (breakingChanges.length) {
Expand Down Expand Up @@ -52,37 +69,4 @@ _%>
}
}
_%>
<%_
const commitsInChangelog = commits.filter(includeInReleaseNotes());
for (const group of asCommitGroups(commitsInChangelog)) {
_%>
### <%- group.title %>
| Commit | Description |
| -- | -- |
<%_
for (const commit of group.commits) {
_%>
| <%- commitToBadge(commit) %> | <%- commit.description %> |
<%_
}
}
_%>
<%_
const authors = commitAuthors(commits);
if (authors.length === 1) {
_%>
## Special Thanks
<%- authors[0]%>
<%_
}
if (authors.length > 1) {
_%>
## Special Thanks
<%- authors.slice(0, -1).join(', ') %> and <%- authors.slice(-1)[0] %>
<%_
}
_%>
`;
1 change: 0 additions & 1 deletion ng-dev/release/publish/test/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ describe('common release action logic', () => {
| -- | -- |
| <..> | first commit |
| <..> | second commit |
## Special Thanks
`,
);

Expand Down
1 change: 0 additions & 1 deletion ng-dev/release/publish/test/cut-lts-patch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ describe('cut an LTS patch action', () => {
| -- | -- | -- |
| <..> | feat | not yet released *1 |
| <..> | feat | not yet released *2 |
## Special Thanks
`);
});

Expand Down
1 change: 0 additions & 1 deletion ng-dev/release/publish/test/cut-new-patch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ describe('cut new patch action', () => {
| -- | -- | -- |
| <..> | feat | not yet released *1 |
| <..> | feat | not yet released *2 |
## Special Thanks
`);
});
});
4 changes: 1 addition & 3 deletions ng-dev/release/publish/test/cut-npm-next-prerelease.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('cut npm next pre-release action', () => {
| <..> | feat | not released yet, but cherry-picked |
| <..> | feat | only in next, not released yet *1 |
| <..> | feat | only in next, not released yet *2 |
## Special Thanks
`);
},
);
Expand Down Expand Up @@ -181,7 +181,6 @@ describe('cut npm next pre-release action', () => {
| -- | -- | -- |
| <..> | feat | not released yet *1 |
| <..> | feat | not released yet *2 |
## Special Thanks
`);
});
});
Expand Down Expand Up @@ -238,7 +237,6 @@ describe('cut npm next pre-release action', () => {
| -- | -- | -- |
| <..> | feat | not released yet *1 |
| <..> | feat | not released yet *2 |
## Special Thanks
`);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ describe('cut npm next release candidate action', () => {
| -- | -- | -- |
| <..> | feat | not yet released *1 |
| <..> | fix | not yet released *2 |
## Special Thanks
`);
});
});
2 changes: 0 additions & 2 deletions ng-dev/release/publish/test/cut-stable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ describe('cut stable action', () => {
| <..> | fix | released first next pre-release *2 |
| <..> | fix | released release-candidate *1 |
| <..> | fix | released release-candidate *2 |
## Special Thanks
`);
},
);
Expand Down Expand Up @@ -466,7 +465,6 @@ describe('cut stable action', () => {
| <..> | fix | released first -next pre-release *2 |
| <..> | fix | released second -next pre-release *1 |
| <..> | fix | released second -next pre-release *2 |
## Special Thanks
`);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('cut exceptional minor pre-release action', () => {
| -- | -- | -- |
| <..> | feat | not released yet *1 |
| <..> | feat | not released yet *2 |
## Special Thanks
`);
});
});
Expand Down Expand Up @@ -175,7 +175,6 @@ describe('cut exceptional minor pre-release action', () => {
| -- | -- | -- |
| <..> | feat | not released yet *1 |
| <..> | feat | not released yet *2 |
## Special Thanks
`);
});
});
Expand Down Expand Up @@ -236,7 +235,6 @@ describe('cut exceptional minor pre-release action', () => {
| -- | -- | -- |
| <..> | feat | not released yet *1 |
| <..> | feat | not released yet *2 |
## Special Thanks
`);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ describe('cut exceptional minor next release candidate action', () => {
| Commit | Type | Description |
| -- | -- | -- |
| <..> | fix | not yet released *2 |
## Special Thanks
`);
});

Expand Down Expand Up @@ -153,7 +152,6 @@ describe('cut exceptional minor next release candidate action', () => {
| -- | -- | -- |
| <..> | feat | patch, not released |
| <..> | fix | not yet released *2 |
## Special Thanks
`);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ describe('move next into feature-freeze action', () => {
| -- | -- | -- |
| <..> | feat | not yet released *1 |
| <..> | fix | not yet released *2 |
## Special Thanks
`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ describe('move next into release-candidate action', () => {
| -- | -- | -- |
| <..> | feat | not yet released *1 |
| <..> | fix | not yet released *2 |
## Special Thanks
`);
});

Expand Down
Loading

0 comments on commit 7dc7d13

Please sign in to comment.