runcloud 0.1.24 → 0.1.25

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.
@@ -194,6 +194,23 @@ async function waitForBuild(client, buildId, log) {
194
194
  status = event.status;
195
195
  }
196
196
  }
197
+ if (status !== 'completed' && status !== 'failed' && status !== 'cancelled') {
198
+ const deadline = Date.now() + 60 * 60 * 1000;
199
+ let lastLoggedStatus = status;
200
+ while (Date.now() < deadline) {
201
+ const build = (await client.get(`/builds/${buildId}`));
202
+ const current = typeof build.status === 'string' ? build.status : status;
203
+ if (current !== lastLoggedStatus) {
204
+ log(`Build ${buildId} ${current}`);
205
+ lastLoggedStatus = current;
206
+ }
207
+ status = current;
208
+ if (status === 'completed' || status === 'failed' || status === 'cancelled')
209
+ return status;
210
+ await new Promise((resolve) => setTimeout(resolve, 5_000));
211
+ }
212
+ throw new Error(`iOS simulator build ${buildId} timed out`);
213
+ }
197
214
  return status;
198
215
  }
199
216
  async function waitForAndroidApkBuild(client, buildId, log) {
@@ -11,11 +11,11 @@ export function desktopRunUrl(project, mode, start = true, platform = 'ios') {
11
11
  url.searchParams.set('request', randomUUID());
12
12
  return url.toString();
13
13
  }
14
- export async function startDesktopRun(project, mode, platform = 'ios', fetchImpl = fetch) {
14
+ export async function startDesktopRun(project, mode, platform = 'ios', key = 'default', sessionId, fetchImpl = fetch) {
15
15
  const response = await fetchImpl(DESKTOP_RUN_START_URL, {
16
16
  method: 'POST',
17
17
  headers: { 'content-type': 'application/json' },
18
- body: JSON.stringify({ cwd: resolve(project), key: 'default', mode, platform }),
18
+ body: JSON.stringify({ cwd: resolve(project), key, mode, platform, ...(sessionId ? { sessionId } : {}) }),
19
19
  });
20
20
  if (response.ok)
21
21
  return;
@@ -38,14 +38,18 @@ export function registerDesktop(program) {
38
38
  .requiredOption('--project <path>', 'local Expo project directory')
39
39
  .option('--mode <mode>', 'simulator mode: local or remote', 'local')
40
40
  .option('--platform <platform>', 'simulator platform: ios or android', 'ios')
41
+ .option('--key <key>', 'run lane key in the desktop sidecar', 'default')
42
+ .option('--session-id <id>', 'control-plane session id for session-scoped remote simulator builds')
43
+ .option('--no-open', 'skip the newly:// opener and call the running sidecar directly')
41
44
  .action(async (opts) => {
42
45
  if (opts.mode !== 'local' && opts.mode !== 'remote')
43
46
  throw new Error('--mode must be local or remote');
44
47
  if (opts.platform !== 'ios' && opts.platform !== 'android')
45
48
  throw new Error('--platform must be ios or android');
46
49
  const url = desktopRunUrl(opts.project, opts.mode, false, opts.platform);
47
- openDesktopUrl(url);
48
- await startDesktopRun(opts.project, opts.mode, opts.platform);
49
- console.log(`Opened Newly and started the ${opts.mode} ${opts.platform} simulator run for ${resolve(opts.project)}`);
50
+ if (opts.open)
51
+ openDesktopUrl(url);
52
+ await startDesktopRun(opts.project, opts.mode, opts.platform, opts.key, opts.sessionId);
53
+ console.log(`${opts.open ? 'Opened Newly and started' : 'Started'} the ${opts.mode} ${opts.platform} simulator run for ${resolve(opts.project)}`);
50
54
  });
51
55
  }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.1.24';
1
+ export const CLI_VERSION = '0.1.25';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [