@williamthorsen/release-kit 5.4.0 → 7.0.0

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.
Files changed (135) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +12 -12
  3. package/dist/esm/.cache +1 -1
  4. package/dist/esm/assertCleanWorkingTree.js +9 -14
  5. package/dist/esm/bin/release-kit.js +202 -229
  6. package/dist/esm/buildChangelogEntries.d.ts +2 -2
  7. package/dist/esm/buildChangelogEntries.js +142 -149
  8. package/dist/esm/buildDependencyGraph.d.ts +1 -1
  9. package/dist/esm/buildDependencyGraph.js +60 -59
  10. package/dist/esm/buildEmptyReleaseEntry.d.ts +1 -1
  11. package/dist/esm/buildEmptyReleaseEntry.js +12 -15
  12. package/dist/esm/buildReleaseSummary.d.ts +1 -1
  13. package/dist/esm/buildReleaseSummary.js +23 -26
  14. package/dist/esm/buildSyntheticChangelogEntry.d.ts +1 -1
  15. package/dist/esm/buildSyntheticChangelogEntry.js +9 -12
  16. package/dist/esm/bumpAllVersions.d.ts +1 -1
  17. package/dist/esm/bumpAllVersions.js +51 -52
  18. package/dist/esm/bumpVersion.d.ts +1 -1
  19. package/dist/esm/bumpVersion.js +25 -28
  20. package/dist/esm/changelogJsonFile.d.ts +1 -1
  21. package/dist/esm/changelogJsonFile.js +59 -62
  22. package/dist/esm/changelogJsonUtils.d.ts +1 -1
  23. package/dist/esm/changelogJsonUtils.js +35 -32
  24. package/dist/esm/changelogOverrides.d.ts +1 -1
  25. package/dist/esm/changelogOverrides.js +374 -377
  26. package/dist/esm/checkWorkTypesDrift.js +104 -99
  27. package/dist/esm/collectPolicyViolations.d.ts +2 -2
  28. package/dist/esm/collectPolicyViolations.js +11 -14
  29. package/dist/esm/commitCommand.js +48 -53
  30. package/dist/esm/compareVersions.js +20 -23
  31. package/dist/esm/createGithubRelease.js +56 -59
  32. package/dist/esm/createGithubReleaseCommand.js +21 -29
  33. package/dist/esm/createTags.js +57 -56
  34. package/dist/esm/decideRelease.d.ts +2 -2
  35. package/dist/esm/decideRelease.js +27 -41
  36. package/dist/esm/defaults.d.ts +3 -3
  37. package/dist/esm/defaults.js +36 -48
  38. package/dist/esm/deleteFileIfExists.js +10 -12
  39. package/dist/esm/deriveWorkspaceConfig.d.ts +1 -1
  40. package/dist/esm/deriveWorkspaceConfig.js +34 -36
  41. package/dist/esm/detectPackageManager.js +35 -37
  42. package/dist/esm/detectUndeclaredTagPrefixes.js +41 -40
  43. package/dist/esm/determineBumpFromCommits.d.ts +2 -2
  44. package/dist/esm/determineBumpFromCommits.js +25 -29
  45. package/dist/esm/determineBumpType.d.ts +1 -1
  46. package/dist/esm/determineBumpType.js +31 -32
  47. package/dist/esm/discoverWorkspaces.js +38 -40
  48. package/dist/esm/format.js +6 -11
  49. package/dist/esm/generateChangelogs.d.ts +1 -1
  50. package/dist/esm/generateChangelogs.js +13 -17
  51. package/dist/esm/getCommitsSinceTarget.d.ts +1 -1
  52. package/dist/esm/getCommitsSinceTarget.js +54 -55
  53. package/dist/esm/hasPrettierConfig.js +33 -35
  54. package/dist/esm/help/prepareHelp.d.ts +2 -0
  55. package/dist/esm/help/prepareHelp.js +26 -0
  56. package/dist/esm/index.d.ts +4 -4
  57. package/dist/esm/index.js +2 -8
  58. package/dist/esm/init/checks.js +28 -32
  59. package/dist/esm/init/detectRepoType.js +12 -15
  60. package/dist/esm/init/initCommand.js +60 -54
  61. package/dist/esm/init/parseJsonRecord.js +9 -11
  62. package/dist/esm/init/scaffold.d.ts +1 -1
  63. package/dist/esm/init/scaffold.js +32 -38
  64. package/dist/esm/init/templates.d.ts +1 -1
  65. package/dist/esm/init/templates.js +16 -22
  66. package/dist/esm/injectReleaseNotesIntoReadme.js +42 -49
  67. package/dist/esm/injectSection.js +17 -27
  68. package/dist/esm/loadConfig.d.ts +1 -1
  69. package/dist/esm/loadConfig.js +206 -225
  70. package/dist/esm/parseCommitMessage.d.ts +1 -1
  71. package/dist/esm/parseCommitMessage.js +72 -76
  72. package/dist/esm/parseRequestedTags.js +6 -9
  73. package/dist/esm/prepareCommand.d.ts +32 -1
  74. package/dist/esm/prepareCommand.js +225 -271
  75. package/dist/esm/previewTagPrefixes.d.ts +1 -1
  76. package/dist/esm/previewTagPrefixes.js +101 -96
  77. package/dist/esm/propagateBumps.d.ts +2 -2
  78. package/dist/esm/propagateBumps.js +48 -50
  79. package/dist/esm/publish.d.ts +2 -2
  80. package/dist/esm/publish.js +22 -28
  81. package/dist/esm/publishCommand.js +75 -86
  82. package/dist/esm/pushCommand.js +33 -40
  83. package/dist/esm/pushRelease.d.ts +1 -1
  84. package/dist/esm/pushRelease.js +21 -24
  85. package/dist/esm/readCurrentVersion.js +13 -17
  86. package/dist/esm/releasePrepare.d.ts +1 -1
  87. package/dist/esm/releasePrepare.js +213 -231
  88. package/dist/esm/releasePrepareMono.d.ts +2 -2
  89. package/dist/esm/releasePrepareMono.js +434 -493
  90. package/dist/esm/releasePrepareProject.d.ts +2 -2
  91. package/dist/esm/releasePrepareProject.js +143 -153
  92. package/dist/esm/renderChangelogMarkdown.d.ts +1 -1
  93. package/dist/esm/renderChangelogMarkdown.js +20 -24
  94. package/dist/esm/renderReleaseNotes.d.ts +1 -1
  95. package/dist/esm/renderReleaseNotes.js +50 -55
  96. package/dist/esm/reportPrepare.d.ts +1 -1
  97. package/dist/esm/reportPrepare.js +230 -231
  98. package/dist/esm/resolveCliffConfigPath.js +18 -23
  99. package/dist/esm/resolveCommandTags.d.ts +1 -1
  100. package/dist/esm/resolveCommandTags.js +47 -44
  101. package/dist/esm/resolveReleaseNotesConfig.d.ts +1 -1
  102. package/dist/esm/resolveReleaseNotesConfig.js +39 -41
  103. package/dist/esm/resolveReleaseTags.d.ts +1 -1
  104. package/dist/esm/resolveReleaseTags.js +39 -40
  105. package/dist/esm/runGitCliff.js +27 -30
  106. package/dist/esm/showTagPrefixesCommand.js +48 -70
  107. package/dist/esm/stripEmojiPrefix.js +2 -5
  108. package/dist/esm/stripScope.js +18 -21
  109. package/dist/esm/sync-labels/generateCommand.d.ts +1 -1
  110. package/dist/esm/sync-labels/generateCommand.js +51 -52
  111. package/dist/esm/sync-labels/initCommand.js +46 -47
  112. package/dist/esm/sync-labels/loadSyncLabelsConfig.d.ts +1 -1
  113. package/dist/esm/sync-labels/loadSyncLabelsConfig.js +46 -52
  114. package/dist/esm/sync-labels/presets.d.ts +1 -1
  115. package/dist/esm/sync-labels/presets.js +40 -43
  116. package/dist/esm/sync-labels/resolveLabels.d.ts +1 -1
  117. package/dist/esm/sync-labels/resolveLabels.js +28 -35
  118. package/dist/esm/sync-labels/syncCommand.js +30 -30
  119. package/dist/esm/sync-labels/templates.d.ts +1 -1
  120. package/dist/esm/sync-labels/templates.js +23 -26
  121. package/dist/esm/sync-labels/types.js +1 -0
  122. package/dist/esm/syncWorkTypes.js +83 -81
  123. package/dist/esm/tagCommand.js +12 -21
  124. package/dist/esm/typeGuards.js +4 -8
  125. package/dist/esm/types.js +66 -60
  126. package/dist/esm/validateConfig.d.ts +1 -1
  127. package/dist/esm/validateConfig.js +109 -115
  128. package/dist/esm/validateOnlyExcludesStrandedDependents.d.ts +2 -2
  129. package/dist/esm/validateOnlyExcludesStrandedDependents.js +97 -91
  130. package/dist/esm/validateOverridesCommand.d.ts +2 -2
  131. package/dist/esm/validateOverridesCommand.js +111 -111
  132. package/dist/esm/workTypesData.js +57 -60
  133. package/dist/esm/workTypesUtils.js +16 -21
  134. package/dist/esm/writeReleaseNotesPreviews.js +55 -57
  135. package/package.json +2 -6
@@ -1,62 +1,61 @@
1
- import { readFileSync, writeFileSync } from "node:fs";
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
2
  import { bumpVersion } from "./bumpVersion.js";
3
3
  function isPackageJson(value) {
4
- return typeof value === "object" && value !== null && "version" in value && typeof value.version === "string";
4
+ return typeof value === 'object' && value !== null && 'version' in value && typeof value.version === 'string';
5
5
  }
6
- function bumpAllVersions(packageFiles, releaseType, dryRun) {
7
- const firstFile = packageFiles[0];
8
- if (firstFile === void 0) {
9
- throw new Error("No package files specified");
10
- }
11
- const firstPkg = readPackageJson(firstFile);
12
- const currentVersion = firstPkg.version;
13
- const newVersion = bumpVersion(currentVersion, releaseType);
14
- writeVersionToAllFiles(packageFiles, firstFile, firstPkg, newVersion, dryRun);
15
- return { currentVersion, newVersion, files: [...packageFiles] };
6
+ export function bumpAllVersions(packageFiles, releaseType, dryRun) {
7
+ const firstFile = packageFiles[0];
8
+ if (firstFile === undefined) {
9
+ throw new Error('No package files specified');
10
+ }
11
+ const firstPkg = readPackageJson(firstFile);
12
+ const currentVersion = firstPkg.version;
13
+ const newVersion = bumpVersion(currentVersion, releaseType);
14
+ writeVersionToAllFiles(packageFiles, firstFile, firstPkg, newVersion, dryRun);
15
+ return { currentVersion, newVersion, files: [...packageFiles] };
16
16
  }
17
- function setAllVersions(packageFiles, newVersion, dryRun) {
18
- const firstFile = packageFiles[0];
19
- if (firstFile === void 0) {
20
- throw new Error("No package files specified");
21
- }
22
- const firstPkg = readPackageJson(firstFile);
23
- const currentVersion = firstPkg.version;
24
- writeVersionToAllFiles(packageFiles, firstFile, firstPkg, newVersion, dryRun);
25
- return { currentVersion, newVersion, files: [...packageFiles] };
17
+ export function setAllVersions(packageFiles, newVersion, dryRun) {
18
+ const firstFile = packageFiles[0];
19
+ if (firstFile === undefined) {
20
+ throw new Error('No package files specified');
21
+ }
22
+ const firstPkg = readPackageJson(firstFile);
23
+ const currentVersion = firstPkg.version;
24
+ writeVersionToAllFiles(packageFiles, firstFile, firstPkg, newVersion, dryRun);
25
+ return { currentVersion, newVersion, files: [...packageFiles] };
26
26
  }
27
27
  function writeVersionToAllFiles(packageFiles, firstFile, firstPkg, newVersion, dryRun) {
28
- for (const filePath of packageFiles) {
29
- if (dryRun) {
30
- continue;
31
- }
32
- const pkg = filePath === firstFile ? firstPkg : readPackageJson(filePath);
33
- pkg.version = newVersion;
34
- try {
35
- writeFileSync(filePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
36
- } catch (error) {
37
- throw new Error(`Failed to write ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
28
+ for (const filePath of packageFiles) {
29
+ if (dryRun) {
30
+ continue;
31
+ }
32
+ const pkg = filePath === firstFile ? firstPkg : readPackageJson(filePath);
33
+ pkg.version = newVersion;
34
+ try {
35
+ writeFileSync(filePath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
36
+ }
37
+ catch (error) {
38
+ throw new Error(`Failed to write ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
39
+ }
38
40
  }
39
- }
40
41
  }
41
42
  function readPackageJson(filePath) {
42
- let content;
43
- try {
44
- content = readFileSync(filePath, "utf8");
45
- } catch (error) {
46
- throw new Error(`Failed to read ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
47
- }
48
- let parsed;
49
- try {
50
- parsed = JSON.parse(content);
51
- } catch (error) {
52
- throw new Error(`Failed to parse JSON in ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
53
- }
54
- if (!isPackageJson(parsed)) {
55
- throw new Error(`No valid 'version' field found in ${filePath}`);
56
- }
57
- return parsed;
43
+ let content;
44
+ try {
45
+ content = readFileSync(filePath, 'utf8');
46
+ }
47
+ catch (error) {
48
+ throw new Error(`Failed to read ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
49
+ }
50
+ let parsed;
51
+ try {
52
+ parsed = JSON.parse(content);
53
+ }
54
+ catch (error) {
55
+ throw new Error(`Failed to parse JSON in ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
56
+ }
57
+ if (!isPackageJson(parsed)) {
58
+ throw new Error(`No valid 'version' field found in ${filePath}`);
59
+ }
60
+ return parsed;
58
61
  }
59
- export {
60
- bumpAllVersions,
61
- setAllVersions
62
- };
@@ -1,2 +1,2 @@
1
- import type { ReleaseType } from './types.ts';
1
+ import type { ReleaseType } from './types.js';
2
2
  export declare function bumpVersion(version: string, releaseType: ReleaseType): string;
@@ -1,29 +1,26 @@
1
- function bumpVersion(version, releaseType) {
2
- const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
3
- if (!match) {
4
- throw new Error(`Invalid semver version: '${version}'`);
5
- }
6
- const major = match[1];
7
- const minor = match[2];
8
- const patch = match[3];
9
- if (major === void 0 || minor === void 0 || patch === void 0) {
10
- throw new Error(`Invalid semver version: '${version}'`);
11
- }
12
- const majorNum = Number.parseInt(major, 10);
13
- const minorNum = Number.parseInt(minor, 10);
14
- const patchNum = Number.parseInt(patch, 10);
15
- switch (releaseType) {
16
- case "major":
17
- if (majorNum === 0) {
18
- return `0.${minorNum + 1}.0`;
19
- }
20
- return `${majorNum + 1}.0.0`;
21
- case "minor":
22
- return `${majorNum}.${minorNum + 1}.0`;
23
- case "patch":
24
- return `${majorNum}.${minorNum}.${patchNum + 1}`;
25
- }
1
+ export function bumpVersion(version, releaseType) {
2
+ const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
3
+ if (!match) {
4
+ throw new Error(`Invalid semver version: '${version}'`);
5
+ }
6
+ const major = match[1];
7
+ const minor = match[2];
8
+ const patch = match[3];
9
+ if (major === undefined || minor === undefined || patch === undefined) {
10
+ throw new Error(`Invalid semver version: '${version}'`);
11
+ }
12
+ const majorNum = Number.parseInt(major, 10);
13
+ const minorNum = Number.parseInt(minor, 10);
14
+ const patchNum = Number.parseInt(patch, 10);
15
+ switch (releaseType) {
16
+ case 'major':
17
+ if (majorNum === 0) {
18
+ return `0.${minorNum + 1}.0`;
19
+ }
20
+ return `${majorNum + 1}.0.0`;
21
+ case 'minor':
22
+ return `${majorNum}.${minorNum + 1}.0`;
23
+ case 'patch':
24
+ return `${majorNum}.${minorNum}.${patchNum + 1}`;
25
+ }
26
26
  }
27
- export {
28
- bumpVersion
29
- };
@@ -1,4 +1,4 @@
1
- import type { ChangelogEntry, ReleaseConfig } from './types.ts';
1
+ import type { ChangelogEntry, ReleaseConfig } from './types.js';
2
2
  export declare function resolveChangelogJsonPath(config: Pick<ReleaseConfig, 'changelogJson'>, changelogPath: string): string;
3
3
  export declare function writeChangelogJson(filePath: string, entries: ChangelogEntry[]): string;
4
4
  export declare function upsertChangelogJson(filePath: string, entries: ChangelogEntry[]): string;
@@ -1,78 +1,75 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { dirname, join } from "node:path";
3
- import stringify from "json-stringify-pretty-compact";
4
- import semver from "semver";
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import stringify from 'json-stringify-pretty-compact';
4
+ import semver from 'semver';
5
5
  import { isChangelogEntry } from "./changelogJsonUtils.js";
6
6
  import { isUnknownArray } from "./typeGuards.js";
7
- function resolveChangelogJsonPath(config, changelogPath) {
8
- return join(changelogPath, config.changelogJson.outputPath);
7
+ export function resolveChangelogJsonPath(config, changelogPath) {
8
+ return join(changelogPath, config.changelogJson.outputPath);
9
9
  }
10
- function writeChangelogJson(filePath, entries) {
11
- const sorted = sortNewestFirst(entries);
12
- mkdirSync(dirname(filePath), { recursive: true });
13
- writeFileSync(filePath, stringify(sorted, { maxLength: 100 }) + "\n", "utf8");
14
- return filePath;
10
+ export function writeChangelogJson(filePath, entries) {
11
+ const sorted = sortNewestFirst(entries);
12
+ mkdirSync(dirname(filePath), { recursive: true });
13
+ writeFileSync(filePath, stringify(sorted, { maxLength: 100 }) + '\n', 'utf8');
14
+ return filePath;
15
15
  }
16
- function upsertChangelogJson(filePath, entries) {
17
- upsertChangelogJsonAndReturn(filePath, entries);
18
- return filePath;
16
+ export function upsertChangelogJson(filePath, entries) {
17
+ upsertChangelogJsonAndReturn(filePath, entries);
18
+ return filePath;
19
19
  }
20
- function upsertChangelogJsonAndReturn(filePath, entries) {
21
- const existing = readExistingEntries(filePath);
22
- const merged = mergeEntries(entries, existing);
23
- mkdirSync(dirname(filePath), { recursive: true });
24
- writeFileSync(filePath, stringify(merged, { maxLength: 100 }) + "\n", "utf8");
25
- return merged;
20
+ export function upsertChangelogJsonAndReturn(filePath, entries) {
21
+ const existing = readExistingEntries(filePath);
22
+ const merged = mergeEntries(entries, existing);
23
+ mkdirSync(dirname(filePath), { recursive: true });
24
+ writeFileSync(filePath, stringify(merged, { maxLength: 100 }) + '\n', 'utf8');
25
+ return merged;
26
26
  }
27
- function mergeChangelogEntriesWithDisk(filePath, entries) {
28
- const existing = readExistingEntries(filePath);
29
- return mergeEntries(entries, existing);
27
+ export function mergeChangelogEntriesWithDisk(filePath, entries) {
28
+ const existing = readExistingEntries(filePath);
29
+ return mergeEntries(entries, existing);
30
30
  }
31
31
  function sortNewestFirst(entries) {
32
- return [...entries].sort((a, b) => compareVersionsDescending(a.version, b.version));
32
+ return [...entries].sort((a, b) => compareVersionsDescending(a.version, b.version));
33
33
  }
34
34
  function readExistingEntries(filePath) {
35
- if (!existsSync(filePath)) {
36
- return [];
37
- }
38
- try {
39
- const content = readFileSync(filePath, "utf8");
40
- const parsed = JSON.parse(content);
41
- if (!isUnknownArray(parsed)) {
42
- return [];
35
+ if (!existsSync(filePath)) {
36
+ return [];
37
+ }
38
+ try {
39
+ const content = readFileSync(filePath, 'utf8');
40
+ const parsed = JSON.parse(content);
41
+ if (!isUnknownArray(parsed)) {
42
+ return [];
43
+ }
44
+ return parsed.filter(isChangelogEntry);
45
+ }
46
+ catch (error) {
47
+ console.warn(`Warning: could not parse existing ${filePath}: ${error instanceof Error ? error.message : String(error)}; treating as empty`);
48
+ return [];
43
49
  }
44
- return parsed.filter(isChangelogEntry);
45
- } catch (error) {
46
- console.warn(
47
- `Warning: could not parse existing ${filePath}: ${error instanceof Error ? error.message : String(error)}; treating as empty`
48
- );
49
- return [];
50
- }
51
50
  }
52
51
  function mergeEntries(newEntries, existingEntries) {
53
- const versionMap = /* @__PURE__ */ new Map();
54
- for (const entry of existingEntries) {
55
- versionMap.set(entry.version, entry);
56
- }
57
- for (const entry of newEntries) {
58
- versionMap.set(entry.version, entry);
59
- }
60
- return sortNewestFirst(versionMap.values());
52
+ const versionMap = new Map();
53
+ for (const entry of existingEntries) {
54
+ versionMap.set(entry.version, entry);
55
+ }
56
+ for (const entry of newEntries) {
57
+ versionMap.set(entry.version, entry);
58
+ }
59
+ return sortNewestFirst(versionMap.values());
61
60
  }
62
61
  function compareVersionsDescending(a, b) {
63
- const aValid = semver.valid(a);
64
- const bValid = semver.valid(b);
65
- if (aValid && bValid) return semver.rcompare(aValid, bValid);
66
- if (aValid) return -1;
67
- if (bValid) return 1;
68
- if (a > b) return -1;
69
- if (a < b) return 1;
70
- return 0;
62
+ const aValid = semver.valid(a);
63
+ const bValid = semver.valid(b);
64
+ if (aValid && bValid)
65
+ return semver.rcompare(aValid, bValid);
66
+ if (aValid)
67
+ return -1;
68
+ if (bValid)
69
+ return 1;
70
+ if (a > b)
71
+ return -1;
72
+ if (a < b)
73
+ return 1;
74
+ return 0;
71
75
  }
72
- export {
73
- mergeChangelogEntriesWithDisk,
74
- resolveChangelogJsonPath,
75
- upsertChangelogJson,
76
- upsertChangelogJsonAndReturn,
77
- writeChangelogJson
78
- };
@@ -1,4 +1,4 @@
1
- import type { ChangelogEntry, ChangelogItem } from './types.ts';
1
+ import type { ChangelogEntry, ChangelogItem } from './types.js';
2
2
  export declare function isChangelogItem(value: unknown): value is ChangelogItem;
3
3
  export declare function isChangelogEntry(value: unknown): value is ChangelogEntry;
4
4
  export declare function extractVersion(tag: string): string;
@@ -1,38 +1,41 @@
1
- import { existsSync, readFileSync } from "node:fs";
1
+ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { isRecord, isUnknownArray } from "./typeGuards.js";
3
- function isChangelogItem(value) {
4
- if (!isRecord(value)) return false;
5
- if (typeof value.description !== "string") return false;
6
- if (value.body !== void 0 && typeof value.body !== "string") return false;
7
- if (value.breaking !== void 0 && typeof value.breaking !== "boolean") return false;
8
- if (value.hash !== void 0 && typeof value.hash !== "string") return false;
9
- return true;
3
+ export function isChangelogItem(value) {
4
+ if (!isRecord(value))
5
+ return false;
6
+ if (typeof value.description !== 'string')
7
+ return false;
8
+ if (value.body !== undefined && typeof value.body !== 'string')
9
+ return false;
10
+ if (value.breaking !== undefined && typeof value.breaking !== 'boolean')
11
+ return false;
12
+ if (value.hash !== undefined && typeof value.hash !== 'string')
13
+ return false;
14
+ return true;
10
15
  }
11
- function isChangelogEntry(value) {
12
- return isRecord(value) && typeof value.version === "string" && typeof value.date === "string" && isUnknownArray(value.sections);
16
+ export function isChangelogEntry(value) {
17
+ return (isRecord(value) &&
18
+ typeof value.version === 'string' &&
19
+ typeof value.date === 'string' &&
20
+ isUnknownArray(value.sections));
13
21
  }
14
- function extractVersion(tag) {
15
- const match = /(\d+\.\d+\.\d+.*)$/.exec(tag);
16
- return match?.[1] ?? tag;
22
+ export function extractVersion(tag) {
23
+ const match = /(\d+\.\d+\.\d+.*)$/.exec(tag);
24
+ return match?.[1] ?? tag;
17
25
  }
18
- function readChangelogEntries(filePath) {
19
- if (!existsSync(filePath)) {
20
- return void 0;
21
- }
22
- try {
23
- const content = readFileSync(filePath, "utf8");
24
- const parsed = JSON.parse(content);
25
- if (!isUnknownArray(parsed)) {
26
- return void 0;
26
+ export function readChangelogEntries(filePath) {
27
+ if (!existsSync(filePath)) {
28
+ return undefined;
29
+ }
30
+ try {
31
+ const content = readFileSync(filePath, 'utf8');
32
+ const parsed = JSON.parse(content);
33
+ if (!isUnknownArray(parsed)) {
34
+ return undefined;
35
+ }
36
+ return parsed.filter(isChangelogEntry);
37
+ }
38
+ catch {
39
+ return undefined;
27
40
  }
28
- return parsed.filter(isChangelogEntry);
29
- } catch {
30
- return void 0;
31
- }
32
41
  }
33
- export {
34
- extractVersion,
35
- isChangelogEntry,
36
- isChangelogItem,
37
- readChangelogEntries
38
- };
@@ -1,4 +1,4 @@
1
- import type { ChangelogEntry, ChangelogOverride, WorkspaceConfig } from './types.ts';
1
+ import type { ChangelogEntry, ChangelogOverride, WorkspaceConfig } from './types.js';
2
2
  export type LoadChangelogOverridesResult = {
3
3
  overrides: Map<string, ChangelogOverride>;
4
4
  } | {