@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.
- package/CHANGELOG.md +32 -0
- package/README.md +12 -12
- package/dist/esm/.cache +1 -1
- package/dist/esm/assertCleanWorkingTree.js +9 -14
- package/dist/esm/bin/release-kit.js +202 -229
- package/dist/esm/buildChangelogEntries.d.ts +2 -2
- package/dist/esm/buildChangelogEntries.js +142 -149
- package/dist/esm/buildDependencyGraph.d.ts +1 -1
- package/dist/esm/buildDependencyGraph.js +60 -59
- package/dist/esm/buildEmptyReleaseEntry.d.ts +1 -1
- package/dist/esm/buildEmptyReleaseEntry.js +12 -15
- package/dist/esm/buildReleaseSummary.d.ts +1 -1
- package/dist/esm/buildReleaseSummary.js +23 -26
- package/dist/esm/buildSyntheticChangelogEntry.d.ts +1 -1
- package/dist/esm/buildSyntheticChangelogEntry.js +9 -12
- package/dist/esm/bumpAllVersions.d.ts +1 -1
- package/dist/esm/bumpAllVersions.js +51 -52
- package/dist/esm/bumpVersion.d.ts +1 -1
- package/dist/esm/bumpVersion.js +25 -28
- package/dist/esm/changelogJsonFile.d.ts +1 -1
- package/dist/esm/changelogJsonFile.js +59 -62
- package/dist/esm/changelogJsonUtils.d.ts +1 -1
- package/dist/esm/changelogJsonUtils.js +35 -32
- package/dist/esm/changelogOverrides.d.ts +1 -1
- package/dist/esm/changelogOverrides.js +374 -377
- package/dist/esm/checkWorkTypesDrift.js +104 -99
- package/dist/esm/collectPolicyViolations.d.ts +2 -2
- package/dist/esm/collectPolicyViolations.js +11 -14
- package/dist/esm/commitCommand.js +48 -53
- package/dist/esm/compareVersions.js +20 -23
- package/dist/esm/createGithubRelease.js +56 -59
- package/dist/esm/createGithubReleaseCommand.js +21 -29
- package/dist/esm/createTags.js +57 -56
- package/dist/esm/decideRelease.d.ts +2 -2
- package/dist/esm/decideRelease.js +27 -41
- package/dist/esm/defaults.d.ts +3 -3
- package/dist/esm/defaults.js +36 -48
- package/dist/esm/deleteFileIfExists.js +10 -12
- package/dist/esm/deriveWorkspaceConfig.d.ts +1 -1
- package/dist/esm/deriveWorkspaceConfig.js +34 -36
- package/dist/esm/detectPackageManager.js +35 -37
- package/dist/esm/detectUndeclaredTagPrefixes.js +41 -40
- package/dist/esm/determineBumpFromCommits.d.ts +2 -2
- package/dist/esm/determineBumpFromCommits.js +25 -29
- package/dist/esm/determineBumpType.d.ts +1 -1
- package/dist/esm/determineBumpType.js +31 -32
- package/dist/esm/discoverWorkspaces.js +38 -40
- package/dist/esm/format.js +6 -11
- package/dist/esm/generateChangelogs.d.ts +1 -1
- package/dist/esm/generateChangelogs.js +13 -17
- package/dist/esm/getCommitsSinceTarget.d.ts +1 -1
- package/dist/esm/getCommitsSinceTarget.js +54 -55
- package/dist/esm/hasPrettierConfig.js +33 -35
- package/dist/esm/help/prepareHelp.d.ts +2 -0
- package/dist/esm/help/prepareHelp.js +26 -0
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +2 -8
- package/dist/esm/init/checks.js +28 -32
- package/dist/esm/init/detectRepoType.js +12 -15
- package/dist/esm/init/initCommand.js +60 -54
- package/dist/esm/init/parseJsonRecord.js +9 -11
- package/dist/esm/init/scaffold.d.ts +1 -1
- package/dist/esm/init/scaffold.js +32 -38
- package/dist/esm/init/templates.d.ts +1 -1
- package/dist/esm/init/templates.js +16 -22
- package/dist/esm/injectReleaseNotesIntoReadme.js +42 -49
- package/dist/esm/injectSection.js +17 -27
- package/dist/esm/loadConfig.d.ts +1 -1
- package/dist/esm/loadConfig.js +206 -225
- package/dist/esm/parseCommitMessage.d.ts +1 -1
- package/dist/esm/parseCommitMessage.js +72 -76
- package/dist/esm/parseRequestedTags.js +6 -9
- package/dist/esm/prepareCommand.d.ts +32 -1
- package/dist/esm/prepareCommand.js +225 -271
- package/dist/esm/previewTagPrefixes.d.ts +1 -1
- package/dist/esm/previewTagPrefixes.js +101 -96
- package/dist/esm/propagateBumps.d.ts +2 -2
- package/dist/esm/propagateBumps.js +48 -50
- package/dist/esm/publish.d.ts +2 -2
- package/dist/esm/publish.js +22 -28
- package/dist/esm/publishCommand.js +75 -86
- package/dist/esm/pushCommand.js +33 -40
- package/dist/esm/pushRelease.d.ts +1 -1
- package/dist/esm/pushRelease.js +21 -24
- package/dist/esm/readCurrentVersion.js +13 -17
- package/dist/esm/releasePrepare.d.ts +1 -1
- package/dist/esm/releasePrepare.js +213 -231
- package/dist/esm/releasePrepareMono.d.ts +2 -2
- package/dist/esm/releasePrepareMono.js +434 -493
- package/dist/esm/releasePrepareProject.d.ts +2 -2
- package/dist/esm/releasePrepareProject.js +143 -153
- package/dist/esm/renderChangelogMarkdown.d.ts +1 -1
- package/dist/esm/renderChangelogMarkdown.js +20 -24
- package/dist/esm/renderReleaseNotes.d.ts +1 -1
- package/dist/esm/renderReleaseNotes.js +50 -55
- package/dist/esm/reportPrepare.d.ts +1 -1
- package/dist/esm/reportPrepare.js +230 -231
- package/dist/esm/resolveCliffConfigPath.js +18 -23
- package/dist/esm/resolveCommandTags.d.ts +1 -1
- package/dist/esm/resolveCommandTags.js +47 -44
- package/dist/esm/resolveReleaseNotesConfig.d.ts +1 -1
- package/dist/esm/resolveReleaseNotesConfig.js +39 -41
- package/dist/esm/resolveReleaseTags.d.ts +1 -1
- package/dist/esm/resolveReleaseTags.js +39 -40
- package/dist/esm/runGitCliff.js +27 -30
- package/dist/esm/showTagPrefixesCommand.js +48 -70
- package/dist/esm/stripEmojiPrefix.js +2 -5
- package/dist/esm/stripScope.js +18 -21
- package/dist/esm/sync-labels/generateCommand.d.ts +1 -1
- package/dist/esm/sync-labels/generateCommand.js +51 -52
- package/dist/esm/sync-labels/initCommand.js +46 -47
- package/dist/esm/sync-labels/loadSyncLabelsConfig.d.ts +1 -1
- package/dist/esm/sync-labels/loadSyncLabelsConfig.js +46 -52
- package/dist/esm/sync-labels/presets.d.ts +1 -1
- package/dist/esm/sync-labels/presets.js +40 -43
- package/dist/esm/sync-labels/resolveLabels.d.ts +1 -1
- package/dist/esm/sync-labels/resolveLabels.js +28 -35
- package/dist/esm/sync-labels/syncCommand.js +30 -30
- package/dist/esm/sync-labels/templates.d.ts +1 -1
- package/dist/esm/sync-labels/templates.js +23 -26
- package/dist/esm/sync-labels/types.js +1 -0
- package/dist/esm/syncWorkTypes.js +83 -81
- package/dist/esm/tagCommand.js +12 -21
- package/dist/esm/typeGuards.js +4 -8
- package/dist/esm/types.js +66 -60
- package/dist/esm/validateConfig.d.ts +1 -1
- package/dist/esm/validateConfig.js +109 -115
- package/dist/esm/validateOnlyExcludesStrandedDependents.d.ts +2 -2
- package/dist/esm/validateOnlyExcludesStrandedDependents.js +97 -91
- package/dist/esm/validateOverridesCommand.d.ts +2 -2
- package/dist/esm/validateOverridesCommand.js +111 -111
- package/dist/esm/workTypesData.js +57 -60
- package/dist/esm/workTypesUtils.js +16 -21
- package/dist/esm/writeReleaseNotesPreviews.js +55 -57
- package/package.json +2 -6
|
@@ -1,254 +1,253 @@
|
|
|
1
1
|
import { bold, dim, sectionHeader } from "./format.js";
|
|
2
|
-
function reportPrepare(result) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export function reportPrepare(result) {
|
|
3
|
+
const isMultiWorkspace = result.workspaces.some((w) => w.name !== undefined) || result.project !== undefined;
|
|
4
|
+
if (isMultiWorkspace) {
|
|
5
|
+
return formatMultiWorkspace(result);
|
|
6
|
+
}
|
|
7
|
+
return formatSingleWorkspace(result);
|
|
8
8
|
}
|
|
9
9
|
function formatSingleWorkspace(result) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
10
|
+
const lines = [];
|
|
11
|
+
const workspace = result.workspaces[0];
|
|
12
|
+
if (workspace === undefined) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
const since = workspace.previousTag === undefined ? 'the beginning' : workspace.previousTag;
|
|
16
|
+
lines.push(dim(`Found ${workspace.commitCount} commits since ${since}`));
|
|
17
|
+
if (workspace.parsedCommitCount !== undefined) {
|
|
18
|
+
lines.push(dim(` Parsed ${workspace.parsedCommitCount} typed commits`));
|
|
19
|
+
}
|
|
20
|
+
formatUnparseableWarning(lines, workspace);
|
|
21
|
+
formatPolicyViolations(lines, workspace.policyViolations);
|
|
22
|
+
if (workspace.status === 'skipped') {
|
|
23
|
+
lines.push(`⏭️ ${workspace.skipReason}`);
|
|
24
|
+
return lines.join('\n');
|
|
25
|
+
}
|
|
26
|
+
if (workspace.setVersion !== undefined) {
|
|
27
|
+
lines.push(` Using version override: ${workspace.setVersion}`);
|
|
28
|
+
}
|
|
29
|
+
else if (workspace.bumpOverride !== undefined) {
|
|
30
|
+
lines.push(` Using bump override: ${workspace.bumpOverride}`);
|
|
31
|
+
}
|
|
32
|
+
if (workspace.releaseType !== undefined) {
|
|
33
|
+
lines.push(dim(`Bumping versions (${workspace.releaseType})...`));
|
|
34
|
+
}
|
|
35
|
+
else if (workspace.setVersion !== undefined) {
|
|
36
|
+
lines.push(dim(`Bumping versions (version override)...`));
|
|
37
|
+
}
|
|
38
|
+
if (workspace.setVersion !== undefined) {
|
|
39
|
+
lines.push(`📦 ${workspace.currentVersion} → ${bold(workspace.newVersion)} (version override)`);
|
|
40
|
+
}
|
|
41
|
+
else if (workspace.releaseType !== undefined) {
|
|
42
|
+
lines.push(`📦 ${workspace.currentVersion} → ${bold(workspace.newVersion)} (${workspace.releaseType})`);
|
|
43
|
+
}
|
|
44
|
+
formatBumpFiles(lines, workspace, result.dryRun);
|
|
45
|
+
lines.push(dim('Generating changelogs...'));
|
|
46
|
+
formatChangelogFiles(lines, workspace, result.dryRun);
|
|
47
|
+
formatFormatCommand(lines, result);
|
|
48
|
+
lines.push(`✅ Release preparation complete.`, ` 🏷️ ${bold(workspace.tag)}`);
|
|
49
|
+
return lines.join('\n');
|
|
47
50
|
}
|
|
48
51
|
function formatMultiWorkspace(result) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return lines.join("\n");
|
|
52
|
+
const lines = [];
|
|
53
|
+
for (const workspace of result.workspaces) {
|
|
54
|
+
formatWorkspaceSection(lines, workspace, result.dryRun);
|
|
55
|
+
}
|
|
56
|
+
if (result.project !== undefined) {
|
|
57
|
+
formatProjectSection(lines, result.project, result.dryRun);
|
|
58
|
+
}
|
|
59
|
+
formatFormatCommand(lines, result);
|
|
60
|
+
formatWarnings(lines, result);
|
|
61
|
+
if (result.tags.length > 0) {
|
|
62
|
+
lines.push(`\n✅ Release preparation complete.`);
|
|
63
|
+
for (const tag of result.tags) {
|
|
64
|
+
lines.push(` 🏷️ ${bold(tag)}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
lines.push(`\n⏭️ No workspaces had release-worthy changes.`);
|
|
69
|
+
}
|
|
70
|
+
return lines.join('\n');
|
|
69
71
|
}
|
|
70
72
|
function formatProjectSection(lines, project, dryRun) {
|
|
71
|
-
|
|
72
|
-
${
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
lines.push(` \u{1F3F7}\uFE0F ${bold(tag)}`);
|
|
73
|
+
lines.push(`\n${sectionHeader('project')}`);
|
|
74
|
+
const since = project.previousTag === undefined ? '(no previous release found)' : `since ${project.previousTag}`;
|
|
75
|
+
lines.push(dim(` Found ${project.commitCount} commits ${since}`));
|
|
76
|
+
formatPolicyViolations(lines, project.policyViolations, ' ');
|
|
77
|
+
if (project.status === 'skipped') {
|
|
78
|
+
lines.push(` ⏭️ ${project.skipReason}`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const { releaseType, currentVersion, newVersion, tag } = project;
|
|
82
|
+
if (project.parsedCommitCount > 0) {
|
|
83
|
+
lines.push(dim(` Parsed ${project.parsedCommitCount} typed commits`));
|
|
84
|
+
}
|
|
85
|
+
if (project.bumpOverride !== undefined) {
|
|
86
|
+
lines.push(` Using bump override: ${project.bumpOverride}`);
|
|
87
|
+
}
|
|
88
|
+
formatProjectUnparseable(lines, project);
|
|
89
|
+
lines.push(dim(` Bumping versions (${releaseType})...`), ` 📦 ${currentVersion} → ${bold(newVersion)} (${releaseType})`);
|
|
90
|
+
for (const file of project.bumpedFiles) {
|
|
91
|
+
if (dryRun) {
|
|
92
|
+
lines.push(dim(` [dry-run] Would bump ${file}`));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
lines.push(dim(` Bumped ${file}`));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
lines.push(dim(' Generating changelogs...'));
|
|
99
|
+
for (const file of project.changelogFiles) {
|
|
100
|
+
if (dryRun) {
|
|
101
|
+
lines.push(dim(` [dry-run] Would run: npx --yes git-cliff ... --output ${file}`));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
lines.push(dim(` Generating changelog: ${file}`));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
lines.push(` 🏷️ ${bold(tag)}`);
|
|
108
108
|
}
|
|
109
109
|
function formatProjectUnparseable(lines, project) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
110
|
+
const unparseable = project.unparseableCommits;
|
|
111
|
+
if (unparseable === undefined || unparseable.length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const count = unparseable.length;
|
|
115
|
+
const isPatchFloor = project.parsedCommitCount === 0;
|
|
116
|
+
const suffix = isPatchFloor ? ' (defaulting to patch bump)' : '';
|
|
117
|
+
lines.push(` ⚠️ ${count} commit${count === 1 ? '' : 's'} could not be parsed${suffix}`);
|
|
118
|
+
for (const commit of unparseable) {
|
|
119
|
+
const shortHash = commit.hash.slice(0, 7);
|
|
120
|
+
const truncatedMessage = commit.message.length > 72 ? `${commit.message.slice(0, 69)}...` : commit.message;
|
|
121
|
+
lines.push(` · ${shortHash} ${truncatedMessage}`);
|
|
122
|
+
}
|
|
123
123
|
}
|
|
124
124
|
function formatWorkspaceSection(lines, workspace, dryRun) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
lines.push(` \u{1F3F7}\uFE0F ${bold(workspace.tag)}`);
|
|
125
|
+
if (workspace.name !== undefined) {
|
|
126
|
+
lines.push(`\n${sectionHeader(workspace.name)}`);
|
|
127
|
+
}
|
|
128
|
+
const since = workspace.previousTag === undefined ? '(no previous release found)' : `since ${workspace.previousTag}`;
|
|
129
|
+
lines.push(dim(` Found ${workspace.commitCount} commits ${since}`));
|
|
130
|
+
if (workspace.status === 'skipped') {
|
|
131
|
+
lines.push(` ⏭️ ${workspace.skipReason}`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const { propagatedFrom } = workspace;
|
|
135
|
+
const isPropagatedOnly = propagatedFrom !== undefined && workspace.commitCount === 0;
|
|
136
|
+
formatCommitSummary(lines, workspace, propagatedFrom, isPropagatedOnly);
|
|
137
|
+
formatUnparseableWarning(lines, workspace, ' ');
|
|
138
|
+
formatPolicyViolations(lines, workspace.policyViolations, ' ');
|
|
139
|
+
formatBumpLabels(lines, workspace, isPropagatedOnly);
|
|
140
|
+
formatVersionLine(lines, workspace, propagatedFrom, isPropagatedOnly);
|
|
141
|
+
formatBumpFiles(lines, workspace, dryRun, ' ');
|
|
142
|
+
lines.push(dim(' Generating changelogs...'));
|
|
143
|
+
formatChangelogFiles(lines, workspace, dryRun, ' ');
|
|
144
|
+
lines.push(` 🏷️ ${bold(workspace.tag)}`);
|
|
146
145
|
}
|
|
147
146
|
function formatCommitSummary(lines, workspace, propagatedFrom, isPropagatedOnly) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
147
|
+
if (isPropagatedOnly && propagatedFrom !== undefined) {
|
|
148
|
+
const depNames = propagatedFrom.map((p) => p.packageName).join(', ');
|
|
149
|
+
lines.push(dim(` 0 commits (bumped via dependency: ${depNames})`));
|
|
150
|
+
}
|
|
151
|
+
else if (workspace.parsedCommitCount !== undefined && workspace.parsedCommitCount > 0) {
|
|
152
|
+
lines.push(dim(` Parsed ${workspace.parsedCommitCount} typed commits`));
|
|
153
|
+
}
|
|
154
154
|
}
|
|
155
155
|
function formatBumpLabels(lines, workspace, isPropagatedOnly) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
if (workspace.setVersion !== undefined) {
|
|
157
|
+
lines.push(` Using version override: ${workspace.setVersion}`);
|
|
158
|
+
}
|
|
159
|
+
else if (workspace.bumpOverride !== undefined && !isPropagatedOnly) {
|
|
160
|
+
lines.push(` Using bump override: ${workspace.bumpOverride}`);
|
|
161
|
+
}
|
|
162
|
+
if (workspace.releaseType !== undefined) {
|
|
163
|
+
lines.push(dim(` Bumping versions (${workspace.releaseType})...`));
|
|
164
|
+
}
|
|
165
|
+
else if (workspace.setVersion !== undefined) {
|
|
166
|
+
lines.push(dim(` Bumping versions (version override)...`));
|
|
167
|
+
}
|
|
166
168
|
}
|
|
167
169
|
function formatVersionLine(lines, workspace, propagatedFrom, isPropagatedOnly) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
170
|
+
if (workspace.setVersion !== undefined) {
|
|
171
|
+
lines.push(` 📦 ${workspace.currentVersion} → ${bold(workspace.newVersion)} (version override)`);
|
|
172
|
+
}
|
|
173
|
+
else if (workspace.releaseType !== undefined) {
|
|
174
|
+
const suffix = isPropagatedOnly ? formatPropagationSuffix(propagatedFrom) : '';
|
|
175
|
+
lines.push(` 📦 ${workspace.currentVersion} → ${bold(workspace.newVersion)} (${workspace.releaseType}${suffix})`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function formatBumpFiles(lines, workspace, dryRun, indent = '') {
|
|
179
|
+
for (const file of workspace.bumpedFiles) {
|
|
180
|
+
if (dryRun) {
|
|
181
|
+
lines.push(dim(`${indent} [dry-run] Would bump ${file}`));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
lines.push(dim(`${indent} Bumped ${file}`));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function formatChangelogFiles(lines, workspace, dryRun, indent = '') {
|
|
189
|
+
for (const file of workspace.changelogFiles) {
|
|
190
|
+
if (dryRun) {
|
|
191
|
+
lines.push(dim(`${indent} [dry-run] Would run: npx --yes git-cliff ... --output ${file}`));
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
lines.push(dim(`${indent} Generating changelog: ${file}`));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function formatUnparseableWarning(lines, workspace, indent = '') {
|
|
199
|
+
const unparseable = workspace.unparseableCommits;
|
|
200
|
+
if (unparseable === undefined || unparseable.length === 0) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const count = unparseable.length;
|
|
204
|
+
const isPatchFloor = workspace.parsedCommitCount === 0;
|
|
205
|
+
const suffix = isPatchFloor ? ' (defaulting to patch bump)' : '';
|
|
206
|
+
lines.push(`${indent} ⚠️ ${count} commit${count === 1 ? '' : 's'} could not be parsed${suffix}`);
|
|
207
|
+
for (const commit of unparseable) {
|
|
208
|
+
const shortHash = commit.hash.slice(0, 7);
|
|
209
|
+
const truncatedMessage = commit.message.length > 72 ? `${commit.message.slice(0, 69)}...` : commit.message;
|
|
210
|
+
lines.push(`${indent} · ${shortHash} ${truncatedMessage}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function formatPolicyViolations(lines, violations, indent = '') {
|
|
214
|
+
if (violations === undefined || violations.length === 0) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const count = violations.length;
|
|
218
|
+
lines.push(`${indent} ⚠️ ${count} policy violation${count === 1 ? '' : 's'}:`);
|
|
219
|
+
for (const violation of violations) {
|
|
220
|
+
const shortHash = violation.commitHash.slice(0, 7);
|
|
221
|
+
const subject = violation.commitSubject;
|
|
222
|
+
const truncatedSubject = subject.length > 72 ? `${subject.slice(0, 69)}...` : subject;
|
|
223
|
+
lines.push(`${indent} · ${shortHash} '${truncatedSubject}' — type '${violation.type}' at ${violation.surface} surface`);
|
|
224
|
+
}
|
|
222
225
|
}
|
|
223
226
|
function formatPropagationSuffix(propagatedFrom) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
if (propagatedFrom === undefined || propagatedFrom.length === 0) {
|
|
228
|
+
return '';
|
|
229
|
+
}
|
|
230
|
+
const names = propagatedFrom.map((p) => p.packageName).join(', ');
|
|
231
|
+
return `, dependency: ${names}`;
|
|
229
232
|
}
|
|
230
233
|
function formatWarnings(lines, result) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
const { warnings } = result;
|
|
235
|
+
if (warnings === undefined || warnings.length === 0) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
lines.push('');
|
|
239
|
+
for (const warning of warnings) {
|
|
240
|
+
lines.push(`⚠️ ${warning}`);
|
|
241
|
+
}
|
|
239
242
|
}
|
|
240
243
|
function formatFormatCommand(lines, result) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
export {
|
|
253
|
-
reportPrepare
|
|
254
|
-
};
|
|
244
|
+
if (result.formatCommand === undefined) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (result.formatCommand.executed) {
|
|
248
|
+
lines.push(dim(`\n Running format command: ${result.formatCommand.command}`));
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
lines.push(dim(`\n [dry-run] Would run format command: ${result.formatCommand.command}`));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import { resolve } from
|
|
3
|
-
import { findPackageRoot } from
|
|
4
|
-
function resolveCliffConfigPath(cliffConfigPath, metaUrl) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
const candidates = [".config/git-cliff.toml", "cliff.toml"];
|
|
9
|
-
for (const candidate of candidates) {
|
|
10
|
-
if (existsSync(candidate)) {
|
|
11
|
-
return candidate;
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { findPackageRoot } from '@williamthorsen/nmr-core';
|
|
4
|
+
export function resolveCliffConfigPath(cliffConfigPath, metaUrl) {
|
|
5
|
+
if (cliffConfigPath !== undefined) {
|
|
6
|
+
return cliffConfigPath;
|
|
12
7
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const candidates = ['.config/git-cliff.toml', 'cliff.toml'];
|
|
9
|
+
for (const candidate of candidates) {
|
|
10
|
+
if (existsSync(candidate)) {
|
|
11
|
+
return candidate;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const root = findPackageRoot(metaUrl);
|
|
15
|
+
const bundledPath = resolve(root, 'cliff.toml.template');
|
|
16
|
+
if (existsSync(bundledPath)) {
|
|
17
|
+
return bundledPath;
|
|
18
|
+
}
|
|
19
|
+
throw new Error(`Could not resolve a git-cliff config file. Searched: ${candidates.join(', ')}, and bundled template at ${bundledPath}`);
|
|
22
20
|
}
|
|
23
|
-
export {
|
|
24
|
-
resolveCliffConfigPath
|
|
25
|
-
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ResolvedTag } from './resolveReleaseTags.
|
|
1
|
+
import type { ResolvedTag } from './resolveReleaseTags.js';
|
|
2
2
|
export declare function resolveCommandTags(tags: string[] | undefined): Promise<ResolvedTag[]>;
|