@touchtechclub/simbox 0.2.5 → 0.2.7

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.
Files changed (2) hide show
  1. package/dist/cli.js +16 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -363,6 +363,19 @@ class Spinner {
363
363
  import { spawn } from "node:child_process";
364
364
  import { join as join2 } from "node:path";
365
365
  var STARTUP_TIMEOUT_MS = 300000;
366
+ async function waitForAndroid(runId, options = {}) {
367
+ const deadline = Date.now() + (options.timeoutMs ?? 12 * 60000);
368
+ do {
369
+ const run = await (options.read ?? currentRun)();
370
+ if (!run || run.id !== runId || run.state !== "live") {
371
+ throw new CliError("The run ended or was replaced while preparing Android. Run `simbox sim` again.");
372
+ }
373
+ if (run.androidReady)
374
+ return;
375
+ await (options.pause?.() ?? sleep(3000));
376
+ } while (Date.now() < deadline);
377
+ throw new CliError("Android AVD preparation did not complete. Inspect the Actions job's Android emulator prep logs. No device command was sent.");
378
+ }
366
379
  async function waitForRemote(initial, options = {}) {
367
380
  const probe = options.probe ?? probeRemote;
368
381
  const refresh = options.refresh ?? refreshRemote;
@@ -442,6 +455,9 @@ async function cmdExec(args) {
442
455
  const initial = await refreshRemote();
443
456
  if (!initial)
444
457
  throw new CliError("No live run. Start one with `simbox sim`.");
458
+ if (args.some((arg, i) => arg === "--platform=android" || arg === "--platform" && args[i + 1] === "android")) {
459
+ await waitForAndroid(initial.runId);
460
+ }
445
461
  const info = await waitForRemote(initial);
446
462
  const env = {
447
463
  ...process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@touchtechclub/simbox",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "On-demand iOS simulators & Android emulators on your own GitHub Actions minutes.",
5
5
  "repository": {
6
6
  "type": "git",