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

@@ -1,3 +1,4 @@
{ {
"scopes": ["commands", "changelog", "readme", "release", "config"] "scopes": ["commands", "changelog", "readme", "release", "config"],
"autoSignReleases": true
} }

View File

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