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

Changelog formatting #1246

Merged
merged 2 commits into from
May 22, 2020
Merged
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
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Thank you, G. Richard Bellamy ([@rbellamy](https://github.com/rbellamy)), for al
#### πŸš€ Enhancement

- `@auto-it/core`, `@auto-it/gem`, `@auto-it/git-tag`
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ”© Dependency Updates

Expand Down Expand Up @@ -323,7 +323,7 @@ Thank you, Till Weisser ([@whynotzoidberg](https://github.com/whynotzoidberg)),

# v9.30.1 (Wed Apr 22 2020)

#### ⚠️ Pushed to `master`
#### ⚠️ Pushed to `master`

- add missing root devdep ([@hipstersmoothie](https://github.com/hipstersmoothie))

Expand Down Expand Up @@ -1159,7 +1159,7 @@ Here is an example of a super light weight version of the `npm` and `gh-pages` p

# v9.16.6 (Thu Mar 05 2020)

#### ⚠️ Pushed to `master`
#### ⚠️ Pushed to `master`

- `@auto-it/core`
- add dep for parse-github-url ([@hipstersmoothie](https://github.com/hipstersmoothie))
Expand All @@ -1172,7 +1172,7 @@ Here is an example of a super light weight version of the `npm` and `gh-pages` p

# v9.16.5 (Thu Mar 05 2020)

#### ⚠️ Pushed to `master`
#### ⚠️ Pushed to `master`

- `@auto-it/core`
- add bot-list dep to core ([@hipstersmoothie](https://github.com/hipstersmoothie))
Expand Down Expand Up @@ -1211,7 +1211,7 @@ Here is an example of a super light weight version of the `npm` and `gh-pages` p

# v9.16.2 (Thu Mar 05 2020)

#### πŸ› Bug Fix
#### πŸ› Bug Fix

- `@auto-it/bot-list`, `@auto-it/core`, `@auto-it/all-contributors`
- move botlist to package and use it in release notes exclusion [#1027](https://github.com/intuit/auto/pull/1027) ([@hipstersmoothie](https://github.com/hipstersmoothie))
Expand All @@ -1224,7 +1224,7 @@ Here is an example of a super light weight version of the `npm` and `gh-pages` p

# v9.16.1 (Thu Mar 05 2020)

#### πŸ› Bug Fix
#### πŸ› Bug Fix

- `@auto-it/npm`
- npm: respect subPackageChangelogs false [#1025](https://github.com/intuit/auto/pull/1025) ([@hipstersmoothie](https://github.com/hipstersmoothie))
Expand Down Expand Up @@ -4005,7 +4005,7 @@ auto.hooks.onCreateChangelog.tapPromise('Giphy', changelog =>

```js
auto.hooks.afterRelease.tap(
'MyPlugin',
"MyPlugin",
async (version, commits, releaseNotes) => {
// do something
}
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-list/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ Thank you, Till Weisser ([@whynotzoidberg](https://github.com/whynotzoidberg)),

#### Authors: 1

- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
2 changes: 1 addition & 1 deletion packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ exports[`generateReleaseNotes should add "Push to Next" 1`] = `

- First Feature [#1235](https://github.custom.com/foobar/auto/pull/1235) (adam@dierkens.com)

#### ⚠️ Pushed to \`next\`
#### ⚠️ Pushed to \`next\`

- I was a push to master (adam@dierkens.com)

Expand Down Expand Up @@ -183,7 +183,7 @@ exports[`generateReleaseNotes should include PR-less commits as patches 1`] = `

- First Feature [#1235](https://github.custom.com/foobar/auto/pull/1235) (adam@dierkens.com)

#### ⚠️ Pushed to \`master\`
#### ⚠️ Pushed to \`master\`

- I was a push to master (adam@dierkens.com)

Expand Down
35 changes: 35 additions & 0 deletions packages/core/src/__tests__/__snapshots__/log-parse.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,38 @@ Array [
},
]
`;

exports[`normalizeCommits should strip whitespace in subject 1`] = `
Array [
Object {
"authorEmail": "adam@dierkens.com",
"authorName": "Adam Dierkens",
"authors": Array [
Object {
"email": "adam@dierkens.com",
"name": "Adam Dierkens",
},
],
"files": Array [],
"hash": "foo",
"labels": Array [],
"pullRequest": undefined,
"subject": "First PR",
},
Object {
"authorEmail": "adam@dierkens.com",
"authorName": "Adam Dierkens",
"authors": Array [
Object {
"email": "adam@dierkens.com",
"name": "Adam Dierkens",
},
],
"files": Array [],
"hash": "foo",
"labels": Array [],
"pullRequest": undefined,
"subject": "Second PR",
},
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports[`Release generateReleaseNotes should detect pre-release branches 1`] = `

- Autobots roll out! (adam@dierkens.com)

#### ⚠️ Pushed to \`next\`
#### ⚠️ Pushed to \`next\`

- Doom Patrol enabled (adam@dierkens.com)

Expand Down Expand Up @@ -76,7 +76,7 @@ exports[`Release generateReleaseNotes should include PR-less commits 1`] = `

- First Feature [#1235](https://github.com/web/site/pull/1235) (adam@dierkens.com)

#### ⚠️ Pushed to \`master\`
#### ⚠️ Pushed to \`master\`

- I should be included (adam@dierkens.com)

Expand Down Expand Up @@ -116,7 +116,7 @@ exports[`Release generateReleaseNotes should match rebased commits to PRs 1`] =
- Feature [#124](https://github.com/web/site/pull/124) (adam@dierkens.com)
- I was rebased [#123](https://github.com/web/site/pull/123) (adam@dierkens.com)

#### ⚠️ Pushed to \`master\`
#### ⚠️ Pushed to \`master\`

- I am a commit to master (adam@dierkens.com)

Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/__tests__/log-parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,14 @@ describe("normalizeCommits", () => {

expect(await logParse.normalizeCommits(commits)).toMatchSnapshot();
});

test("should strip whitespace in subject", async () => {
const logParse = new LogParse();
const commits = [
makeCommitFromMsg("First PR"),
makeCommitFromMsg("Second\t PR"),
];

expect(await logParse.normalizeCommits(commits)).toMatchSnapshot();
});
});
2 changes: 1 addition & 1 deletion packages/core/src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class Changelog {
...this.options.labels,
{
name: "pushToBaseBranch",
changelogTitle: `⚠️ Pushed to \`${branch}\``,
changelogTitle: `⚠️ Pushed to \`${branch}\``,
description: "N/A",
releaseType: SEMVER.patch,
},
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/log-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ export default class LogParse {

this.hooks.parseCommit.tap("Merge Commit", parsePR);
this.hooks.parseCommit.tap("Squash Merge Commit", parseSquashPR);
this.hooks.parseCommit.tap(
"Strip consecutive white-space in Titles",
(commit) => {
const [firstLine, ...lines] = commit.subject.split("\n");

commit.subject = [
firstLine.replace(/[^\S\r\n]{2,}/g, " "),
...lines,
].join("\n");

return commit;
}
);
}

/** Run the log parser over a set of commits */
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export default class Release {
this.logger.verbose.info("Old changelog exists, prepending changes.");
const oldChangelog = await readFile(changelogPath, "utf8");
newChangelog = `${newChangelog}\n\n---\n\n${oldChangelog}`;
} else {
newChangelog += "\n";
}

await writeFile(changelogPath, newChangelog);
Expand Down
2 changes: 1 addition & 1 deletion plugins/all-contributors/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
2 changes: 1 addition & 1 deletion plugins/brew/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ Thank you, Till Weisser ([@whynotzoidberg](https://github.com/whynotzoidberg)),

#### Authors: 1

- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
2 changes: 1 addition & 1 deletion plugins/first-time-contributor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
4 changes: 2 additions & 2 deletions plugins/gem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand All @@ -37,4 +37,4 @@

#### Authors: 1

- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
2 changes: 1 addition & 1 deletion plugins/git-tag/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
2 changes: 1 addition & 1 deletion plugins/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
2 changes: 1 addition & 1 deletion plugins/released/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
2 changes: 1 addition & 1 deletion plugins/slack/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down
2 changes: 1 addition & 1 deletion plugins/upload-assets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#### πŸš€ Enhancement

- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))
- πŸ’Ž Ruby Gem Plugin [#1217](https://github.com/intuit/auto/pull/1217) ([@hipstersmoothie](https://github.com/hipstersmoothie))

#### πŸ› Bug Fix

Expand Down