diff --git a/src/commands/default.ts b/src/commands/default.ts index 4798694..55edef3 100644 --- a/src/commands/default.ts +++ b/src/commands/default.ts @@ -25,7 +25,7 @@ export default async function defaultMain(args: Argv) { }); const logger = consola.create({ stdout: process.stderr }); - logger.info(`Generating changelog for ${config.from}...${config.to}`); + logger.info(`Generating changelog for ${config.from || ""}...${config.to}`); const rawCommits = await getGitDiff(config.from, config.to); diff --git a/src/git.ts b/src/git.ts index 0e39414..7d58114 100644 --- a/src/git.ts +++ b/src/git.ts @@ -27,9 +27,9 @@ export interface GitCommit extends RawGitCommit { } export async function getLastGitTag() { - const r = await execCommand("git", ["describe", "--tags", "--abbrev=0"]).then( - (r) => r.split("\n") - ); + const r = await execCommand("git", ["describe", "--tags", "--abbrev=0"]) + .then((r) => r.split("\n")) + .catch(() => []); return r[r.length - 1]; } diff --git a/src/markdown.ts b/src/markdown.ts index e2a45e3..2303b0b 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -16,9 +16,9 @@ export async function generateMarkDown( // Version Title const v = config.newVersion && `v${config.newVersion}`; - markdown.push("", "## " + (v || `${config.from}...${config.to}`), ""); + markdown.push("", "## " + (v || `${config.from || ""}...${config.to}`), ""); - if (config.repo) { + if (config.repo && config.from) { markdown.push(formatCompareChanges(v, config), ""); }