@ucdjs/release-scripts 0.1.0-beta.55 → 0.1.0-beta.57
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/dist/index.mjs +50 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -466,9 +466,11 @@ const DEFAULT_CHANGELOG_TEMPLATE = dedent`
|
|
|
466
466
|
<% } else { -%>
|
|
467
467
|
## <%= it.version %> (<%= it.date %>)
|
|
468
468
|
<% } %>
|
|
469
|
+
<% let hasCommits = false; %>
|
|
469
470
|
|
|
470
471
|
<% it.groups.forEach((group) => { %>
|
|
471
472
|
<% if (group.commits.length > 0) { %>
|
|
473
|
+
<% hasCommits = true; %>
|
|
472
474
|
|
|
473
475
|
### <%= group.title %>
|
|
474
476
|
<% group.commits.forEach((commit) => { %>
|
|
@@ -478,6 +480,12 @@ const DEFAULT_CHANGELOG_TEMPLATE = dedent`
|
|
|
478
480
|
|
|
479
481
|
<% } %>
|
|
480
482
|
<% }); %>
|
|
483
|
+
|
|
484
|
+
<% if (!hasCommits) { %>
|
|
485
|
+
*No significant changes*
|
|
486
|
+
|
|
487
|
+
##### [View changes on GitHub](<%= it.compareUrl %>)
|
|
488
|
+
<% } %>
|
|
481
489
|
`;
|
|
482
490
|
const DEFAULT_TYPES = {
|
|
483
491
|
feat: { title: "🚀 Features" },
|
|
@@ -1356,6 +1364,23 @@ async function selectVersionPrompt(workspaceRoot, pkg, currentVersion, suggested
|
|
|
1356
1364
|
if (prereleaseVersion) return prereleaseVersion;
|
|
1357
1365
|
return getNextVersion(pkg.version, answers.version);
|
|
1358
1366
|
}
|
|
1367
|
+
async function confirmOverridePrompt(pkg, overrideVersion) {
|
|
1368
|
+
const response = await prompts({
|
|
1369
|
+
type: "select",
|
|
1370
|
+
name: "choice",
|
|
1371
|
+
message: `${pkg.name}: use override version ${farver.bold(overrideVersion)}?`,
|
|
1372
|
+
choices: [{
|
|
1373
|
+
title: "use override",
|
|
1374
|
+
value: "use"
|
|
1375
|
+
}, {
|
|
1376
|
+
title: "pick another version",
|
|
1377
|
+
value: "pick"
|
|
1378
|
+
}],
|
|
1379
|
+
initial: 0
|
|
1380
|
+
});
|
|
1381
|
+
if (!response.choice) return null;
|
|
1382
|
+
return response.choice;
|
|
1383
|
+
}
|
|
1359
1384
|
|
|
1360
1385
|
//#endregion
|
|
1361
1386
|
//#region src/core/workspace.ts
|
|
@@ -1883,16 +1908,33 @@ async function calculateVersionUpdates({ workspacePackages, packageCommits, work
|
|
|
1883
1908
|
const effectiveBump = override?.type || determinedBump;
|
|
1884
1909
|
const canPrompt = !isCI && showPrompt;
|
|
1885
1910
|
if (effectiveBump === "none" && !canPrompt) continue;
|
|
1886
|
-
|
|
1911
|
+
const autoVersion = getNextVersion(pkg.version, determinedBump);
|
|
1912
|
+
let newVersion = override?.version || autoVersion;
|
|
1887
1913
|
let finalBumpType = effectiveBump;
|
|
1888
1914
|
if (canPrompt) {
|
|
1889
1915
|
logger.clearScreen();
|
|
1890
1916
|
logger.section(`📝 Commits for ${farver.cyan(pkg.name)}`);
|
|
1891
1917
|
formatCommitsForDisplay(allCommitsForPackage).split("\n").forEach((line) => logger.item(line));
|
|
1892
1918
|
logger.emptyLine();
|
|
1919
|
+
if (override) {
|
|
1920
|
+
const overrideChoice = await confirmOverridePrompt(pkg, override.version);
|
|
1921
|
+
if (overrideChoice === null) continue;
|
|
1922
|
+
if (overrideChoice === "use") {
|
|
1923
|
+
versionUpdates.push({
|
|
1924
|
+
package: pkg,
|
|
1925
|
+
currentVersion: pkg.version,
|
|
1926
|
+
newVersion: override.version,
|
|
1927
|
+
bumpType: override.type,
|
|
1928
|
+
hasDirectChanges: allCommitsForPackage.length > 0,
|
|
1929
|
+
changeKind: "manual"
|
|
1930
|
+
});
|
|
1931
|
+
continue;
|
|
1932
|
+
}
|
|
1933
|
+
newVersion = autoVersion;
|
|
1934
|
+
}
|
|
1893
1935
|
const selectedVersion = await selectVersionPrompt(workspaceRoot, pkg, pkg.version, newVersion, {
|
|
1894
1936
|
defaultChoice: override ? "suggested" : "auto",
|
|
1895
|
-
suggestedHint: override ? "
|
|
1937
|
+
suggestedHint: override ? "auto" : void 0
|
|
1896
1938
|
});
|
|
1897
1939
|
if (selectedVersion === null) continue;
|
|
1898
1940
|
const userBump = calculateBumpType(pkg.version, selectedVersion);
|
|
@@ -2060,10 +2102,12 @@ async function calculateUpdates(options) {
|
|
|
2060
2102
|
overrides
|
|
2061
2103
|
}));
|
|
2062
2104
|
} catch (error) {
|
|
2105
|
+
const formatted = formatUnknownError(error);
|
|
2063
2106
|
return err({
|
|
2064
2107
|
type: "git",
|
|
2065
2108
|
operation: "calculateUpdates",
|
|
2066
|
-
message:
|
|
2109
|
+
message: formatted.message,
|
|
2110
|
+
stderr: formatted.stderr
|
|
2067
2111
|
});
|
|
2068
2112
|
}
|
|
2069
2113
|
}
|
|
@@ -2214,10 +2258,7 @@ async function prepareWorkflow(options) {
|
|
|
2214
2258
|
}
|
|
2215
2259
|
}
|
|
2216
2260
|
const allCommits = [...pkgCommits, ...globalCommits];
|
|
2217
|
-
if (allCommits.length === 0) {
|
|
2218
|
-
logger.verbose(`No commits for ${update.package.name}, skipping changelog`);
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2261
|
+
if (allCommits.length === 0) logger.verbose(`No commits for ${update.package.name}, writing changelog entry with no-significant-commits note`);
|
|
2221
2262
|
logger.verbose(`Updating changelog for ${farver.cyan(update.package.name)}`);
|
|
2222
2263
|
await updateChangelog({
|
|
2223
2264
|
normalizedOptions: {
|
|
@@ -2422,6 +2463,8 @@ async function getReleaseBodyFromChangelog(workspaceRoot, packageName, packagePa
|
|
|
2422
2463
|
"",
|
|
2423
2464
|
`Expected version ${version} in ${changelogPath}.`
|
|
2424
2465
|
].join("\n");
|
|
2466
|
+
const lines = entry.content.trim().split("\n");
|
|
2467
|
+
if (lines[0]?.trim().startsWith("## ")) return lines.slice(1).join("\n").trim();
|
|
2425
2468
|
return entry.content.trim();
|
|
2426
2469
|
} catch {
|
|
2427
2470
|
logger.verbose(`Could not read changelog entry for ${version} at ${changelogPath}`);
|