From b90831a4b8db7fd435a4fe1a0d8841e343c2c653 Mon Sep 17 00:00:00 2001 From: Petr Ruzicka Date: Thu, 16 Jan 2020 16:45:48 +0100 Subject: [PATCH] Move both auto-changelog recipes to the `/conf` directory (#587) --- .../changelog-compact.hbs | 0 conf/keepachangelog.hbs | 24 +++++++++++++++++++ docs/changelog.md | 7 +++--- docs/recipes/auto-changelog.md | 21 +++++++++++++--- 4 files changed, 46 insertions(+), 6 deletions(-) rename docs/recipes/changelog-compact-template.hbs => conf/changelog-compact.hbs (100%) create mode 100644 conf/keepachangelog.hbs diff --git a/docs/recipes/changelog-compact-template.hbs b/conf/changelog-compact.hbs similarity index 100% rename from docs/recipes/changelog-compact-template.hbs rename to conf/changelog-compact.hbs diff --git a/conf/keepachangelog.hbs b/conf/keepachangelog.hbs new file mode 100644 index 00000000..76220454 --- /dev/null +++ b/conf/keepachangelog.hbs @@ -0,0 +1,24 @@ +# Changelog + +{{#each releases}} + {{#if href}} + ## [{{title}}]({{href}}){{#if tag}} ({{isoDate}}){{/if}} + {{else}} + ## {{title}}{{#if tag}} ({{isoDate}}){{/if}} + {{/if}} + + {{#if summary}} + {{summary}} + {{/if}} + + {{#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}} + +{{/each}} diff --git a/docs/changelog.md b/docs/changelog.md index 31b5a0bf..bf107f48 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -21,7 +21,7 @@ A tool like [auto-changelog](https://github.com/CookPete/auto-changelog) is a gr ```json { "git": { - "changelog": "npx auto-changelog --stdout --commit-limit false -u --template ./changelog.hbs" + "changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/conf/changelog-compact.hbs" }, "hooks": { "after:bump": "npx auto-changelog -p" @@ -29,8 +29,9 @@ A tool like [auto-changelog](https://github.com/CookPete/auto-changelog) is a gr } ``` -With this `git.changelog`, the changelog preview is based on the `changelog.hbs` template file. This would be used for -[GitHub](./github-releases.md) or [GitLab releases](./gitlab-releases.md) as well. +With this `git.changelog`, the changelog preview is based on the `changelog-compact.hbs` +template file. This would be used for [GitHub](./github-releases.md) +or [GitLab releases](./gitlab-releases.md) as well. Additionally, `hooks.after:bump` will update the `CHANGELOG.md` with each release to get included with the release commit. This can be omitted if the project does not keep a `CHANGELOG.md` or similar. diff --git a/docs/recipes/auto-changelog.md b/docs/recipes/auto-changelog.md index 0ef9ce97..e67eeb8d 100644 --- a/docs/recipes/auto-changelog.md +++ b/docs/recipes/auto-changelog.md @@ -18,7 +18,7 @@ Example configuration in the release-it config: "before:release": "npx auto-changelog -p" }, "git": { - "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template ./preview.hbs" + "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/conf/changelog-compact.hbs" } } ``` @@ -46,7 +46,7 @@ unreleased tag: {{/each}} ``` -You can also use the template above [changelog-compact-template.hbs](./changelog-compact-template.hbs) +You can also use the template above [changelog-compact.hbs](../../conf/changelog-compact.hbs) directly from the URL: ```json @@ -55,7 +55,22 @@ directly from the URL: "before:release": "npx auto-changelog -p" }, "git": { - "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/docs/recipes/changelog-compact-template.hbs" + "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/conf/changelog-compact.hbs" + } +} +``` + +In case you are not using the `package.json` and you just want to simply +generate `CHANGELOG.md` compatible with [https://keepachangelog.com/](https://keepachangelog.com/) +you can use this example: + +```json +{ + "hooks": { + "before:release": "npx auto-changelog --commit-limit false https://raw.githubusercontent.com/release-it/release-it/master/conf/keepachangelog.hbs" + }, + "git": { + "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/conf/changelog-compact.hbs" } } ```