runcloud 0.2.230 → 0.2.232

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.
@@ -1092,6 +1092,48 @@ async function openSimulatorSessionUrl(platform, sessionId, url) {
1092
1092
  throw error;
1093
1093
  }
1094
1094
  }
1095
+ async function runSimulatorAppLifecycle(platform, sessionId, operation, body) {
1096
+ const path = `/run-cloud/${platform}/${encodeURIComponent(sessionId)}/apps/${operation}`;
1097
+ const action = operation === 'launch' ? 'app-launch' : 'app-terminate';
1098
+ try {
1099
+ const response = await client().post(path, body);
1100
+ const result = typeof response === 'object' && response !== null && !Array.isArray(response)
1101
+ ? response
1102
+ : {};
1103
+ if (result.ok !== true
1104
+ || result.platform !== platform
1105
+ || result.sessionId !== sessionId
1106
+ || result.bundleId !== body.bundleId) {
1107
+ throw new ApiError(0, `Simulator app ${operation} returned an invalid acknowledgement`, path, {
1108
+ code: 'app_lifecycle_invalid_response',
1109
+ retryable: true,
1110
+ sessionId,
1111
+ platform,
1112
+ action,
1113
+ });
1114
+ }
1115
+ return { ok: true, platform, sessionId, bundleId: body.bundleId };
1116
+ }
1117
+ catch (error) {
1118
+ if (error instanceof ApiTransportError) {
1119
+ throw new ApiError(0, `Simulator app ${operation} could not reach the run.cloud API`, path, {
1120
+ code: 'app_lifecycle_transport_error',
1121
+ retryable: true,
1122
+ sessionId,
1123
+ platform,
1124
+ action,
1125
+ });
1126
+ }
1127
+ if (error instanceof ApiError) {
1128
+ Object.assign(error, {
1129
+ sessionId: error.sessionId ?? sessionId,
1130
+ platform: error.platform ?? platform,
1131
+ action: error.action ?? action,
1132
+ });
1133
+ }
1134
+ throw error;
1135
+ }
1136
+ }
1095
1137
  function parseCoordinate(value, name) {
1096
1138
  const limit = name === 'latitude' ? 90 : 180;
1097
1139
  const parsed = Number(value);
@@ -1361,6 +1403,33 @@ function registerSimulatorCommands(program, platform) {
1361
1403
  .action((url, opts) => action(async () => {
1362
1404
  print(await openSimulatorSessionUrl(platform, opts.id, url), opts);
1363
1405
  }, opts));
1406
+ const launchApp = simulator
1407
+ .command('launch-app')
1408
+ .description(`Launch an installed app in ${article} ${label} session`)
1409
+ .argument('<id>', 'session id')
1410
+ .argument('<bundleId>', platform === 'ios' ? 'bundle id' : 'package name');
1411
+ if (platform === 'ios') {
1412
+ launchApp.option('--arg <value>', 'launch argument; repeatable (use --arg=-flag for a value that starts with -)', (value, previous) => [...previous, value], []);
1413
+ }
1414
+ launchApp
1415
+ .option('--terminate-running', 'stop the app first if it is already running', false)
1416
+ .option('--json', 'output JSON', false)
1417
+ .action((id, bundleId, opts) => action(async () => {
1418
+ print(await runSimulatorAppLifecycle(platform, id, 'launch', {
1419
+ bundleId,
1420
+ ...(opts.arg?.length ? { arguments: opts.arg } : {}),
1421
+ ...(opts.terminateRunning ? { terminateRunning: true } : {}),
1422
+ }), opts);
1423
+ }, opts));
1424
+ simulator
1425
+ .command('terminate-app')
1426
+ .description(`Stop a running app in ${article} ${label} session`)
1427
+ .argument('<id>', 'session id')
1428
+ .argument('<bundleId>', 'iOS bundle id or Android package name')
1429
+ .option('--json', 'output JSON', false)
1430
+ .action((id, bundleId, opts) => action(async () => {
1431
+ print(await runSimulatorAppLifecycle(platform, id, 'terminate', { bundleId }), opts);
1432
+ }, opts));
1364
1433
  const location = simulator
1365
1434
  .command('location')
1366
1435
  .description(`Set or clear the simulated GPS location of ${article} ${label} session`);
@@ -385,7 +385,9 @@ Examples:
385
385
  Build an iOS app that embeds a watch app (the watch app is built with it):
386
386
  $ runcloud xcode build . --scheme App --sdk iphonesimulator
387
387
  Build a macOS app, unsigned (ad hoc), as a zipped .app:
388
- $ runcloud xcode build . --scheme MacApp --sdk macosx -o MacApp.zip`)
388
+ $ runcloud xcode build . --scheme MacApp --sdk macosx -o MacApp.zip
389
+ Build a macOS app signed with your Developer ID Application certificate (not notarized):
390
+ $ runcloud xcode build . --scheme MacApp --sdk macosx --certificate-p12 DeveloperID.p12 --certificate-password "$P12_PASSWORD" -o MacApp.zip`)
389
391
  .argument('[path]', 'local source directory', '.')
390
392
  .option('--scheme <name>', 'Xcode scheme')
391
393
  .option('--workspace <path>', 'relative .xcworkspace path')
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.230';
1
+ export const CLI_VERSION = '0.2.232';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.230",
3
+ "version": "0.2.232",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file