keepchanges 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,9 +49,9 @@ npx keepchanges <version> [options]
49
49
 
50
50
  | Argument or option | Default | Description |
51
51
  | --- | --- | --- |
52
- | `<version>` | Required | Version to generate. Accepts `1.1.0` or `v1.1.0`; headings and tags use `v1.1.0`. A version containing `-`, such as `1.1.0-beta.1`, is treated as a prerelease. |
53
- | `--from <ref>` | Latest tag | Overrides the starting Git ref used to read commits. |
54
- | `--to <ref>` | `HEAD` | Sets the ending Git ref. It cannot be combined with `--release`, and must resolve to the current `HEAD` when used with `--commit`. |
52
+ | `<version>` | Required | Version to generate. Accepts `1.1.0` or `v1.1.0`. A version containing `-`, such as `1.1.0-beta.1`, is treated as a prerelease. |
53
+ | `--from <ref>` | Inferred from target | Overrides the exclusive starting Git ref used to read commits. Without it, the latest matching tag is used for `HEAD`, or the previous matching tag relative to an explicit `--to`. If no previous tag exists, history starts at the first commit. A version such as `1.0.0` uses the configured tag prefix. |
54
+ | `--to <ref>` | `HEAD` | Sets the ending Git ref. A version such as `1.1.0` uses the configured tag prefix. It cannot be combined with `--release`, and must resolve to the current `HEAD` when used with `--commit`. |
55
55
  | `--repository <source>` | Auto-detected | Sets a GitHub `owner/repo` slug or a complete GitHub/Gitea URL. It takes precedence over `package.json` and `origin`. |
56
56
  | `--output <path>` | `CHANGELOG.md` | Sets the changelog file path. Relative paths are resolved from the current working directory. |
57
57
  | `--dry` | `false` | Prints the current release preview without writing files or performing commit, tag, push, or release API mutations. |
@@ -59,6 +59,8 @@ npx keepchanges <version> [options]
59
59
  | `--release` | `false` | Runs the complete release flow: writes files, creates or reuses a release commit, creates an annotated tag, pushes `HEAD` and the tag, then creates or updates the repository Release. This implies `--commit`. |
60
60
  | `--author <author>` | Release bot | Sets the generated release commit author in `"Name <email>"` format; requires `--commit` or `--release`. |
61
61
  | `-t, --token <token>` | Environment | Resolves authors and publishes Releases. GitHub precedence is `--token`, `GITHUB_TOKEN`, then `GH_TOKEN`; Gitea uses `GITEA_TOKEN`. |
62
+ | `--tag-prefix <prefix>` | `v` | Sets the prefix used to find and create version tags, such as `package@`. |
63
+ | `--no-tag-prefix` | `false` | Finds and creates version tags without a prefix. |
62
64
  | `--name <name>` | Version tag | Sets the remote Release name; only valid with `--release`. |
63
65
  | `-d, --draft` | `false` | Creates a draft Release; only valid with `--release`. |
64
66
  | `--prerelease` | Inferred | Explicitly marks a prerelease. By default it is inferred from `-` in the version; only valid with `--release`. |
@@ -99,6 +101,24 @@ Create a GitHub Release:
99
101
  GITHUB_TOKEN=github_pat_xxx npx keepchanges 1.1.0 --release
100
102
  ```
101
103
 
104
+ Use version tags without a prefix:
105
+
106
+ ```bash
107
+ npx keepchanges 1.1.0 --no-tag-prefix
108
+ ```
109
+
110
+ Use a package-specific tag prefix:
111
+
112
+ ```bash
113
+ npx keepchanges 1.1.0 --tag-prefix 'package@'
114
+ ```
115
+
116
+ Rebuild a historical release without specifying its previous tag:
117
+
118
+ ```bash
119
+ npx keepchanges 1.0.0 --to 1.0.0 --dry
120
+ ```
121
+
102
122
  Preview a Release without writing, committing, tagging, pushing, or calling the
103
123
  release API:
104
124
 
@@ -127,6 +147,15 @@ and the release ends with a version comparison link. GitHub and Gitea both
127
147
  support author resolution and Release publishing. Gitea uses `GITEA_TOKEN` to
128
148
  resolve primary commit authors and publish Releases.
129
149
 
150
+ Version tags use the `v` prefix by default. The configured prefix applies to
151
+ new tags, existing-tag lookup, version-shaped `--from` and `--to` values,
152
+ comparison links, and repository Release names. Branch names, commit hashes,
153
+ `HEAD`, and other non-version refs are used unchanged. Tag lookup only considers
154
+ the configured prefix, so independent tag sequences do not affect each other.
155
+ When `--to` is provided without `--from`, the CLI finds the previous matching
156
+ tag relative to that target instead of the current `HEAD`. For the first tag in
157
+ a sequence, it reads all commits reachable from the target.
158
+
130
159
  Entries use Git author names by default and include `Co-Authored-By`
131
160
  participants. Bot accounts are omitted. With the corresponding provider token,
132
161
  the CLI attempts to resolve email addresses to usernames.
package/README.zh-CN.md CHANGED
@@ -48,9 +48,9 @@ npx keepchanges <version> [options]
48
48
 
49
49
  | 参数 | 默认值 | 说明 |
50
50
  | --- | --- | --- |
51
- | `<version>` | 必填 | 要生成的版本号。可以传入 `1.1.0` 或 `v1.1.0`;生成的标题和 tag 统一使用 `v1.1.0`。包含 `-` 的版本会作为预发布版本,例如 `1.1.0-beta.1`。 |
52
- | `--from <ref>` | 最近的 tag | 指定读取 commit 的起始 Git ref,并覆盖自动选择结果。 |
53
- | `--to <ref>` | `HEAD` | 指定读取 commit 的结束 Git ref。不能与 `--release` 一起使用;与 `--commit` 一起使用时必须指向当前 `HEAD`。 |
51
+ | `<version>` | 必填 | 要生成的版本号。可以传入 `1.1.0` 或 `v1.1.0`。包含 `-` 的版本会作为预发布版本,例如 `1.1.0-beta.1`。 |
52
+ | `--from <ref>` | 根据目标推断 | 指定读取 commit 时不包含在结果中的起始 Git ref,并覆盖自动选择结果。省略时,目标为 `HEAD` 会使用匹配前缀的最近 tag;显式传入 `--to` 会查找该目标之前匹配前缀的 tag。如果不存在前一个 tag,则从首个 commit 开始读取。`1.0.0` 这类版本会自动应用配置的 tag 前缀。 |
53
+ | `--to <ref>` | `HEAD` | 指定读取 commit 的结束 Git ref。`1.1.0` 这类版本会自动应用配置的 tag 前缀。不能与 `--release` 一起使用;与 `--commit` 一起使用时必须指向当前 `HEAD`。 |
54
54
  | `--repository <source>` | 自动检测 | 指定 `owner/repo` 格式的 GitHub 仓库或 GitHub/Gitea 完整 URL。优先级高于 `package.json` 和 `origin`。 |
55
55
  | `--output <path>` | `CHANGELOG.md` | 指定 changelog 文件路径。相对路径以当前工作目录为基准。 |
56
56
  | `--dry` | `false` | 输出当前版本预览,不写入文件,也不执行 commit、tag、push 或发布 API。 |
@@ -58,6 +58,8 @@ npx keepchanges <version> [options]
58
58
  | `--release` | `false` | 执行完整发布流程:写入文件、创建或复用 release commit、创建 annotated tag、推送 `HEAD` 和 tag,然后创建或更新仓库 Release。该参数隐含 `--commit`。 |
59
59
  | `--author <author>` | release bot | 设置自动创建的 release commit 作者,格式必须为 `"Name <email>"`;需要与 `--commit` 或 `--release` 一起使用。 |
60
60
  | `-t, --token <token>` | 环境变量 | 仓库访问令牌,用于解析作者及发布 Release。GitHub 优先级为 `--token`、`GITHUB_TOKEN`、`GH_TOKEN`;Gitea 使用 `GITEA_TOKEN`。 |
61
+ | `--tag-prefix <prefix>` | `v` | 设置查找和创建版本 tag 时使用的前缀,例如 `package@`。 |
62
+ | `--no-tag-prefix` | `false` | 查找和创建不带前缀的版本 tag。 |
61
63
  | `--name <name>` | 版本 tag | 设置远程 Release 名称;仅适用于 `--release`。 |
62
64
  | `-d, --draft` | `false` | 创建 draft Release;仅适用于 `--release`。 |
63
65
  | `--prerelease` | 根据版本推断 | 显式标记为 prerelease;默认根据版本是否包含 `-` 推断,仅适用于 `--release`。 |
@@ -98,6 +100,24 @@ npx keepchanges 1.1.0 --commit \
98
100
  GITHUB_TOKEN=github_pat_xxx npx keepchanges 1.1.0 --release
99
101
  ```
100
102
 
103
+ 使用无前缀版本 tag:
104
+
105
+ ```bash
106
+ npx keepchanges 1.1.0 --no-tag-prefix
107
+ ```
108
+
109
+ 使用 package 专属 tag 前缀:
110
+
111
+ ```bash
112
+ npx keepchanges 1.1.0 --tag-prefix 'package@'
113
+ ```
114
+
115
+ 不指定前一个 tag,重新生成历史版本:
116
+
117
+ ```bash
118
+ npx keepchanges 1.0.0 --to 1.0.0 --dry
119
+ ```
120
+
101
121
  预览 Release,不写文件、不提交、不创建 tag、不推送且不调用发布 API:
102
122
 
103
123
  ```bash
@@ -123,6 +143,14 @@ GitHub 地址会被自动识别。自托管 Gitea 需要在 `package.json` 中
123
143
  GitHub 和 Gitea 均支持作者解析和 Release 发布;Gitea 使用 `GITEA_TOKEN`
124
144
  解析 commit 主作者并发布 Release。
125
145
 
146
+ 版本 tag 默认使用 `v` 前缀。配置的前缀会统一应用于新 tag、已有 tag 查找、
147
+ 版本形式的 `--from` 和 `--to`、比较链接及仓库 Release 名称。分支名、commit
148
+ hash、`HEAD` 等非版本 ref 保持不变。自动查找 tag 时只考虑配置的前缀,因此
149
+ 彼此独立的 tag 序列不会相互影响。
150
+ 省略 `--from` 并传入 `--to` 时,CLI 会相对于该目标查找匹配前缀的前一个 tag,
151
+ 而不是使用当前 `HEAD` 的最近 tag。如果目标是该序列中的首个 tag,则读取该目标
152
+ 可达的全部 commit。
153
+
126
154
  默认使用 Git 提交中的作者名,并将 `Co-Authored-By` 参与者一起写入记录,bot
127
155
  账号会被忽略。提供对应平台的 token 后,会尝试将邮箱解析为用户名。
128
156
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as insertRelease, c as defaultConfig, i as hasRelease, n as parseCommits, o as readChangelog, r as generateChangelog, s as writeChangelog } from "./commit-FX77u6Sj.mjs";
2
+ import { a as insertRelease, c as defaultConfig, i as hasRelease, n as parseCommits, o as readChangelog, r as generateChangelog, s as writeChangelog } from "./commit-DBopyhs1.mjs";
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import { normalizeFull } from "verkit";
5
5
  import process from "node:process";
@@ -8,30 +8,49 @@ import { resolve } from "node:path";
8
8
  import ansis from "ansis";
9
9
  import { x } from "tinyexec";
10
10
  //#region package.json
11
- var version = "1.0.0";
11
+ var version = "1.0.2";
12
12
  //#endregion
13
13
  //#region src/git.ts
14
+ function versionTagPattern(tagPrefix) {
15
+ return `${tagPrefix.replace(/[\\*?[\]]/g, "\\$&")}[0-9]*`;
16
+ }
14
17
  async function git(cwd, ...args) {
15
18
  const result = await x("git", args, { nodeOptions: { cwd } });
16
19
  if (result.exitCode !== 0) throw new Error(result.stderr.trim() || `Git exited with status ${result.exitCode}`);
17
20
  return result.stdout;
18
21
  }
19
- async function getLatestTag(cwd) {
20
- return (await x("git", [
22
+ async function getLatestTag(cwd, tagPrefix) {
23
+ const args = [
21
24
  "describe",
22
25
  "--tags",
23
26
  "--abbrev=0"
24
- ], { nodeOptions: { cwd } })).stdout.trim();
27
+ ];
28
+ if (tagPrefix !== void 0) args.push("--match", versionTagPattern(tagPrefix));
29
+ return (await x("git", args, { nodeOptions: { cwd } })).stdout.trim();
25
30
  }
26
31
  async function getTagCommit(cwd, tag) {
27
32
  return git(cwd, "rev-list", "-n", "1", tag).then((output) => output.trim() || void 0).catch(() => void 0);
28
33
  }
29
- async function getPreviousTag(cwd, tag, releaseRef) {
30
- if (!tag.includes("-")) {
31
- const previousStable = (await git(cwd, "tag", "--merged", releaseRef, "--sort=-version:refname")).trim().split("\n").find((candidate) => candidate !== tag && /^v?\d+\.\d+\.\d+$/.test(candidate));
34
+ async function resolveVersionRef(cwd, ref, tagPrefix) {
35
+ const version = normalizeFull(ref);
36
+ if (!version) return ref;
37
+ const candidates = [.../* @__PURE__ */ new Set([`${tagPrefix}${version}`, ref])];
38
+ for (const candidate of candidates) if (await getTagCommit(cwd, `refs/tags/${candidate}`)) return candidate;
39
+ return ref;
40
+ }
41
+ async function getPreviousTag(cwd, tag, releaseRef, tagPrefix) {
42
+ const releaseVersion = normalizeFull(tag.slice(tagPrefix.length));
43
+ if (releaseVersion && !releaseVersion.includes("-")) {
44
+ const previousStable = (await git(cwd, "tag", "--merged", releaseRef, "--sort=-version:refname")).trim().split("\n").find((candidate) => {
45
+ if (candidate === tag || !candidate.startsWith(tagPrefix)) return false;
46
+ const versionTag = candidate.slice(tagPrefix.length);
47
+ if (!/^\d/.test(versionTag)) return false;
48
+ const version = normalizeFull(versionTag);
49
+ return Boolean(version && !version.includes("-"));
50
+ });
32
51
  if (previousStable) return previousStable;
33
52
  }
34
- return git(cwd, "describe", "--tags", "--abbrev=0", `${releaseRef}^`).then((output) => output.trim()).catch(() => "");
53
+ return git(cwd, "describe", "--tags", "--abbrev=0", "--match", versionTagPattern(tagPrefix), `${releaseRef}^`).then((output) => output.trim()).catch(() => "");
35
54
  }
36
55
  async function getRemoteTagCommit(cwd, tag) {
37
56
  const refs = (await git(cwd, "ls-remote", "--tags", "origin", `refs/tags/${tag}`, `refs/tags/${tag}^{}`)).trim().split("\n").filter(Boolean);
@@ -320,7 +339,7 @@ async function createChanges(options, environment) {
320
339
  const env = environment.env ?? process.env;
321
340
  const stdout = environment.stdout ?? ((value) => process.stdout.write(value));
322
341
  const colors = environment.colors ?? ansis;
323
- const tag = `v${options.version}`;
342
+ const tag = `${options.tagPrefix}${options.version}`;
324
343
  const repository = await resolveRepository(environment.cwd, options.repository);
325
344
  const token = repository?.provider.token(options.token, env);
326
345
  validateReleaseSupport(options, repository);
@@ -336,10 +355,13 @@ async function createChanges(options, environment) {
336
355
  taggedCommit = await getTagCommit(environment.cwd, tag);
337
356
  releaseRef = tag;
338
357
  }
339
- const from = options.from ?? (taggedCommit ? await getPreviousTag(environment.cwd, tag, releaseRef) : await getLatestTag(environment.cwd));
340
358
  const to = releaseRef || options.to;
341
- const comparisonFrom = from || (repository ? await git(environment.cwd, "rev-list", "--max-parents=0", to).then((value) => value.trim()) : "");
342
- const commits = parseCommits(await readGitCommits(environment.cwd, from, to));
359
+ const resolvedTo = await resolveVersionRef(environment.cwd, to, options.tagPrefix);
360
+ const inferFromTarget = releaseRef !== void 0 || options.to !== defaultConfig.cli.to;
361
+ const from = options.from ?? (inferFromTarget ? await getPreviousTag(environment.cwd, tag, resolvedTo, options.tagPrefix) : await getLatestTag(environment.cwd, options.tagPrefix));
362
+ const resolvedFrom = from ? await resolveVersionRef(environment.cwd, from, options.tagPrefix) : "";
363
+ const comparisonFrom = resolvedFrom || (repository ? await git(environment.cwd, "rev-list", "--max-parents=0", resolvedTo).then((value) => value.trim()) : "");
364
+ const commits = parseCommits(await readGitCommits(environment.cwd, resolvedFrom, resolvedTo));
343
365
  if (token && repository) await repository.provider.resolveAuthors?.(commits, repository, token, environment.fetch ?? globalThis.fetch);
344
366
  const style = {
345
367
  emoji: options.emoji,
@@ -350,7 +372,8 @@ async function createChanges(options, environment) {
350
372
  version: options.version,
351
373
  commits,
352
374
  repository,
353
- comparisonFrom
375
+ comparisonFrom,
376
+ comparisonTo: normalizeFull(options.to) ? resolvedTo : tag
354
377
  }, style);
355
378
  const repositoryRelease = {
356
379
  tag,
@@ -360,7 +383,7 @@ async function createChanges(options, environment) {
360
383
  draft: options.draft
361
384
  };
362
385
  const preview = {
363
- from: from || comparisonFrom,
386
+ from: resolvedFrom || comparisonFrom,
364
387
  tag,
365
388
  commitCount: commits.length,
366
389
  body
@@ -383,7 +406,7 @@ async function createChanges(options, environment) {
383
406
  const releaseExists = hasRelease(currentChangelog, options.version);
384
407
  await writeChangelog(outputPath, insertRelease(currentChangelog, release));
385
408
  const versionPath = await updateVersion(environment.cwd, options.version);
386
- if (options.commit || options.release) await commitReleaseFiles(options, environment.cwd, outputPath, versionPath, releaseExists);
409
+ if (options.commit || options.release) await commitReleaseFiles(options, environment.cwd, outputPath, versionPath, releaseExists, tag);
387
410
  if (options.release) {
388
411
  const gitIdentity = resolveGitIdentity(options.author);
389
412
  await git(environment.cwd, ...gitIdentity, "tag", "-a", tag, "-m", tag);
@@ -396,12 +419,12 @@ function validateReleaseSupport(options, repository) {
396
419
  if (!repository) throw new Error("A supported repository is required to release");
397
420
  if (!repository.provider.publishRelease && !repository.provider.manualReleaseUrl) throw new Error(`${repository.provider.name} does not support releases`);
398
421
  }
399
- async function commitReleaseFiles(options, cwd, outputPath, versionPath, releaseExists) {
422
+ async function commitReleaseFiles(options, cwd, outputPath, versionPath, releaseExists, tag) {
400
423
  const releasePaths = [outputPath, versionPath].filter((path) => path !== void 0);
401
424
  if (!(await git(cwd, "status", "--porcelain", "--", ...releasePaths)).trim()) return;
402
425
  await git(cwd, "add", "--", ...releasePaths);
403
426
  const versionChanges = versionPath ? await git(cwd, "status", "--porcelain", "--", versionPath) : "";
404
- const commitMessage = versionPath && !versionChanges.trim() ? `docs(changelog): ${releaseExists ? "update" : "add"} v${options.version} release notes` : `chore(release): v${options.version}`;
427
+ const commitMessage = versionPath && !versionChanges.trim() ? `docs(changelog): ${releaseExists ? "update" : "add"} ${tag} release notes` : `chore(release): ${tag}`;
405
428
  await git(cwd, ...resolveGitIdentity(options.author), "commit", "-m", commitMessage, ...options.author ? ["--author", options.author] : [], "--only", "--", ...releasePaths);
406
429
  }
407
430
  async function publishRelease(repository, release, token, preview, environment, manualAction = "create") {
@@ -435,6 +458,9 @@ function resolveOptions(versionArgument, options) {
435
458
  if (!version) throw new Error(`Invalid release version: ${versionArgument}`);
436
459
  const commit = options.commit ?? defaultConfig.cli.commit;
437
460
  const release = options.release ?? defaultConfig.cli.release;
461
+ let tagPrefix = defaultConfig.cli.tagPrefix;
462
+ if (typeof options.tagPrefix === "string") tagPrefix = options.tagPrefix;
463
+ else if (options.tagPrefix === false) tagPrefix = "";
438
464
  if (options.to !== void 0 && release) throw new Error("--to cannot be used with --release");
439
465
  if (options.author !== void 0 && !commit && !release) throw new Error("--author requires --commit or --release");
440
466
  if (!release && (options.name !== void 0 || options.draft !== void 0 || options.prerelease !== void 0)) throw new Error("--name, --draft, and --prerelease require --release");
@@ -449,6 +475,7 @@ function resolveOptions(versionArgument, options) {
449
475
  release,
450
476
  author: options.author ?? defaultConfig.cli.author,
451
477
  token: options.token,
478
+ tagPrefix,
452
479
  name: options.name,
453
480
  draft: options.draft ?? defaultConfig.cli.draft,
454
481
  prerelease: options.prerelease,
@@ -459,12 +486,19 @@ function resolveOptions(versionArgument, options) {
459
486
  }
460
487
  //#endregion
461
488
  //#region src/cli.ts
462
- const cli = cac("keepchanges").option("--from <ref>", "Start Git reference").option("--to <ref>", "End Git reference").option("--repository <source>", "Repository slug or URL").option("--output <path>", "Changelog file path").option("--dry", "Preview without modifying files or remotes").option("--commit", "Commit the changelog and version update").option("--release", "Publish a repository release").option("--author <author>", "Commit author in \"Name <email>\" format").option("-t, --token <token>", "Repository token").option("--name <name>", "Repository release name").option("-d, --draft", "Create a draft repository release").option("--prerelease", "Mark the repository release as prerelease").option("--emoji", "Use emojis in changelog section titles").option("--capitalize", "Capitalize changelog entries").option("--group", "Group repeated commit scopes");
463
- cli.command("[version]").usage("<version> [options]").action(async (versionArgument, options) => {
489
+ const cli = cac("keepchanges").option("--from <ref>", "Start Git reference").option("--to <ref>", "End Git reference").option("--repository <source>", "Repository slug or URL").option("--output <path>", "Changelog file path").option("--dry", "Preview without modifying files or remotes").option("--commit", "Commit the changelog and version update").option("--release", "Publish a repository release").option("--author <author>", "Commit author in \"Name <email>\" format").option("-t, --token <token>", "Repository token").option("--no-tag-prefix", "Create version tags without a prefix").option("--tag-prefix <prefix>", "Prefix used for version tags", { default: defaultConfig.cli.tagPrefix }).option("--name <name>", "Repository release name").option("-d, --draft", "Create a draft repository release").option("--prerelease", "Mark the repository release as prerelease").option("--emoji", "Use emojis in changelog section titles").option("--capitalize", "Capitalize changelog entries").option("--group", "Group repeated commit scopes");
490
+ cli.command("<version>").usage("<version> [options]").action(async (versionArgument, options) => {
464
491
  await createChanges(resolveOptions(versionArgument, options), { cwd: process.cwd() });
465
492
  });
466
493
  cli.help();
467
494
  cli.version(version);
468
- cli.parse();
495
+ try {
496
+ cli.parse(process.argv, { run: false });
497
+ await cli.runMatchedCommand();
498
+ } catch (error) {
499
+ const message = error instanceof Error ? error.message : String(error);
500
+ process.stderr.write(`${message}\n`);
501
+ process.exitCode = 1;
502
+ }
469
503
  //#endregion
470
504
  export {};
@@ -9,6 +9,7 @@ const defaultConfig = {
9
9
  commit: false,
10
10
  release: false,
11
11
  author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>",
12
+ tagPrefix: "v",
12
13
  draft: false
13
14
  },
14
15
  changelog: {
@@ -59,7 +60,7 @@ function resolveChangelogConfig(overrides = {}) {
59
60
  function generateChangelog(options, overrides = {}) {
60
61
  const config = resolveChangelogConfig(overrides);
61
62
  const changes = [...renderSection(options.commits.filter((commit) => commit.isBreaking), config.breakingChanges, config, options.repository), ...Object.entries(config.types).flatMap(([type, section]) => renderSection(options.commits.filter((commit) => !commit.isBreaking && commit.type === type), section, config, options.repository))];
62
- const body = [...changes.length ? changes : [`*${config.messages.noSignificantChanges}*`], ...options.repository && options.comparisonFrom ? ["", `##### &nbsp;&nbsp;&nbsp;&nbsp;[${config.messages.viewChanges.replace("{provider}", options.repository.provider.name)}](${options.repository.provider.compareUrl(options.repository, options.comparisonFrom, `v${options.version}`)})`] : []].join("\n").trim();
63
+ const body = [...changes.length ? changes : [`*${config.messages.noSignificantChanges}*`], ...options.repository && options.comparisonFrom ? ["", `##### &nbsp;&nbsp;&nbsp;&nbsp;[${config.messages.viewChanges.replace("{provider}", options.repository.provider.name)}](${options.repository.provider.compareUrl(options.repository, options.comparisonFrom, options.comparisonTo ?? `v${options.version}`)})`] : []].join("\n").trim();
63
64
  return {
64
65
  body,
65
66
  release: [
package/dist/index.d.mts CHANGED
@@ -90,6 +90,7 @@ interface KeepChangesConfig {
90
90
  commit: boolean;
91
91
  release: boolean;
92
92
  author: string;
93
+ tagPrefix: string;
93
94
  draft: boolean;
94
95
  };
95
96
  changelog: ChangelogConfig;
@@ -102,6 +103,7 @@ declare const defaultConfig: {
102
103
  commit: false;
103
104
  release: false;
104
105
  author: string;
106
+ tagPrefix: string;
105
107
  draft: false;
106
108
  };
107
109
  changelog: {
@@ -140,6 +142,7 @@ interface GenerateChangelogOptions {
140
142
  commits: Commit[];
141
143
  repository?: Repository;
142
144
  comparisonFrom?: string;
145
+ comparisonTo?: string;
143
146
  }
144
147
  interface GeneratedChangelog {
145
148
  body: string;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as insertRelease, c as defaultConfig, i as hasRelease, l as resolveChangelogConfig, n as parseCommits, o as readChangelog, r as generateChangelog, s as writeChangelog, t as parseCommit } from "./commit-FX77u6Sj.mjs";
1
+ import { a as insertRelease, c as defaultConfig, i as hasRelease, l as resolveChangelogConfig, n as parseCommits, o as readChangelog, r as generateChangelog, s as writeChangelog, t as parseCommit } from "./commit-DBopyhs1.mjs";
2
2
  export { defaultConfig, generateChangelog, hasRelease, insertRelease, parseCommit, parseCommits, readChangelog, resolveChangelogConfig, writeChangelog };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "keepchanges",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "Generate and maintain CHANGELOG.md from Conventional Commits.",
6
6
  "author": "edram",
7
7
  "license": "MIT",