feat(commands): add option to change unreleased change title

This commit is contained in:
2023-12-16 17:43:22 +02:00
parent 8e460614f5
commit 1e8bfd04dc
2 changed files with 9 additions and 3 deletions

View File

@@ -240,9 +240,14 @@ program
.description("Outputs a markdown formatted changelog")
.option("--show-hashes", "show first 9 characters of commit hashes")
.option("--last-only", "display only latest release changes")
.option(
"--unreleased-as <version>",
"show unreleased changes as different version"
)
.action(async (options) => {
const showHashes = options.showHashes ? true : false;
const lastOnly = options.lastOnly ? true : false;
const unreleased = options.unreleasedAs || "Unreleased";
if ((await simpleGit().tags()).all.length === 0) {
return console.log(
@@ -261,12 +266,12 @@ program
const tag =
semver.sort(
(await simpleGit().tags([`--contains=${commit.hash}`])).all
)[0]! || "Unreleased";
)[0]! || unreleased;
const currentCommitStack = parsedCommitStacks.find(
(commitStack) => commitStack.version === tag
) || {
version: tag || "Unreleased",
version: tag || unreleased,
breaking: [],
features: [],
fixes: [],