@ucdjs/release-scripts 0.1.0-beta.54 → 0.1.0-beta.56
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 +36 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -467,8 +467,11 @@ const DEFAULT_CHANGELOG_TEMPLATE = dedent`
|
|
|
467
467
|
## <%= it.version %> (<%= it.date %>)
|
|
468
468
|
<% } %>
|
|
469
469
|
|
|
470
|
+
<% let hasCommits = false; %>
|
|
471
|
+
|
|
470
472
|
<% it.groups.forEach((group) => { %>
|
|
471
473
|
<% if (group.commits.length > 0) { %>
|
|
474
|
+
<% hasCommits = true; %>
|
|
472
475
|
|
|
473
476
|
### <%= group.title %>
|
|
474
477
|
<% group.commits.forEach((commit) => { %>
|
|
@@ -478,6 +481,13 @@ const DEFAULT_CHANGELOG_TEMPLATE = dedent`
|
|
|
478
481
|
|
|
479
482
|
<% } %>
|
|
480
483
|
<% }); %>
|
|
484
|
+
|
|
485
|
+
<% if (!hasCommits) { %>
|
|
486
|
+
|
|
487
|
+
### Notes
|
|
488
|
+
|
|
489
|
+
* No significant commits in this release.
|
|
490
|
+
<% } %>
|
|
481
491
|
`;
|
|
482
492
|
const DEFAULT_TYPES = {
|
|
483
493
|
feat: { title: "🚀 Features" },
|
|
@@ -2214,10 +2224,7 @@ async function prepareWorkflow(options) {
|
|
|
2214
2224
|
}
|
|
2215
2225
|
}
|
|
2216
2226
|
const allCommits = [...pkgCommits, ...globalCommits];
|
|
2217
|
-
if (allCommits.length === 0) {
|
|
2218
|
-
logger.verbose(`No commits for ${update.package.name}, skipping changelog`);
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2227
|
+
if (allCommits.length === 0) logger.verbose(`No commits for ${update.package.name}, writing changelog entry with no-significant-commits note`);
|
|
2221
2228
|
logger.verbose(`Updating changelog for ${farver.cyan(update.package.name)}`);
|
|
2222
2229
|
await updateChangelog({
|
|
2223
2230
|
normalizedOptions: {
|
|
@@ -2411,6 +2418,29 @@ async function publishPackage(packageName, version, workspaceRoot, options) {
|
|
|
2411
2418
|
|
|
2412
2419
|
//#endregion
|
|
2413
2420
|
//#region src/workflows/publish.ts
|
|
2421
|
+
async function getReleaseBodyFromChangelog(workspaceRoot, packageName, packagePath, version) {
|
|
2422
|
+
const changelogPath = join(packagePath, "CHANGELOG.md");
|
|
2423
|
+
try {
|
|
2424
|
+
const entry = parseChangelog(await readFile(changelogPath, "utf-8")).versions.find((v) => v.version === version);
|
|
2425
|
+
if (!entry) return [
|
|
2426
|
+
`## ${packageName}@${version}`,
|
|
2427
|
+
"",
|
|
2428
|
+
"⚠️ Could not find a matching changelog entry for this version.",
|
|
2429
|
+
"",
|
|
2430
|
+
`Expected version ${version} in ${changelogPath}.`
|
|
2431
|
+
].join("\n");
|
|
2432
|
+
return entry.content.trim();
|
|
2433
|
+
} catch {
|
|
2434
|
+
logger.verbose(`Could not read changelog entry for ${version} at ${changelogPath}`);
|
|
2435
|
+
return [
|
|
2436
|
+
`## ${packageName}@${version}`,
|
|
2437
|
+
"",
|
|
2438
|
+
"⚠️ Could not read package changelog while creating this release.",
|
|
2439
|
+
"",
|
|
2440
|
+
`Expected changelog file: ${changelogPath}`
|
|
2441
|
+
].join("\n");
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2414
2444
|
async function cleanupPublishedOverrides(options, workspacePackages, publishedPackageNames) {
|
|
2415
2445
|
if (publishedPackageNames.length === 0) return false;
|
|
2416
2446
|
if (options.dryRun) {
|
|
@@ -2508,9 +2538,11 @@ async function publishWorkflow(options) {
|
|
|
2508
2538
|
logger.success(`Created and pushed tag ${farver.cyan(tagName)}`);
|
|
2509
2539
|
logger.step(`Creating GitHub release for ${farver.cyan(tagName)}...`);
|
|
2510
2540
|
try {
|
|
2541
|
+
const releaseBody = await getReleaseBodyFromChangelog(options.workspaceRoot, packageName, pkg.path, version);
|
|
2511
2542
|
const releaseResult = await options.githubClient.upsertReleaseByTag({
|
|
2512
2543
|
tagName,
|
|
2513
2544
|
name: tagName,
|
|
2545
|
+
body: releaseBody,
|
|
2514
2546
|
prerelease: Boolean(semver.prerelease(version))
|
|
2515
2547
|
});
|
|
2516
2548
|
if (releaseResult.release.htmlUrl) logger.success(`${releaseResult.created ? "Created" : "Updated"} GitHub release: ${releaseResult.release.htmlUrl}`);
|