Skip to content

Commit dea4a25

Browse files
committed
chore: change changelog commit template to modified conventionalcommits
1 parent b5067a4 commit dea4a25

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

changelog-template-commit.hbs

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1-
{{#each bodyLines}}
1+
{{!--
2+
Copy of https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-conventionalcommits/templates/commit.hbs
23
3-
{{this}}
4+
The following have been replaced:
45
5-
{{/each}}
6+
- `commitUrlFormat` with `{{@root.host}}/{{@root.owner}}/{{@root.repository}}/commit/{{hash}})`
7+
- `issueUrlFormat` with `{{@root.host}}/{{@root.owner}}/{{@root.repository}}/issues/{{this.id}}`
68
7-
{{#each notes}}
9+
As they won't be replaced when overriding the commitPartial
10+
--}}
11+
*{{#if scope}} **{{scope}}:**
12+
{{~/if}} {{#if subject}}
13+
{{~subject}}
14+
{{~else}}
15+
{{~header}}
16+
{{~/if}}
817

9-
**BREAKING CHANGE**: {{text}}
18+
{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
19+
([{{shortHash}}]({{@root.host}}/{{@root.owner}}/{{@root.repository}}/commit/{{hash}}))
20+
{{~else}}
21+
{{~shortHash}}
22+
{{~/if}}{{~/if}}
1023

11-
{{/each}}
24+
{{~!-- commit references --}}
25+
{{~#if references~}}
26+
, closes
27+
{{~#each references}} {{#if @root.linkReferences~}}
28+
[
29+
{{~#if this.owner}}
30+
{{~this.owner}}/
31+
{{~/if}}
32+
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{@root.host}}/{{@root.owner}}/{{@root.repository}}/issues/{{this.id}})
33+
{{~else}}
34+
{{~#if this.owner}}
35+
{{~this.owner}}/
36+
{{~/if}}
37+
{{~this.repository}}{{this.prefix}}{{this.issue}}
38+
{{~/if}}{{/each}}
39+
{{~/if}}
40+
{{!-- End of copy --}}
41+
42+
{{!-- Start of custom additions --}}
43+
{{#each bodyLines}}
44+
45+
{{this}}
46+
{{/each}}{{#each notes}}
47+
48+
**BREAKING CHANGE**: {{text}}
49+
{{/each}}

release.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { readFileSync } from 'node:fs'
22

3-
// Since all I need is to append something to the default commit template, I read the original file and append to it instead of copying its contents. This way, the default template will always be up-to-date.
4-
// Note: I'm intentionally using a different template here than the conventionalcommits one because there seems to be an issue with adding the commit hash URLs.
5-
const defaultCommitPartial = readFileSync('./node_modules/conventional-changelog-writer/templates/commit.hbs', { encoding: 'utf-8' })
6-
const customCommitPartial = readFileSync('./changelog-template-commit.hbs', { encoding: 'utf-8' })
7-
const commitPartial = defaultCommitPartial + customCommitPartial
3+
const commitPartial = readFileSync('./changelog-template-commit.hbs', { encoding: 'utf-8' })
84

95
/**
106
* Adds the commit body line by line so I can add it with the correct indentation in `changelog-template-commit.hbs`.

0 commit comments

Comments
 (0)