@ucdjs/release-scripts 0.1.1 → 0.1.5
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 +42 -16
- package/package.json +18 -14
package/dist/index.mjs
CHANGED
|
@@ -222,7 +222,7 @@ function exitWithError(message, hint, cause) {
|
|
|
222
222
|
const HASH_PREFIX_RE = /^#/;
|
|
223
223
|
function formatCommitLine({ commit, owner, repo, authors }) {
|
|
224
224
|
const commitUrl = `https://github.com/${owner}/${repo}/commit/${commit.hash}`;
|
|
225
|
-
let line =
|
|
225
|
+
let line = commit.description;
|
|
226
226
|
const references = commit.references ?? [];
|
|
227
227
|
for (const ref of references) {
|
|
228
228
|
if (!ref.value) continue;
|
|
@@ -291,8 +291,8 @@ var GitHubClient = class {
|
|
|
291
291
|
...init,
|
|
292
292
|
headers: {
|
|
293
293
|
...init.headers,
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
Accept: "application/vnd.github.v3+json",
|
|
295
|
+
Authorization: `token ${this.githubToken}`,
|
|
296
296
|
"User-Agent": "ucdjs-release-scripts (+https://github.com/ucdjs/ucdjs-release-scripts)"
|
|
297
297
|
}
|
|
298
298
|
});
|
|
@@ -464,28 +464,42 @@ function dedentString(str) {
|
|
|
464
464
|
function generatePullRequestBody(updates, body) {
|
|
465
465
|
const eta = new Eta();
|
|
466
466
|
const bodyTemplate = body ? dedentString(body) : DEFAULT_PR_BODY_TEMPLATE;
|
|
467
|
-
|
|
467
|
+
const allPackages = updates.map((u) => ({
|
|
468
468
|
name: u.package.name,
|
|
469
469
|
currentVersion: u.currentVersion,
|
|
470
470
|
newVersion: u.newVersion,
|
|
471
471
|
bumpType: u.bumpType,
|
|
472
|
-
hasDirectChanges: u.hasDirectChanges
|
|
473
|
-
|
|
472
|
+
hasDirectChanges: u.hasDirectChanges,
|
|
473
|
+
changeKind: u.changeKind
|
|
474
|
+
}));
|
|
475
|
+
return eta.renderString(bodyTemplate, {
|
|
476
|
+
packages: allPackages,
|
|
477
|
+
releases: allPackages.filter((p) => p.changeKind !== "as-is"),
|
|
478
|
+
asIs: allPackages.filter((p) => p.changeKind === "as-is")
|
|
479
|
+
});
|
|
474
480
|
}
|
|
475
481
|
//#endregion
|
|
476
482
|
//#region src/options.ts
|
|
477
483
|
const DEFAULT_PR_BODY_TEMPLATE = dedent`
|
|
478
484
|
This PR was automatically generated by the UCD release scripts.
|
|
479
485
|
|
|
486
|
+
<% if (it.releases.length > 0) { %>
|
|
480
487
|
The following packages have been prepared for release:
|
|
481
488
|
|
|
482
|
-
<%
|
|
483
|
-
<% it.packages.forEach((pkg) => { %>
|
|
489
|
+
<% it.releases.forEach((pkg) => { %>
|
|
484
490
|
- **<%= pkg.name %>**: <%= pkg.currentVersion %> → <%= pkg.newVersion %> (<%= pkg.bumpType %>)
|
|
485
491
|
<% }) %>
|
|
486
492
|
<% } else { %>
|
|
487
493
|
There are no packages to release.
|
|
488
494
|
<% } %>
|
|
495
|
+
<% if (it.asIs.length > 0) { %>
|
|
496
|
+
|
|
497
|
+
The following packages are keeping their current version:
|
|
498
|
+
|
|
499
|
+
<% it.asIs.forEach((pkg) => { %>
|
|
500
|
+
- **<%= pkg.name %>**: <%= pkg.currentVersion %> (as-is)
|
|
501
|
+
<% }) %>
|
|
502
|
+
<% } %>
|
|
489
503
|
|
|
490
504
|
Please review the changes and merge when ready.
|
|
491
505
|
|
|
@@ -959,7 +973,7 @@ async function getMostRecentPackageTag(workspaceRoot, packageName) {
|
|
|
959
973
|
} });
|
|
960
974
|
const tags = stdout.split("\n").map((tag) => tag.trim()).filter(Boolean);
|
|
961
975
|
if (tags.length === 0) return ok(void 0);
|
|
962
|
-
return ok(tags.filter((t) => semver.valid(t.slice(t.lastIndexOf("@") + 1))).
|
|
976
|
+
return ok(tags.filter((t) => semver.valid(t.slice(t.lastIndexOf("@") + 1))).toSorted((a, b) => {
|
|
963
977
|
const va = a.slice(a.lastIndexOf("@") + 1);
|
|
964
978
|
const vb = b.slice(b.lastIndexOf("@") + 1);
|
|
965
979
|
return semver.rcompare(va, vb);
|
|
@@ -978,7 +992,7 @@ async function getMostRecentPackageStableTag(workspaceRoot, packageName) {
|
|
|
978
992
|
cwd: workspaceRoot,
|
|
979
993
|
stdio: "pipe"
|
|
980
994
|
} });
|
|
981
|
-
const tags = stdout.split("\n").map((tag) => tag.trim()).filter((tag) => Boolean(tag) && semver.valid(tag.slice(tag.lastIndexOf("@") + 1))).
|
|
995
|
+
const tags = stdout.split("\n").map((tag) => tag.trim()).filter((tag) => Boolean(tag) && semver.valid(tag.slice(tag.lastIndexOf("@") + 1))).toSorted((a, b) => {
|
|
982
996
|
const va = a.slice(a.lastIndexOf("@") + 1);
|
|
983
997
|
const vb = b.slice(b.lastIndexOf("@") + 1);
|
|
984
998
|
return semver.rcompare(va, vb);
|
|
@@ -1393,7 +1407,7 @@ async function selectVersionPrompt(workspaceRoot, pkg, currentVersion, suggested
|
|
|
1393
1407
|
const initial = Math.max(0, choices.findIndex((choice) => choice.value === initialValue));
|
|
1394
1408
|
const prereleaseVersionByChoice = {
|
|
1395
1409
|
"next-prerelease": nextDefaultPrerelease,
|
|
1396
|
-
|
|
1410
|
+
next: nextDefaultPrerelease,
|
|
1397
1411
|
"next-beta": nextBeta,
|
|
1398
1412
|
"next-alpha": nextAlpha,
|
|
1399
1413
|
"prepatch-beta": prePatchBeta,
|
|
@@ -1634,7 +1648,19 @@ async function prepareReleaseBranch(options) {
|
|
|
1634
1648
|
return ok(void 0);
|
|
1635
1649
|
}
|
|
1636
1650
|
async function syncReleaseChanges(options) {
|
|
1637
|
-
const { workspaceRoot, releaseBranch, commitMessage, hasChanges } = options;
|
|
1651
|
+
const { workspaceRoot, releaseBranch, commitMessage, hasChanges, additionalPaths } = options;
|
|
1652
|
+
if (additionalPaths && additionalPaths.length > 0) try {
|
|
1653
|
+
await run("git", [
|
|
1654
|
+
"add",
|
|
1655
|
+
"--",
|
|
1656
|
+
...additionalPaths
|
|
1657
|
+
], { nodeOptions: {
|
|
1658
|
+
cwd: workspaceRoot,
|
|
1659
|
+
stdio: "pipe"
|
|
1660
|
+
} });
|
|
1661
|
+
} catch (error) {
|
|
1662
|
+
logger.verbose(`Failed to stage additional paths: ${String(error)}`);
|
|
1663
|
+
}
|
|
1638
1664
|
const committed = hasChanges ? await commitChanges(commitMessage, workspaceRoot) : ok(false);
|
|
1639
1665
|
if (!committed.ok) return committed;
|
|
1640
1666
|
const isAhead = await isBranchAheadOfRemote(releaseBranch, workspaceRoot);
|
|
@@ -2079,11 +2105,10 @@ async function calculateVersionUpdates({ workspacePackages, packageCommits, work
|
|
|
2079
2105
|
});
|
|
2080
2106
|
continue;
|
|
2081
2107
|
}
|
|
2082
|
-
newVersion = autoVersion;
|
|
2083
2108
|
}
|
|
2084
2109
|
const selectedVersion = await selectVersionPrompt(workspaceRoot, pkg, pkg.version, newVersion, {
|
|
2085
|
-
defaultChoice:
|
|
2086
|
-
suggestedHint: `auto: ${determinedBump} → ${autoVersion}`
|
|
2110
|
+
defaultChoice: "suggested",
|
|
2111
|
+
suggestedHint: override ? `override: ${override.version}, auto: ${determinedBump} → ${autoVersion}` : `auto: ${determinedBump} → ${autoVersion}`
|
|
2087
2112
|
});
|
|
2088
2113
|
if (selectedVersion === null) continue;
|
|
2089
2114
|
const userBump = calculateBumpType(pkg.version, selectedVersion);
|
|
@@ -2440,7 +2465,8 @@ async function prepareWorkflow(options) {
|
|
|
2440
2465
|
workspaceRoot: options.workspaceRoot,
|
|
2441
2466
|
releaseBranch: options.branch.release,
|
|
2442
2467
|
commitMessage: "chore: update release versions",
|
|
2443
|
-
hasChanges: true
|
|
2468
|
+
hasChanges: true,
|
|
2469
|
+
additionalPaths: [overridesPath]
|
|
2444
2470
|
});
|
|
2445
2471
|
if (!hasChangesToPush.ok) exitWithError("Failed to sync release changes.", void 0, hasChangesToPush.error);
|
|
2446
2472
|
if (!hasChangesToPush.value) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucdjs/release-scripts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "@ucdjs release scripts",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"repository": {
|
|
8
7
|
"type": "git",
|
|
9
8
|
"url": "git+https://github.com/ucdjs/release-scripts.git"
|
|
10
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
11
15
|
"imports": {
|
|
12
16
|
"#core/*": "./src/core/*.ts",
|
|
13
17
|
"#operations/*": "./src/operations/*.ts",
|
|
@@ -20,10 +24,6 @@
|
|
|
20
24
|
".": "./dist/index.mjs",
|
|
21
25
|
"./package.json": "./package.json"
|
|
22
26
|
},
|
|
23
|
-
"types": "./dist/index.d.mts",
|
|
24
|
-
"files": [
|
|
25
|
-
"dist"
|
|
26
|
-
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@luxass/utils": "2.7.3",
|
|
29
29
|
"commit-parser": "1.3.1",
|
|
@@ -33,17 +33,18 @@
|
|
|
33
33
|
"tinyexec": "1.0.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@luxass/
|
|
37
|
-
"@
|
|
38
|
-
"@types/node": "22.18.12",
|
|
36
|
+
"@luxass/msw-utils": "0.6.2",
|
|
37
|
+
"@types/node": "22.19.14",
|
|
39
38
|
"@types/prompts": "2.4.9",
|
|
40
39
|
"@types/semver": "7.7.1",
|
|
41
|
-
"eslint": "10.0.3",
|
|
42
40
|
"eta": "4.5.1",
|
|
43
41
|
"msw": "2.12.14",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
42
|
+
"oxfmt": "0.43.0",
|
|
43
|
+
"oxlint": "1.58.0",
|
|
44
|
+
"oxlint-tsgolint": "0.19.0",
|
|
45
|
+
"tsdown": "0.21.7",
|
|
46
|
+
"typescript": "6.0.2",
|
|
47
|
+
"vitest": "4.1.2",
|
|
47
48
|
"vitest-testdirs": "4.4.3"
|
|
48
49
|
},
|
|
49
50
|
"inlinedDependencies": {
|
|
@@ -54,7 +55,10 @@
|
|
|
54
55
|
"dev": "tsdown --watch",
|
|
55
56
|
"test": "vitest --run",
|
|
56
57
|
"test:watch": "vitest",
|
|
57
|
-
"lint": "
|
|
58
|
+
"lint": "oxlint",
|
|
59
|
+
"lint:fix": "oxlint --fix",
|
|
60
|
+
"fmt": "oxfmt",
|
|
61
|
+
"fmt:check": "oxfmt --check",
|
|
58
62
|
"typecheck": "tsc --noEmit"
|
|
59
63
|
}
|
|
60
64
|
}
|