From ec7ba7481b9910c01a97a37bbf02dddc4b4aad23 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sat, 19 Jul 2025 09:12:35 +0800 Subject: [PATCH 1/3] feat: extend changelog mainTemplate --- src/changelog.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/changelog.ts b/src/changelog.ts index 8e20d63..d5585fd 100644 --- a/src/changelog.ts +++ b/src/changelog.ts @@ -39,7 +39,17 @@ export const generateChangelog: typeof def = async ({ {{~/if}} {{~#if isPatch~}} {{~/if}} `.trim(); - preset.writer.mainTemplate! += "\n"; + preset.writer.mainTemplate = ` +{{#if noteGroups}} +{{#each noteGroups}} +### ⚠ {{title}} + +{{#each notes}} +* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} + {{#if commit.hash}}([{{commit.shortHash}}](https://github.com/{{@root.owner}}/{{@root.repository}}/commit/{{commit.hash}})){{/if}} +{{/each}} +{{/each}} +{{/if}}\n`.trim(); const pkgDir = getPkgDir(); From 0cee6e3521f13259c9b075abb1614de341a82c09 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Mon, 21 Jul 2025 11:23:11 +0800 Subject: [PATCH 2/3] feat: update --- src/changelog.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/changelog.ts b/src/changelog.ts index d5585fd..ed85678 100644 --- a/src/changelog.ts +++ b/src/changelog.ts @@ -40,16 +40,27 @@ export const generateChangelog: typeof def = async ({ {{~#if isPatch~}} {{~/if}} `.trim(); preset.writer.mainTemplate = ` +{{> header}} {{#if noteGroups}} {{#each noteGroups}} + ### ⚠ {{title}} {{#each notes}} -* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} - {{#if commit.hash}}([{{commit.shortHash}}](https://github.com/{{@root.owner}}/{{@root.repository}}/commit/{{commit.hash}})){{/if}} +* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}{{#if commit.hash}}([{{commit.shortHash}}](https://github.com/{{@root.owner}}/{{@root.repository}}/commit/{{commit.hash}})){{/if}} +{{/each}} {{/each}} +{{/if}} +{{#each commitGroups}} + +{{#if title}} +### {{title}} + +{{/if}} +{{#each commits}} +{{> commit root=@root}} {{/each}} -{{/if}}\n`.trim(); +{{/each}}\n`.trim(); const pkgDir = getPkgDir(); From f9a8b1f419a9ba33f75308fa65990ded85a3bfe4 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Mon, 21 Jul 2025 14:02:39 +0800 Subject: [PATCH 3/3] feat: update --- src/changelog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/changelog.ts b/src/changelog.ts index ed85678..dc58506 100644 --- a/src/changelog.ts +++ b/src/changelog.ts @@ -47,7 +47,7 @@ export const generateChangelog: typeof def = async ({ ### ⚠ {{title}} {{#each notes}} -* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}{{#if commit.hash}}([{{commit.shortHash}}](https://github.com/{{@root.owner}}/{{@root.repository}}/commit/{{commit.hash}})){{/if}} +* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{commit.subject}} {{#if commit.hash}}([{{commit.shortHash}}](https://github.com/{{@root.owner}}/{{@root.repository}}/commit/{{commit.hash}})){{/if}} {{/each}} {{/each}} {{/if}}