From d1d225c38f892d7d63a13d51f0f3ecf9021baf9f Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 22 Dec 2020 21:32:06 +0100 Subject: [PATCH] chore(changelog): fix changelog script There was an issue with the "unreleased" link tag, which had been converted to lowercase by Prettier. --- CHANGELOG.md | 2 +- scripts/changelog.ts | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 478b8bd..8bcf461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -199,7 +199,7 @@ First release # -[unreleased]: https://github.com/EndBug/add-and-commit/compare/v5.3.0...HEAD +[unreleased]: https://github.com/EndBug/add-and-commit/compare/v6.1.0...HEAD [1.0.0]: https://github.com/EndBug/add-and-commit/tree/v1.0.0 [2.0.0]: https://github.com/EndBug/add-and-commit/compare/v1.0.0...v2.0.0 [2.1.0]: https://github.com/EndBug/add-and-commit/compare/v2.0.0...v2.1.0 diff --git a/scripts/changelog.ts b/scripts/changelog.ts index 7e93e38..244e18b 100644 --- a/scripts/changelog.ts +++ b/scripts/changelog.ts @@ -27,13 +27,11 @@ arr[1] = futureChangelog = arr.join('## [Unreleased]') // Update footer -arr = futureChangelog - .split('\n') - .map((line) => - line.startsWith('[Unreleased]') - ? `[Unreleased]: https://github.com/EndBug/add-and-commit/compare/v${currentVersion}...HEAD` - : line - ) +arr = futureChangelog.split('\n').map((line) => + line.startsWith('[unreleased]') // The link ref is lowercase because of prettier + ? `[unreleased]: https://github.com/EndBug/add-and-commit/compare/v${currentVersion}...HEAD` + : line +) const lastVersion = ([...arr].reverse()[1]?.match(/\[([^\][]*)]/) || [])[0].replace(/[\[\]']+/g, '') // eslint-disable-line no-useless-escape