eas-cli 24.4.1 → 24.4.2

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.
@@ -13,6 +13,7 @@ exports.getSimulatorAppIdAsync = getSimulatorAppIdAsync;
13
13
  const tslib_1 = require("tslib");
14
14
  const osascript = tslib_1.__importStar(require("@expo/osascript"));
15
15
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
16
+ const path_1 = tslib_1.__importDefault(require("path"));
16
17
  const simctl_1 = require("./simctl");
17
18
  const log_1 = tslib_1.__importDefault(require("../../log"));
18
19
  const prompts_1 = require("../../prompts");
@@ -107,13 +108,28 @@ async function ensureSimulatorBootedAsync(simulator) {
107
108
  }
108
109
  await (0, simctl_1.simctlAsync)(['boot', simulator.udid]);
109
110
  }
111
+ // TODO: once Xcode 27 is stable, try DeviceHub before Simulator here and in getSimulatorAppIdAsync,
112
+ // in lockstep with @expo/cli (see SimulatorAppPrerequisite.ts there).
110
113
  async function openSimulatorAppAsync(simulatorUdid) {
111
- const args = ['-a', 'Simulator'];
112
- if (simulatorUdid) {
113
- // This has no effect if the app is already running.
114
- args.push('--args', '-CurrentDeviceUDID', simulatorUdid);
114
+ try {
115
+ const args = ['-a', 'Simulator'];
116
+ if (simulatorUdid) {
117
+ // This has no effect if the app is already running.
118
+ args.push('--args', '-CurrentDeviceUDID', simulatorUdid);
119
+ }
120
+ await (0, spawn_async_1.default)('open', args);
121
+ }
122
+ catch (error) {
123
+ const deviceHubArgs = simulatorUdid
124
+ ? [`devices://device/open?id=${simulatorUdid}`]
125
+ : ['-a', 'DeviceHub'];
126
+ try {
127
+ await (0, spawn_async_1.default)('open', deviceHubArgs);
128
+ }
129
+ catch {
130
+ throw error;
131
+ }
115
132
  }
116
- await (0, spawn_async_1.default)('open', args);
117
133
  }
118
134
  async function launchAppAsync(simulatorUdid, bundleIdentifier) {
119
135
  log_1.default.newLine();
@@ -136,7 +152,7 @@ async function waitForSimulatorAppToStartAsync(maxWaitTimeMs, intervalMs) {
136
152
  }
137
153
  async function isSimulatorAppRunningAsync() {
138
154
  try {
139
- const result = await osascript.execAsync('tell app "System Events" to count processes whose name is "Simulator"');
155
+ const result = await osascript.execAsync('tell app "System Events" to count processes whose name is "Simulator" or name is "DeviceHub"');
140
156
  if (result.trim() === '0') {
141
157
  return false;
142
158
  }
@@ -162,9 +178,35 @@ async function installAppAsync(deviceId, filePath) {
162
178
  await (0, simctl_1.simctlAsync)(['install', deviceId, filePath]);
163
179
  log_1.default.succeed('Successfully installed your app on the simulator!');
164
180
  }
181
+ const XCODE_SIMULATOR_INFO_PLIST_PATH = './Applications/Simulator.app/Contents/Info.plist';
182
+ const XCODE_DEVICE_HUB_INFO_PLIST_PATH = '../Applications/DeviceHub.app/Contents/Info.plist';
165
183
  async function getSimulatorAppIdAsync() {
184
+ // TODO: resolve DeviceHub before Simulator once Xcode 27 is stable, see openSimulatorAppAsync
185
+ const launchServicesAppId = (await osascript.safeIdOfAppAsync('Simulator')) ||
186
+ (await osascript.safeIdOfAppAsync('DeviceHub'));
187
+ if (launchServicesAppId) {
188
+ return launchServicesAppId;
189
+ }
190
+ const xcodePath = await getXcodeSelectPathAsync();
191
+ if (!xcodePath) {
192
+ return undefined;
193
+ }
194
+ return ((await getInfoPlistBundleIdAsync(path_1.default.join(xcodePath, XCODE_SIMULATOR_INFO_PLIST_PATH))) ||
195
+ (await getInfoPlistBundleIdAsync(path_1.default.join(xcodePath, XCODE_DEVICE_HUB_INFO_PLIST_PATH))));
196
+ }
197
+ async function getXcodeSelectPathAsync() {
198
+ try {
199
+ const { stdout } = await (0, spawn_async_1.default)('xcode-select', ['--print-path']);
200
+ return stdout.trim() || undefined;
201
+ }
202
+ catch {
203
+ return undefined;
204
+ }
205
+ }
206
+ async function getInfoPlistBundleIdAsync(infoPlistPath) {
166
207
  try {
167
- return (await osascript.execAsync('id of app "Simulator"')).trim();
208
+ const { stdout } = await (0, spawn_async_1.default)('defaults', ['read', infoPlistPath, 'CFBundleIdentifier']);
209
+ return stdout.trim() || undefined;
168
210
  }
169
211
  catch {
170
212
  return undefined;
@@ -58,11 +58,12 @@ async function ensureXcrunInstalledAsync() {
58
58
  async function assertSimulatorAppInstalledAsync() {
59
59
  const simulatorAppId = await (0, simulator_1.getSimulatorAppIdAsync)();
60
60
  if (!simulatorAppId) {
61
- throw new Error(`Can't determine id of Simulator app; the Simulator is most likely not installed on this machine. Run 'sudo xcode-select -s /Applications/Xcode.app/Contents/Developer'`);
61
+ throw new Error(`Can't determine id of Device Hub or Simulator app; it is most likely not installed on this machine. Run 'sudo xcode-select -s /Applications/Xcode.app/Contents/Developer'`);
62
62
  }
63
- if (simulatorAppId !== 'com.apple.iphonesimulator' &&
63
+ if (simulatorAppId !== 'com.apple.dt.Devices' &&
64
+ simulatorAppId !== 'com.apple.iphonesimulator' &&
64
65
  simulatorAppId !== 'com.apple.CoreSimulator.SimulatorTrampoline') {
65
- throw new Error(`Simulator is installed but is identified as '${simulatorAppId}', can't recognize what that is`);
66
+ throw new Error(`Device Hub or Simulator is installed but is identified as '${simulatorAppId}', can't recognize what that is`);
66
67
  }
67
68
  try {
68
69
  // make sure we can run simctl