diff --git a/ng-dev/release/notes/templates/changelog.ts b/ng-dev/release/notes/templates/changelog.ts index 2db928910..a21a670d6 100644 --- a/ng-dev/release/notes/templates/changelog.ts +++ b/ng-dev/release/notes/templates/changelog.ts @@ -20,8 +20,14 @@ _%> for (const group of asCommitGroups(breakingChanges)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.breakingChanges[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const breakingChange of commit.breakingChanges) { +_%> +<%- bulletizeText(breakingChange.text) %> +<%_ + } + } } } _%> @@ -35,8 +41,14 @@ _%> for (const group of asCommitGroups(deprecations)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.deprecations[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const deprecation of commit.deprecations) { +_%> +<%- bulletizeText(deprecation.text) %> +<%_ + } + } } } _%> diff --git a/ng-dev/release/notes/templates/github-release.ts b/ng-dev/release/notes/templates/github-release.ts index da2070ec4..533981c64 100644 --- a/ng-dev/release/notes/templates/github-release.ts +++ b/ng-dev/release/notes/templates/github-release.ts @@ -20,8 +20,14 @@ _%> for (const group of asCommitGroups(breakingChanges)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.breakingChanges[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const breakingChange of commit.breakingChanges) { +_%> +<%- bulletizeText(breakingChange.text) %> +<%_ + } + } } } _%> @@ -35,8 +41,14 @@ _%> for (const group of asCommitGroups(deprecations)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.deprecations[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const deprecation of commit.deprecations) { +_%> +<%- bulletizeText(deprecation.text) %> +<%_ + } + } } } _%> diff --git a/ng-dev/release/publish/test/release-notes/generation.spec.ts b/ng-dev/release/publish/test/release-notes/generation.spec.ts index e92715898..aed0141b8 100644 --- a/ng-dev/release/publish/test/release-notes/generation.spec.ts +++ b/ng-dev/release/publish/test/release-notes/generation.spec.ts @@ -6,14 +6,17 @@ * found in the LICENSE file at https://angular.io/license */ -import {prepareTempDirectory} from '../test-utils/action-mocks'; import * as config from '../../../../utils/config'; -import {ReleaseNotes} from '../../../notes/release-notes'; +import { + getMockGitClient, + installSandboxGitClient, + SandboxGitClient, + SandboxGitRepo, +} from '../../../../utils/testing'; import {ReleaseConfig} from '../../../config'; +import {ReleaseNotes} from '../../../notes/release-notes'; +import {prepareTempDirectory} from '../test-utils/action-mocks'; import {changelogPattern, parse} from '../test-utils/test-utils'; -import {installSandboxGitClient, SandboxGitClient} from '../../../../utils/testing'; -import {getMockGitClient} from '../../../../utils/testing'; -import {SandboxGitRepo} from '../../../../utils/testing'; describe('release notes generation', () => { let releaseConfig: ReleaseConfig; @@ -239,6 +242,39 @@ describe('release notes generation', () => { `); }); + it('should capture multiple breaking changes from a single commit', async () => { + SandboxGitRepo.withInitialCommit(githubConfig) + .commit('fix(cdk/a11y): already released *1') + .createTagForHead('13.0.0-next.0') + .commit('fix(cdk/a11y): not yet released *1') + .commit( + 'refactor(cdk/a11y): with breaking change\n\n' + + 'BREAKING CHANGE: Description of breaking change.\n\n' + + 'BREAKING CHANGE: Description of breaking change 2.', + ); + + const releaseNotes = await ReleaseNotes.forRange( + client, + parse('13.0.0'), + '13.0.0-next.0', + 'HEAD', + ); + + expect(await releaseNotes.getChangelogEntry()).toMatch(changelogPattern` + # 13.0.0 <..> + ## Breaking Changes + ### cdk/a11y + - Description of breaking change. + - Description of breaking change 2. + ### cdk/a11y + | Commit | Type | Description | + | -- | -- | -- | + | <..> | fix | not yet released *1 | + | <..> | refactor | with breaking change | + ## Special Thanks + `); + }); + it('should indent breaking changes with bullets', async () => { SandboxGitRepo.withInitialCommit(githubConfig) .commit('fix(cdk/a11y): already released *1') @@ -304,6 +340,39 @@ describe('release notes generation', () => { ## Special Thanks `); }); + + it('should capture multiple deprecations from a single commit', async () => { + SandboxGitRepo.withInitialCommit(githubConfig) + .commit('fix(cdk/a11y): already released *1') + .createTagForHead('13.0.0-next.0') + .commit('fix(cdk/a11y): not yet released *1') + .commit( + 'refactor(cdk/a11y): with deprecation\n\n' + + 'DEPRECATED: Description of deprecation.\n\n' + + 'DEPRECATED: Description of deprecation 2.', + ); + + const releaseNotes = await ReleaseNotes.forRange( + client, + parse('13.0.0'), + '13.0.0-next.0', + 'HEAD', + ); + + expect(await releaseNotes.getChangelogEntry()).toMatch(changelogPattern` + # 13.0.0 <..> + ## Deprecations + ### cdk/a11y + - Description of deprecation. + - Description of deprecation 2. + ### cdk/a11y + | Commit | Type | Description | + | -- | -- | -- | + | <..> | fix | not yet released *1 | + | <..> | refactor | with deprecation | + ## Special Thanks + `); + }); }); describe('github release notes', () => { @@ -489,6 +558,39 @@ describe('release notes generation', () => { `); }); + it('should capture multiple breaking changes from a single commit', async () => { + SandboxGitRepo.withInitialCommit(githubConfig) + .commit('fix(cdk/a11y): already released *1') + .createTagForHead('13.0.0-next.0') + .commit('fix(cdk/a11y): not yet released *1') + .commit( + 'refactor(cdk/a11y): with breaking change\n\n' + + 'BREAKING CHANGE: Description of breaking change.\n\n' + + 'BREAKING CHANGE: Description of breaking change 2.', + ); + + const releaseNotes = await ReleaseNotes.forRange( + client, + parse('13.0.0'), + '13.0.0-next.0', + 'HEAD', + ); + + expect(await releaseNotes.getGithubReleaseEntry()).toMatch(changelogPattern` + # 13.0.0 <..> + ## Breaking Changes + ### cdk/a11y + - Description of breaking change. + - Description of breaking change 2. + ### cdk/a11y + | Commit | Description | + | -- | -- | + | <..> | not yet released *1 | + | <..> | with breaking change | + ## Special Thanks + `); + }); + it('should capture deprecations', async () => { SandboxGitRepo.withInitialCommit(githubConfig) .commit('fix(cdk/a11y): already released *1') @@ -520,6 +622,39 @@ describe('release notes generation', () => { }); }); + it('should capture multiple deprecations from a single commit', async () => { + SandboxGitRepo.withInitialCommit(githubConfig) + .commit('fix(cdk/a11y): already released *1') + .createTagForHead('13.0.0-next.0') + .commit('fix(cdk/a11y): not yet released *1') + .commit( + 'refactor(cdk/a11y): with deprecation\n\n' + + 'DEPRECATED: Description of deprecation.\n\n' + + 'DEPRECATED: Description of deprecation 2.', + ); + + const releaseNotes = await ReleaseNotes.forRange( + client, + parse('13.0.0'), + '13.0.0-next.0', + 'HEAD', + ); + + expect(await releaseNotes.getGithubReleaseEntry()).toMatch(changelogPattern` + # 13.0.0 <..> + ## Deprecations + ### cdk/a11y + - Description of deprecation. + - Description of deprecation 2. + ### cdk/a11y + | Commit | Description | + | -- | -- | + | <..> | not yet released *1 | + | <..> | with deprecation | + ## Special Thanks + `); + }); + it('should determine the number of commits included in the entry', async () => { SandboxGitRepo.withInitialCommit(githubConfig) .createTagForHead('0.0.0') diff --git a/tools/local-actions/changelog/main.js b/tools/local-actions/changelog/main.js index a16fc938d..98072cb8d 100644 --- a/tools/local-actions/changelog/main.js +++ b/tools/local-actions/changelog/main.js @@ -48384,8 +48384,14 @@ _%> for (const group of asCommitGroups(breakingChanges)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.breakingChanges[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const breakingChange of commit.breakingChanges) { +_%> +<%- bulletizeText(breakingChange.text) %> +<%_ + } + } } } _%> @@ -48399,8 +48405,14 @@ _%> for (const group of asCommitGroups(deprecations)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.deprecations[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const deprecation of commit.deprecations) { +_%> +<%- bulletizeText(deprecation.text) %> +<%_ + } + } } } _%> @@ -48462,8 +48474,14 @@ _%> for (const group of asCommitGroups(breakingChanges)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.breakingChanges[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const breakingChange of commit.breakingChanges) { +_%> +<%- bulletizeText(breakingChange.text) %> +<%_ + } + } } } _%> @@ -48477,8 +48495,14 @@ _%> for (const group of asCommitGroups(deprecations)) { _%> ### <%- group.title %> -<%- group.commits.map(commit => bulletizeText(commit.deprecations[0].text)).join('\\n\\n') %> <%_ + for (const commit of group.commits) { + for (const deprecation of commit.deprecations) { +_%> +<%- bulletizeText(deprecation.text) %> +<%_ + } + } } } _%>