Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ng-dev): update changelog generation templates #1089

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 16 additions & 57 deletions .github/local-actions/changelog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66128,13 +66128,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 @@ -66226,9 +66219,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 @@ -66321,27 +66311,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 @@ -66385,39 +66377,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