-
-
Notifications
You must be signed in to change notification settings - Fork 744
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updated auto-changelog template
- Loading branch information
Showing
3 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
{{#unless options.hideCredit}} | ||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
{{/unless}} | ||
|
||
{{#each releases}} | ||
{{#if @first}} | ||
{{#each merges}} | ||
- {{{message}}}{{#if href}} [`#{{id}}`]({{href}}){{/if}} | ||
{{/each}} | ||
{{#each fixes}} | ||
- {{{commit.subject}}}{{#each fixes}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}{{/each}} | ||
{{/each}} | ||
{{#each commits}} | ||
- {{#if breaking}}**Breaking change:** {{/if}}{{{subject}}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}} | ||
{{/each}} | ||
{{/if}} | ||
{{#if href}} | ||
## [{{title}}]({{href}}){{#if tag}} - {{isoDate}}{{/if}} | ||
{{else}} | ||
## {{title}}{{#if tag}} - {{isoDate}}{{/if}} | ||
{{/if}} | ||
|
||
{{#if summary}} | ||
{{summary}} | ||
{{/if}} | ||
|
||
{{#custom merges commits heading="#### Features" subject="feat: "}} | ||
- {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). | ||
{{/custom}} | ||
|
||
{{#custom merges commits heading="#### Improvements" subject="(chore|refactor|style): "}} | ||
- {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). | ||
{{/custom}} | ||
|
||
{{#custom merges commits heading="#### Fixes" subject="fix: "}} | ||
- {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). | ||
{{/custom}} | ||
|
||
{{#custom merges commits heading="#### Documentations" subject="docs: "}} | ||
- {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). | ||
{{/custom}} | ||
|
||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = function (Handlebars) { | ||
Handlebars.registerHelper('custom', function (context, extra, options) { | ||
if ((!context || context.length === 0) && (!extra || extra.length === 0)) { | ||
return ''; | ||
} | ||
|
||
const list = [...context, ...extra] | ||
.filter(item => { | ||
const commit = item.commit || item; | ||
if (options.hash.exclude) { | ||
const pattern = new RegExp(options.hash.exclude, 'm'); | ||
if (pattern.test(commit.message)) { | ||
return false; | ||
} | ||
} | ||
if (options.hash.message) { | ||
const pattern = new RegExp(options.hash.message, 'm'); | ||
return pattern.test(commit.message); | ||
} | ||
if (options.hash.subject) { | ||
const pattern = new RegExp(options.hash.subject); | ||
return pattern.test(commit.subject); | ||
} | ||
return true; | ||
}) | ||
.map(item => options.fn(item)) | ||
.join(''); | ||
|
||
if (!list) { | ||
return ''; | ||
} | ||
|
||
return options.hash.heading | ||
? `${options.hash.heading}\n\n${list}` | ||
: `${list}`; | ||
}); | ||
}; |