@moku-labs/ci 1.2.3 → 1.2.4
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/release.mjs +21 -1
- package/package.json +1 -1
package/dist/release.mjs
CHANGED
|
@@ -2152,6 +2152,22 @@ function deferred(setup, description) {
|
|
|
2152
2152
|
return true;
|
|
2153
2153
|
}
|
|
2154
2154
|
/**
|
|
2155
|
+
* Hand a step that needs the owner's OTP back to the owner. npm asks for the OTP in a
|
|
2156
|
+
* browser; with nobody at the keyboard (`--yes`) that would hang, so the command is printed.
|
|
2157
|
+
*
|
|
2158
|
+
* @param setup - The wizard state.
|
|
2159
|
+
* @param step - What the step does, as a noun phrase ("first publish").
|
|
2160
|
+
* @param command - The command the owner runs themselves.
|
|
2161
|
+
* @returns `true` when the run is unattended and the caller must not act.
|
|
2162
|
+
* @example
|
|
2163
|
+
* if (needsOwner(setup, "first publish", "npm publish --access public")) return false;
|
|
2164
|
+
*/
|
|
2165
|
+
function needsOwner(setup, step, command) {
|
|
2166
|
+
if (!setup.unattended) return false;
|
|
2167
|
+
setup.ui.check(false, `${step} needs your OTP, run it yourself`, command);
|
|
2168
|
+
return true;
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2155
2171
|
* Verify the two human-only prerequisites. Nothing else in the wizard can run without
|
|
2156
2172
|
* them, and neither can be automated — the wizard prints the command and stops.
|
|
2157
2173
|
*
|
|
@@ -2300,6 +2316,7 @@ async function firstPublish(setup, name, version) {
|
|
|
2300
2316
|
return false;
|
|
2301
2317
|
}
|
|
2302
2318
|
if (deferred(setup, `run bun run build && npm publish --access public`)) return false;
|
|
2319
|
+
if (needsOwner(setup, "first publish", "bun run build && npm publish --access public")) return false;
|
|
2303
2320
|
if (await setup.ctx.exec.inherit("bun", ["run", "build"]) !== 0) {
|
|
2304
2321
|
setup.ui.error("build failed — not publishing");
|
|
2305
2322
|
return false;
|
|
@@ -2375,6 +2392,7 @@ async function registerTrustedPublisher(setup) {
|
|
|
2375
2392
|
return;
|
|
2376
2393
|
}
|
|
2377
2394
|
if (deferred(setup, registration)) return;
|
|
2395
|
+
if (needsOwner(setup, "trusted publisher registration", registration)) return;
|
|
2378
2396
|
const [command = "npm", ...args] = registration.split(" ");
|
|
2379
2397
|
const code = await setup.ctx.exec.inherit(command, args);
|
|
2380
2398
|
const hint = code === 0 ? void 0 : `verify: ${result.fix}`;
|
|
@@ -2464,6 +2482,7 @@ async function applyBranchRuleset(setup, ownerRepo) {
|
|
|
2464
2482
|
async function runSetup(options) {
|
|
2465
2483
|
const setup = {
|
|
2466
2484
|
dryRun: false,
|
|
2485
|
+
unattended: false,
|
|
2467
2486
|
...options
|
|
2468
2487
|
};
|
|
2469
2488
|
const { ui } = setup;
|
|
@@ -2831,7 +2850,8 @@ async function dispatch(parsed, ctx, ui) {
|
|
|
2831
2850
|
ctx,
|
|
2832
2851
|
ui,
|
|
2833
2852
|
prompts: parsed.yes || parsed.dryRun ? ASSENTING_PROMPTS : createBrandPrompts(),
|
|
2834
|
-
dryRun: parsed.dryRun
|
|
2853
|
+
dryRun: parsed.dryRun,
|
|
2854
|
+
unattended: parsed.yes
|
|
2835
2855
|
});
|
|
2836
2856
|
if (parsed.command === "release" && parsed.releaseType !== void 0) return runRelease({
|
|
2837
2857
|
ctx,
|