@ucdjs/release-scripts 0.1.0-beta.43 → 0.1.0-beta.44
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 +75 -59
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -58,53 +58,8 @@ function buildTemplateGroups(options) {
|
|
|
58
58
|
//#region src/shared/utils.ts
|
|
59
59
|
const args = mri(process.argv.slice(2));
|
|
60
60
|
const isDryRun = !!args.dry;
|
|
61
|
-
const isVerbose = !!args.verbose;
|
|
61
|
+
const isVerbose$1 = !!args.verbose;
|
|
62
62
|
const isForce = !!args.force;
|
|
63
|
-
function toTrimmedString(value) {
|
|
64
|
-
if (typeof value === "string") {
|
|
65
|
-
const normalized = value.trim();
|
|
66
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
67
|
-
}
|
|
68
|
-
if (value instanceof Uint8Array) {
|
|
69
|
-
const normalized = new TextDecoder().decode(value).trim();
|
|
70
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
71
|
-
}
|
|
72
|
-
if (isRecord(value) && typeof value.toString === "function") {
|
|
73
|
-
const rendered = value.toString();
|
|
74
|
-
if (typeof rendered === "string" && rendered !== "[object Object]") {
|
|
75
|
-
const normalized = rendered.trim();
|
|
76
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function getNestedField(record, keys) {
|
|
81
|
-
let current = record;
|
|
82
|
-
for (const key of keys) {
|
|
83
|
-
if (!isRecord(current) || !(key in current)) return;
|
|
84
|
-
current = current[key];
|
|
85
|
-
}
|
|
86
|
-
return current;
|
|
87
|
-
}
|
|
88
|
-
function extractStderrLike(record) {
|
|
89
|
-
const candidates = [
|
|
90
|
-
record.stderr,
|
|
91
|
-
record.stdout,
|
|
92
|
-
record.shortMessage,
|
|
93
|
-
record.originalMessage,
|
|
94
|
-
getNestedField(record, ["result", "stderr"]),
|
|
95
|
-
getNestedField(record, ["result", "stdout"]),
|
|
96
|
-
getNestedField(record, ["output", "stderr"]),
|
|
97
|
-
getNestedField(record, ["output", "stdout"]),
|
|
98
|
-
getNestedField(record, ["cause", "stderr"]),
|
|
99
|
-
getNestedField(record, ["cause", "stdout"]),
|
|
100
|
-
getNestedField(record, ["cause", "shortMessage"]),
|
|
101
|
-
getNestedField(record, ["cause", "originalMessage"])
|
|
102
|
-
];
|
|
103
|
-
for (const candidate of candidates) {
|
|
104
|
-
const rendered = toTrimmedString(candidate);
|
|
105
|
-
if (rendered) return rendered;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
63
|
const ucdjsReleaseOverridesPath = ".github/ucdjs-release.overrides.json";
|
|
109
64
|
const isCI = typeof process.env.CI === "string" && process.env.CI !== "" && process.env.CI.toLowerCase() !== "false";
|
|
110
65
|
const logger = {
|
|
@@ -118,7 +73,7 @@ const logger = {
|
|
|
118
73
|
console.error(` ${farver.red("✖")}`, ...args);
|
|
119
74
|
},
|
|
120
75
|
verbose: (...args) => {
|
|
121
|
-
if (!isVerbose) return;
|
|
76
|
+
if (!isVerbose$1) return;
|
|
122
77
|
if (args.length === 0) {
|
|
123
78
|
console.log();
|
|
124
79
|
return;
|
|
@@ -168,9 +123,67 @@ async function dryRun(bin, args, opts) {
|
|
|
168
123
|
return logger.verbose(farver.blue(`[dryrun] ${bin} ${args.join(" ")}`), opts || "");
|
|
169
124
|
}
|
|
170
125
|
const runIfNotDry = isDryRun ? dryRun : run;
|
|
126
|
+
if (isDryRun || isVerbose$1 || isForce) {
|
|
127
|
+
logger.verbose(farver.inverse(farver.yellow(" Running with special flags ")));
|
|
128
|
+
logger.verbose({
|
|
129
|
+
isDryRun,
|
|
130
|
+
isVerbose: isVerbose$1,
|
|
131
|
+
isForce
|
|
132
|
+
});
|
|
133
|
+
logger.verbose();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/shared/errors.ts
|
|
138
|
+
const isVerbose = !!mri(process.argv.slice(2)).verbose;
|
|
171
139
|
function isRecord(value) {
|
|
172
140
|
return typeof value === "object" && value !== null;
|
|
173
141
|
}
|
|
142
|
+
function toTrimmedString(value) {
|
|
143
|
+
if (typeof value === "string") {
|
|
144
|
+
const normalized = value.trim();
|
|
145
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
146
|
+
}
|
|
147
|
+
if (value instanceof Uint8Array) {
|
|
148
|
+
const normalized = new TextDecoder().decode(value).trim();
|
|
149
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
150
|
+
}
|
|
151
|
+
if (isRecord(value) && typeof value.toString === "function") {
|
|
152
|
+
const rendered = value.toString();
|
|
153
|
+
if (typeof rendered === "string" && rendered !== "[object Object]") {
|
|
154
|
+
const normalized = rendered.trim();
|
|
155
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function getNestedField(record, keys) {
|
|
160
|
+
let current = record;
|
|
161
|
+
for (const key of keys) {
|
|
162
|
+
if (!isRecord(current) || !(key in current)) return;
|
|
163
|
+
current = current[key];
|
|
164
|
+
}
|
|
165
|
+
return current;
|
|
166
|
+
}
|
|
167
|
+
function extractStderrLike(record) {
|
|
168
|
+
const candidates = [
|
|
169
|
+
record.stderr,
|
|
170
|
+
record.stdout,
|
|
171
|
+
record.shortMessage,
|
|
172
|
+
record.originalMessage,
|
|
173
|
+
getNestedField(record, ["result", "stderr"]),
|
|
174
|
+
getNestedField(record, ["result", "stdout"]),
|
|
175
|
+
getNestedField(record, ["output", "stderr"]),
|
|
176
|
+
getNestedField(record, ["output", "stdout"]),
|
|
177
|
+
getNestedField(record, ["cause", "stderr"]),
|
|
178
|
+
getNestedField(record, ["cause", "stdout"]),
|
|
179
|
+
getNestedField(record, ["cause", "shortMessage"]),
|
|
180
|
+
getNestedField(record, ["cause", "originalMessage"])
|
|
181
|
+
];
|
|
182
|
+
for (const candidate of candidates) {
|
|
183
|
+
const rendered = toTrimmedString(candidate);
|
|
184
|
+
if (rendered) return rendered;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
174
187
|
function formatUnknownError(error) {
|
|
175
188
|
if (error instanceof Error) {
|
|
176
189
|
const base = {
|
|
@@ -196,7 +209,7 @@ function formatUnknownError(error) {
|
|
|
196
209
|
return { message: String(error) };
|
|
197
210
|
}
|
|
198
211
|
function exitWithError(message, hint, cause) {
|
|
199
|
-
|
|
212
|
+
console.error(` ${farver.red("✖")} ${farver.bold(message)}`);
|
|
200
213
|
if (cause !== void 0) {
|
|
201
214
|
const formatted = formatUnknownError(cause);
|
|
202
215
|
if (formatted.message && formatted.message !== message) console.error(farver.gray(` Cause: ${formatted.message}`));
|
|
@@ -214,15 +227,6 @@ function exitWithError(message, hint, cause) {
|
|
|
214
227
|
if (hint) console.error(farver.gray(` ${hint}`));
|
|
215
228
|
process.exit(1);
|
|
216
229
|
}
|
|
217
|
-
if (isDryRun || isVerbose || isForce) {
|
|
218
|
-
logger.verbose(farver.inverse(farver.yellow(" Running with special flags ")));
|
|
219
|
-
logger.verbose({
|
|
220
|
-
isDryRun,
|
|
221
|
-
isVerbose,
|
|
222
|
-
isForce
|
|
223
|
-
});
|
|
224
|
-
logger.verbose();
|
|
225
|
-
}
|
|
226
230
|
|
|
227
231
|
//#endregion
|
|
228
232
|
//#region src/core/github.ts
|
|
@@ -1619,10 +1623,15 @@ async function calculateVersionUpdates({ workspacePackages, packageCommits, work
|
|
|
1619
1623
|
const determinedBump = determineHighestBump(allCommitsForPackage);
|
|
1620
1624
|
const override = newOverrides[pkgName];
|
|
1621
1625
|
const effectiveBump = override?.type || determinedBump;
|
|
1622
|
-
|
|
1626
|
+
const canPrompt = !isCI && showPrompt;
|
|
1627
|
+
if (override?.type === "none" && override.version === pkg.version) {
|
|
1628
|
+
delete newOverrides[pkgName];
|
|
1629
|
+
logger.verbose(`Removed stale "none" override for ${pkgName}`);
|
|
1630
|
+
}
|
|
1631
|
+
if (effectiveBump === "none" && !canPrompt) continue;
|
|
1623
1632
|
let newVersion = override?.version || getNextVersion(pkg.version, effectiveBump);
|
|
1624
1633
|
let finalBumpType = effectiveBump;
|
|
1625
|
-
if (
|
|
1634
|
+
if (canPrompt) {
|
|
1626
1635
|
logger.clearScreen();
|
|
1627
1636
|
logger.section(`📝 Commits for ${farver.cyan(pkg.name)}`);
|
|
1628
1637
|
formatCommitsForDisplay(allCommitsForPackage).split("\n").forEach((line) => logger.item(line));
|
|
@@ -1631,6 +1640,13 @@ async function calculateVersionUpdates({ workspacePackages, packageCommits, work
|
|
|
1631
1640
|
if (selectedVersion === null) continue;
|
|
1632
1641
|
const userBump = calculateBumpType(pkg.version, selectedVersion);
|
|
1633
1642
|
finalBumpType = userBump;
|
|
1643
|
+
if (selectedVersion === pkg.version) {
|
|
1644
|
+
if (newOverrides[pkgName]) {
|
|
1645
|
+
delete newOverrides[pkgName];
|
|
1646
|
+
logger.info(`Version override removed for ${pkgName}.`);
|
|
1647
|
+
}
|
|
1648
|
+
continue;
|
|
1649
|
+
}
|
|
1634
1650
|
if (bumpRanks[userBump] < bumpRanks[determinedBump]) {
|
|
1635
1651
|
newOverrides[pkgName] = {
|
|
1636
1652
|
type: userBump,
|