@touchtechclub/simbox 0.2.3 → 0.2.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/cli.js +10 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -178,6 +178,7 @@ async function currentRun() {
|
|
|
178
178
|
var stopRun = (runId) => api(`/v1/runs/${encodeURIComponent(runId)}/stop`, {
|
|
179
179
|
method: "POST"
|
|
180
180
|
});
|
|
181
|
+
var runHistory = async () => (await api("/v1/runs")).runs;
|
|
181
182
|
function friendlyError(err) {
|
|
182
183
|
if (err instanceof CliError)
|
|
183
184
|
return err;
|
|
@@ -544,7 +545,7 @@ function printRepoConnected(repo) {
|
|
|
544
545
|
}
|
|
545
546
|
console.log(`Run ${pc3.cyan("simbox sim")} to boot a simulator.`);
|
|
546
547
|
}
|
|
547
|
-
var SIM_TIMEOUT_MS =
|
|
548
|
+
var SIM_TIMEOUT_MS = 12 * 60 * 1000;
|
|
548
549
|
var SIM_POLL_MS = 3000;
|
|
549
550
|
async function cmdSim(opts) {
|
|
550
551
|
const json = opts.json === true;
|
|
@@ -566,8 +567,14 @@ async function cmdSim(opts) {
|
|
|
566
567
|
while (Date.now() < deadline) {
|
|
567
568
|
await sleep(SIM_POLL_MS);
|
|
568
569
|
const run = await currentRun();
|
|
569
|
-
if (!run)
|
|
570
|
+
if (!run) {
|
|
571
|
+
const ended = (await runHistory()).find((candidate) => candidate.id === first.runId);
|
|
572
|
+
if (ended && (ended.state === "ended" || ended.state === "failed")) {
|
|
573
|
+
spinner.fail(`Run ${ended.state}`);
|
|
574
|
+
throw new CliError(`The run ${ended.state} during startup (${ended.endReason ?? "check the Actions logs"}). Try \`simbox sim --new\`.`);
|
|
575
|
+
}
|
|
570
576
|
continue;
|
|
577
|
+
}
|
|
571
578
|
if (run.state === "live" && run.tunnelUrl && run.daemonToken) {
|
|
572
579
|
live = { run, tunnelUrl: run.tunnelUrl, daemonToken: run.daemonToken };
|
|
573
580
|
break;
|
|
@@ -580,7 +587,7 @@ async function cmdSim(opts) {
|
|
|
580
587
|
}
|
|
581
588
|
if (!live) {
|
|
582
589
|
spinner.fail("Timed out");
|
|
583
|
-
throw new CliError("Run didn't come online within
|
|
590
|
+
throw new CliError("Run didn't come online within 12 minutes. Check the workflow run in your repo's Actions tab, then try `simbox sim` again (or `--new`).");
|
|
584
591
|
}
|
|
585
592
|
spinner.succeed("Run is live");
|
|
586
593
|
info = {
|