Skip to content

Commit

Permalink
fix(ng-dev): correctly indent bullets in breaking changes and depreca…
Browse files Browse the repository at this point in the history
…tions sections

With this change we fix an issue where when breaking changes or deprecations messages contained bullets these were not indented correctly.

Previously
```
## Breaking Changes
### @angular/cli
- Support for Node.js v12 has been removed as it will become EOL on 2022-04-30. Please use Node.js v14.15 or later.

- Several changes in the Angular CLI commands and arguments handling.

- `ng help` has been removed in favour of the `—-help` option.
- `ng —-version` has been removed in favour of `ng version` and `ng v`.
- Deprecated camel cased arguments are no longer supported. Ex. using `—-sourceMap` instead of `—-source-map` will result in an error.
- `ng update`, `—-migrate-only` option no longer accepts a string of migration name, instead use `—-migrate-only -—name <migration-name>`.
- `—-help json` help has been removed.
### @angular/cli
| Commit | Type | Description |
| -- | -- | -- |
| [4ebfe0341](angular/angular-cli@4ebfe03) | feat | drop support for Node.js 12 |
| [c0ca87656](angular/angular-cli@c0ca876) | fix | remove JSON serialized description from help output |
| [2e0493130](angular/angular-cli@2e04931) | refactor | replace command line arguments parser |
### @angular-devkit/build-angular
| Commit | Type | Description |
| -- | -- | -- |
| [e28c71597](angular/angular-cli@e28c715) | fix | ignore css only chunks during naming |
## Special Thanks
Alan Agius and Joey Perrott
```

Now
```
## Breaking Changes
### @angular/cli
- Support for Node.js v12 has been removed as it will become EOL on 2022-04-30. Please use Node.js v14.15 or later.

- Several changes in the Angular CLI commands and arguments handling.

  - `ng help` has been removed in favour of the `—-help` option.
  - `ng —-version` has been removed in favour of `ng version` and `ng v`.
  - Deprecated camel cased arguments are no longer supported. Ex. using `—-sourceMap` instead of `—-source-map` will result in an error.
  - `ng update`, `—-migrate-only` option no longer accepts a string of migration name, instead use `—-migrate-only -—name <migration-name>`.
  - `—-help json` help has been removed.
### @angular/cli
| Commit | Type | Description |
| -- | -- | -- |
| [4ebfe0341](angular/angular-cli@4ebfe03) | feat | drop support for Node.js 12 |
| [c0ca87656](angular/angular-cli@c0ca876) | fix | remove JSON serialized description from help output |
| [2e0493130](angular/angular-cli@2e04931) | refactor | replace command line arguments parser |
### @angular-devkit/build-angular
| Commit | Type | Description |
| -- | -- | -- |
| [e28c71597](angular/angular-cli@e28c715) | fix | ignore css only chunks during naming |
## Special Thanks
Alan Agius and Joey Perrott
```
  • Loading branch information
alan-agius4 authored and devversion committed Mar 10, 2022
1 parent e60312a commit fa77b14
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ng-dev/release/notes/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class RenderContext {
* Bulletize a paragraph.
*/
bulletizeText(text: string): string {
return '- ' + text.replace(/\\n/g, '\\n ');
return '- ' + text.replace(/\n/g, '\n ');
}

/**
Expand Down
36 changes: 36 additions & 0 deletions ng-dev/release/publish/test/release-notes/generation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,42 @@ describe('release notes generation', () => {
`);
});

it('should indent breaking changes with bullets', 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:\n' +
'Description of breaking change.\n' +
'- point 1\n' +
'- point 2\n',
);

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.
- point 1
- point 2
### cdk/a11y
| Commit | Type | Description |
| -- | -- | -- |
| <..> | fix | not yet released *1 |
| <..> | refactor | with breaking change |
## Special Thanks
`);
});

it('should capture deprecations', async () => {
SandboxGitRepo.withInitialCommit(githubConfig)
.commit('fix(cdk/a11y): already released *1')
Expand Down
2 changes: 1 addition & 1 deletion tools/local-actions/changelog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48921,7 +48921,7 @@ var require_context2 = __commonJS({
return content.replace(/#(\d+)/g, (_, g) => this.pullRequestToLink(Number(g)));
}
bulletizeText(text) {
return "- " + text.replace(/\\n/g, "\\n ");
return "- " + text.replace(/\n/g, "\n ");
}
commitAuthors(commits) {
return [...new Set(commits.map((c) => c.author))].filter((a) => !botsAuthorNames.includes(a)).sort();
Expand Down

0 comments on commit fa77b14

Please sign in to comment.