Skip to content
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
1 change: 1 addition & 0 deletions src/commands/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default async function defaultMain(args: Argv) {
output: args.output,
newVersion: typeof args.r === "string" ? args.r : undefined,
noAuthors: args.noAuthors,
hideAuthorEmail: args.hideAuthorEmail,
});

if (args.clean) {
Expand Down
6 changes: 3 additions & 3 deletions src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ export async function generateMarkDown(
(e) => !e.includes("noreply.github.com")
);
const email =
config.hideAuthorEmail !== true && _email ? `<${_email}>` : "";
config.hideAuthorEmail !== true && _email ? ` <${_email}>` : "";
const github = i.github
? `([@${i.github}](https://github.com/${i.github}))`
? ` ([@${i.github}](https://github.com/${i.github}))`
: "";
return `- ${i.name} ${github || email}`;
return `- ${i.name}${github || email || ""}`;
})
);
}
Expand Down
38 changes: 38 additions & 0 deletions test/contributors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,42 @@ describe("contributors", () => {
- **scope:** Update dependencies"
`);
});

test("should skip author email addresses with hideAuthorEmail config", async () => {
const config = await loadChangelogConfig(process.cwd(), {
from: "1.0.0",
newVersion: "2.0.0",
hideAuthorEmail: true,
});
const contents = await generateMarkDown(testCommits, config);

expect(contents).toMatchInlineSnapshot(`
"## v2.0.0

[compare changes](https://github.com/unjs/changelogen/compare/1.0.0...v2.0.0)

### 🚀 Enhancements

- **scope:** Add feature

### 🩹 Fixes

- **scope:** Resolve bug

### 📖 Documentation

- **scope:** Update documentation

### 🏡 Chore

- **scope:** Update dependencies

### ❤️ Contributors

- John Doe ([@brainsucker](https://github.com/brainsucker))
- Jane Smith
- Alice Johnson
- Bob Williams"
`);
});
});