eas-cli 22.0.0 → 22.3.0
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/README.md +233 -205
- package/build/commands/fingerprint/compare.js +100 -48
- package/build/commands/go.d.ts +1 -1
- package/build/commands/go.js +9 -17
- package/build/commands/simulator/availability.js +2 -1
- package/build/commands/simulator/index.d.ts +4 -0
- package/build/commands/simulator/index.js +33 -5
- package/build/commands/simulator/stop.js +1 -0
- package/build/graphql/generated.d.ts +119 -12
- package/build/graphql/generated.js +4 -0
- package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
- package/build/project/detectProjectSdkVersionAsync.d.ts +1 -0
- package/build/project/detectProjectSdkVersionAsync.js +17 -0
- package/build/simulator/env.d.ts +1 -1
- package/build/simulator/env.js +12 -2
- package/build/simulator/expoGo.d.ts +5 -0
- package/build/simulator/expoGo.js +54 -0
- package/build/simulator/utils.js +26 -0
- package/build/uploads.d.ts +5 -0
- package/build/uploads.js +22 -0
- package/oclif.manifest.json +2184 -2128
- package/package.json +4 -4
|
@@ -112,7 +112,14 @@ class FingerprintCompare extends EasCommand_1.default {
|
|
|
112
112
|
environmentForProjectFingerprint: environment,
|
|
113
113
|
}, firstFingerprintInfo);
|
|
114
114
|
const { fingerprint: secondFingerprint, origin: secondFingerprintOrigin } = secondFingerprintInfo;
|
|
115
|
+
const unavailableSourceHashes = [
|
|
116
|
+
firstFingerprintInfo.isFingerprintSourceUnavailable ? firstFingerprint.hash : null,
|
|
117
|
+
secondFingerprintInfo.isFingerprintSourceUnavailable ? secondFingerprint.hash : null,
|
|
118
|
+
].filter((hash) => hash !== null);
|
|
115
119
|
if (json) {
|
|
120
|
+
if (unavailableSourceHashes.length > 0) {
|
|
121
|
+
throw new Error(getUnavailableSourceMessage(unavailableSourceHashes));
|
|
122
|
+
}
|
|
116
123
|
(0, json_1.printJsonOnlyOutput)({ fingerprint1: firstFingerprint, fingerprint2: secondFingerprint });
|
|
117
124
|
return;
|
|
118
125
|
}
|
|
@@ -123,54 +130,60 @@ class FingerprintCompare extends EasCommand_1.default {
|
|
|
123
130
|
else {
|
|
124
131
|
log_1.default.log(`🔄 ${capitalizeFirstLetter(prettyPrintFingerprint(firstFingerprint, firstFingerprintOrigin))} differs from ${prettyPrintFingerprint(secondFingerprint, secondFingerprintOrigin)}`);
|
|
125
132
|
}
|
|
126
|
-
|
|
127
|
-
if (!fingerprintDiffs) {
|
|
128
|
-
log_1.default.error('Fingerprint diffs can only be computed for projects with SDK 52 or higher');
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const filePathDiffs = fingerprintDiffs.filter(diff => {
|
|
132
|
-
let sourceType;
|
|
133
|
-
if (diff.op === 'added') {
|
|
134
|
-
sourceType = diff.addedSource.type;
|
|
135
|
-
}
|
|
136
|
-
else if (diff.op === 'removed') {
|
|
137
|
-
sourceType = diff.removedSource.type;
|
|
138
|
-
}
|
|
139
|
-
else if (diff.op === 'changed') {
|
|
140
|
-
sourceType = diff.beforeSource.type;
|
|
141
|
-
}
|
|
142
|
-
return sourceType === 'dir' || sourceType === 'file';
|
|
143
|
-
});
|
|
144
|
-
if (filePathDiffs.length > 0) {
|
|
133
|
+
if (unavailableSourceHashes.length > 0) {
|
|
145
134
|
log_1.default.newLine();
|
|
146
|
-
log_1.default.
|
|
135
|
+
log_1.default.warn(`A detailed diff cannot be shown. ${getUnavailableSourceMessage(unavailableSourceHashes)}`);
|
|
147
136
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
else {
|
|
138
|
+
const fingerprintDiffs = (0, cli_1.diffFingerprint)(projectDir, firstFingerprint, secondFingerprint);
|
|
139
|
+
if (!fingerprintDiffs) {
|
|
140
|
+
log_1.default.error('Fingerprint diffs can only be computed for projects with SDK 52 or higher');
|
|
141
|
+
return;
|
|
153
142
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
143
|
+
const filePathDiffs = fingerprintDiffs.filter(diff => {
|
|
144
|
+
let sourceType;
|
|
145
|
+
if (diff.op === 'added') {
|
|
146
|
+
sourceType = diff.addedSource.type;
|
|
147
|
+
}
|
|
148
|
+
else if (diff.op === 'removed') {
|
|
149
|
+
sourceType = diff.removedSource.type;
|
|
150
|
+
}
|
|
151
|
+
else if (diff.op === 'changed') {
|
|
152
|
+
sourceType = diff.beforeSource.type;
|
|
153
|
+
}
|
|
154
|
+
return sourceType === 'dir' || sourceType === 'file';
|
|
155
|
+
});
|
|
156
|
+
if (filePathDiffs.length > 0) {
|
|
157
|
+
log_1.default.newLine();
|
|
158
|
+
log_1.default.log('📁 Paths with native dependencies:');
|
|
163
159
|
}
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
const fields = [];
|
|
161
|
+
for (const diff of filePathDiffs) {
|
|
162
|
+
const field = getDiffFilePathFields(diff);
|
|
163
|
+
if (!field) {
|
|
164
|
+
throw new Error(`Unsupported diff: ${JSON.stringify(diff)}`);
|
|
165
|
+
}
|
|
166
|
+
fields.push(field);
|
|
166
167
|
}
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
log_1.default.log((0, formatFields_1.default)(fields, {
|
|
169
|
+
labelFormat: label => ` ${chalk_1.default.dim(label)}:`,
|
|
170
|
+
}));
|
|
171
|
+
const contentDiffs = fingerprintDiffs.filter(diff => {
|
|
172
|
+
let sourceType;
|
|
173
|
+
if (diff.op === 'added') {
|
|
174
|
+
sourceType = diff.addedSource.type;
|
|
175
|
+
}
|
|
176
|
+
else if (diff.op === 'removed') {
|
|
177
|
+
sourceType = diff.removedSource.type;
|
|
178
|
+
}
|
|
179
|
+
else if (diff.op === 'changed') {
|
|
180
|
+
sourceType = diff.beforeSource.type;
|
|
181
|
+
}
|
|
182
|
+
return sourceType === 'contents';
|
|
183
|
+
});
|
|
184
|
+
for (const diff of contentDiffs) {
|
|
185
|
+
printContentDiff(diff);
|
|
169
186
|
}
|
|
170
|
-
return sourceType === 'contents';
|
|
171
|
-
});
|
|
172
|
-
for (const diff of contentDiffs) {
|
|
173
|
-
printContentDiff(diff);
|
|
174
187
|
}
|
|
175
188
|
if (nonInteractive) {
|
|
176
189
|
return;
|
|
@@ -310,7 +323,11 @@ async function getFingerprintInfoFromLocalProjectAsync({ graphqlClient, projectD
|
|
|
310
323
|
? { ...(await getServerSideEnvironmentVariablesAsync()), EXPO_NO_DOTENV: '1' }
|
|
311
324
|
: undefined;
|
|
312
325
|
const fingerprint = await (0, utils_1.getFingerprintInfoFromLocalProjectForPlatformsAsync)(graphqlClient, projectDir, projectId, vcsClient, firstFingerprintPlatforms, { env });
|
|
313
|
-
return {
|
|
326
|
+
return {
|
|
327
|
+
fingerprint,
|
|
328
|
+
origin: { type: FingerprintOriginType.Project },
|
|
329
|
+
isFingerprintSourceUnavailable: false,
|
|
330
|
+
};
|
|
314
331
|
}
|
|
315
332
|
async function getFingerprintFromUpdateFragmentAsync(updateWithFingerprint) {
|
|
316
333
|
if (!updateWithFingerprint.fingerprint) {
|
|
@@ -319,8 +336,10 @@ async function getFingerprintFromUpdateFragmentAsync(updateWithFingerprint) {
|
|
|
319
336
|
else if (!updateWithFingerprint.fingerprint.debugInfoUrl) {
|
|
320
337
|
throw new Error(`Fingerprint source for update ${updateWithFingerprint.id} was not computed.`);
|
|
321
338
|
}
|
|
339
|
+
const { fingerprint, isFingerprintSourceUnavailable } = await getFingerprintFromFingerprintFragmentAsync(updateWithFingerprint.fingerprint);
|
|
322
340
|
return {
|
|
323
|
-
fingerprint
|
|
341
|
+
fingerprint,
|
|
342
|
+
isFingerprintSourceUnavailable,
|
|
324
343
|
platforms: [(0, utils_1.stringToAppPlatform)(updateWithFingerprint.platform)],
|
|
325
344
|
origin: {
|
|
326
345
|
type: FingerprintOriginType.Update,
|
|
@@ -330,7 +349,7 @@ async function getFingerprintFromUpdateFragmentAsync(updateWithFingerprint) {
|
|
|
330
349
|
}
|
|
331
350
|
async function getFingerprintInfoFromHashAsync(graphqlClient, projectId, hash) {
|
|
332
351
|
const fingerprintFragment = await getFingerprintFragmentFromHashAsync(graphqlClient, projectId, hash);
|
|
333
|
-
const fingerprint = await getFingerprintFromFingerprintFragmentAsync(fingerprintFragment);
|
|
352
|
+
const { fingerprint, isFingerprintSourceUnavailable } = await getFingerprintFromFingerprintFragmentAsync(fingerprintFragment);
|
|
334
353
|
let platforms;
|
|
335
354
|
const fingerprintBuilds = fingerprintFragment.builds?.edges.map(edge => edge.node) ?? [];
|
|
336
355
|
const fingerprintUpdates = fingerprintFragment.updates?.edges.map(edge => edge.node) ?? [];
|
|
@@ -342,6 +361,7 @@ async function getFingerprintInfoFromHashAsync(graphqlClient, projectId, hash) {
|
|
|
342
361
|
}
|
|
343
362
|
return {
|
|
344
363
|
fingerprint,
|
|
364
|
+
isFingerprintSourceUnavailable,
|
|
345
365
|
platforms,
|
|
346
366
|
origin: {
|
|
347
367
|
type: FingerprintOriginType.Hash,
|
|
@@ -390,8 +410,10 @@ async function getFingerprintInfoFromBuildIdAsync(graphqlClient, buildId) {
|
|
|
390
410
|
else if (!buildWithFingerprint.fingerprint.debugInfoUrl) {
|
|
391
411
|
throw new Error(`Fingerprint source for build ${buildId} was not computed.`);
|
|
392
412
|
}
|
|
413
|
+
const { fingerprint, isFingerprintSourceUnavailable } = await getFingerprintFromFingerprintFragmentAsync(buildWithFingerprint.fingerprint);
|
|
393
414
|
return {
|
|
394
|
-
fingerprint
|
|
415
|
+
fingerprint,
|
|
416
|
+
isFingerprintSourceUnavailable,
|
|
395
417
|
platforms: [buildWithFingerprint.platform],
|
|
396
418
|
origin: {
|
|
397
419
|
type: FingerprintOriginType.Build,
|
|
@@ -410,13 +432,43 @@ async function getFingerprintFragmentFromHashAsync(graphqlClient, projectId, has
|
|
|
410
432
|
}
|
|
411
433
|
return fingerprint;
|
|
412
434
|
}
|
|
435
|
+
async function fetchFingerprintSourceAsync(fingerprintDebugUrl) {
|
|
436
|
+
const fingerprintResponse = await fetch(fingerprintDebugUrl);
|
|
437
|
+
if (!fingerprintResponse.ok) {
|
|
438
|
+
throw new Error(`Fingerprint source request failed: ${fingerprintResponse.status}`);
|
|
439
|
+
}
|
|
440
|
+
const fingerprintSource = (await fingerprintResponse.json());
|
|
441
|
+
if (!Array.isArray(fingerprintSource?.sources)) {
|
|
442
|
+
throw new Error('Fingerprint source file does not contain a list of sources');
|
|
443
|
+
}
|
|
444
|
+
return fingerprintSource;
|
|
445
|
+
}
|
|
413
446
|
async function getFingerprintFromFingerprintFragmentAsync(fingerprintFragment) {
|
|
414
447
|
const fingerprintDebugUrl = fingerprintFragment.debugInfoUrl;
|
|
415
448
|
if (!fingerprintDebugUrl) {
|
|
416
449
|
throw new Error(`The source for fingerprint hash ${fingerprintFragment.hash} was not computed.`);
|
|
417
450
|
}
|
|
418
|
-
|
|
419
|
-
|
|
451
|
+
try {
|
|
452
|
+
return {
|
|
453
|
+
fingerprint: await fetchFingerprintSourceAsync(fingerprintDebugUrl),
|
|
454
|
+
isFingerprintSourceUnavailable: false,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
// Uploaded source files expire after a period of time or may be malformed
|
|
459
|
+
// (e.g. zero-length). The hash from the API is still valid, so fall back to a
|
|
460
|
+
// sourceless fingerprint instead of failing the whole comparison.
|
|
461
|
+
log_1.default.debug(`Failed to fetch source for fingerprint hash ${fingerprintFragment.hash}`, error);
|
|
462
|
+
return {
|
|
463
|
+
fingerprint: { hash: fingerprintFragment.hash, sources: [] },
|
|
464
|
+
isFingerprintSourceUnavailable: true,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function getUnavailableSourceMessage(hashes) {
|
|
469
|
+
return hashes.length === 1
|
|
470
|
+
? `The uploaded source file for fingerprint ${hashes[0]} has expired or is invalid.`
|
|
471
|
+
: `The uploaded source files for fingerprints ${hashes.join(' and ')} have expired or are invalid.`;
|
|
420
472
|
}
|
|
421
473
|
function printContentDiff(diff) {
|
|
422
474
|
if (diff.op === 'added') {
|
package/build/commands/go.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EasCommand from '../commandUtils/EasCommand';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function toRepackTargetSdkVersion(sdkVersion: string | undefined): string | undefined;
|
|
3
3
|
export default class Go extends EasCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static hidden: boolean;
|
package/build/commands/go.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toRepackTargetSdkVersion = toRepackTargetSdkVersion;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const config_1 = require("@expo/config");
|
|
6
5
|
const core_1 = require("@oclif/core");
|
|
7
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
7
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
9
8
|
const os = tslib_1.__importStar(require("os"));
|
|
10
9
|
const path = tslib_1.__importStar(require("path"));
|
|
10
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
11
11
|
const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
|
|
12
12
|
const context_1 = require("../credentials/context");
|
|
13
13
|
const AscApiKeyUtils_1 = require("../credentials/ios/actions/AscApiKeyUtils");
|
|
@@ -25,7 +25,7 @@ const WorkflowRunQuery_1 = require("../graphql/queries/WorkflowRunQuery");
|
|
|
25
25
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
26
26
|
const prompts_1 = require("../prompts");
|
|
27
27
|
const ora_1 = require("../ora");
|
|
28
|
-
const
|
|
28
|
+
const detectProjectSdkVersionAsync_1 = require("../project/detectProjectSdkVersionAsync");
|
|
29
29
|
const fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1 = require("../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync");
|
|
30
30
|
const uploadAccountScopedFileAsync_1 = require("../project/uploadAccountScopedFileAsync");
|
|
31
31
|
const uploadAccountScopedProjectSourceAsync_1 = require("../project/uploadAccountScopedProjectSourceAsync");
|
|
@@ -37,17 +37,9 @@ const bundleIdentifier_1 = require("../project/ios/bundleIdentifier");
|
|
|
37
37
|
function deriveBundleIdSlug(bundleId) {
|
|
38
38
|
return bundleId.split('.').filter(Boolean).pop();
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
return (await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir)).sdkVersion;
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
40
|
+
function toRepackTargetSdkVersion(sdkVersion) {
|
|
41
|
+
const coerced = semver_1.default.coerce(sdkVersion);
|
|
42
|
+
return coerced ? `${coerced.major}.0.0` : sdkVersion;
|
|
51
43
|
}
|
|
52
44
|
async function setupTestFlightAsync(ascApp) {
|
|
53
45
|
await (0, ensureTestFlightGroup_1.ensureTestFlightGroupExistsAsync)(ascApp);
|
|
@@ -103,7 +95,7 @@ class Go extends EasCommand_1.default {
|
|
|
103
95
|
default: 'My Expo Go',
|
|
104
96
|
}),
|
|
105
97
|
'sdk-version': core_1.Flags.string({
|
|
106
|
-
description: 'Expo Go SDK version to prepare (default:
|
|
98
|
+
description: 'Expo Go SDK version to prepare, for example 57 (default: the SDK version of the current project)',
|
|
107
99
|
required: false,
|
|
108
100
|
}),
|
|
109
101
|
credentials: core_1.Flags.boolean({
|
|
@@ -122,11 +114,11 @@ class Go extends EasCommand_1.default {
|
|
|
122
114
|
nonInteractive: false,
|
|
123
115
|
});
|
|
124
116
|
log_1.default.withTick(`Logged in as ${chalk_1.default.cyan((0, User_1.getActorDisplayName)(actor))}`);
|
|
125
|
-
const detectedSdkVersion = await detectProjectSdkVersionAsync(process.cwd());
|
|
117
|
+
const detectedSdkVersion = await (0, detectProjectSdkVersionAsync_1.detectProjectSdkVersionAsync)(process.cwd());
|
|
126
118
|
if (detectedSdkVersion && !flags['sdk-version']) {
|
|
127
119
|
log_1.default.log(`Current project using SDK ${detectedSdkVersion.split('.')[0]}. Auto-selected same version. To use a different version, pass --sdk-version.`);
|
|
128
120
|
}
|
|
129
|
-
let sdkVersion = flags['sdk-version'] ?? detectedSdkVersion;
|
|
121
|
+
let sdkVersion = toRepackTargetSdkVersion(flags['sdk-version'] ?? detectedSdkVersion);
|
|
130
122
|
if (!sdkVersion) {
|
|
131
123
|
({ sdkVersion } = await this.selectSdkVersionAsync(graphqlClient));
|
|
132
124
|
}
|
|
@@ -25,7 +25,7 @@ class SimulatorAvailability extends EasCommand_1.default {
|
|
|
25
25
|
if (jsonFlag) {
|
|
26
26
|
(0, json_1.enableJsonOutput)();
|
|
27
27
|
}
|
|
28
|
-
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorAvailability, {
|
|
28
|
+
const { projectId, loggedIn: { actor, graphqlClient }, } = await this.getContextAsync(SimulatorAvailability, {
|
|
29
29
|
nonInteractive,
|
|
30
30
|
});
|
|
31
31
|
const fetchSpinner = jsonFlag ? null : (0, ora_1.ora)('Checking EAS Simulator availability').start();
|
|
@@ -33,6 +33,7 @@ class SimulatorAvailability extends EasCommand_1.default {
|
|
|
33
33
|
let available;
|
|
34
34
|
try {
|
|
35
35
|
({ accountName, available } = await DeviceRunSessionAvailabilityQuery_1.DeviceRunSessionAvailabilityQuery.byAppIdAsync(graphqlClient, projectId));
|
|
36
|
+
available ||= actor.isExpoAdmin;
|
|
36
37
|
fetchSpinner?.stop();
|
|
37
38
|
}
|
|
38
39
|
catch (err) {
|
|
@@ -8,6 +8,10 @@ export default class Simulator extends EasCommand {
|
|
|
8
8
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
device: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
'build-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'application-archive-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'expo-go': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
15
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
16
|
'package-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
17
|
'max-duration-minutes': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -15,6 +15,7 @@ const log_1 = tslib_1.__importStar(require("../../log"));
|
|
|
15
15
|
const ora_1 = require("../../ora");
|
|
16
16
|
const prompts_1 = require("../../prompts");
|
|
17
17
|
const env_1 = require("../../simulator/env");
|
|
18
|
+
const expoGo_1 = require("../../simulator/expoGo");
|
|
18
19
|
const utils_1 = require("../../simulator/utils");
|
|
19
20
|
const json_1 = require("../../utils/json");
|
|
20
21
|
const promise_1 = require("../../utils/promise");
|
|
@@ -42,6 +43,21 @@ class Simulator extends EasCommand_1.default {
|
|
|
42
43
|
name: core_1.Flags.string({
|
|
43
44
|
description: 'Human-readable name for the simulator session, shown in eas simulator:list and on expo.dev. Defaults to unnamed.',
|
|
44
45
|
}),
|
|
46
|
+
device: core_1.Flags.string({
|
|
47
|
+
description: 'Virtual device to start for the session. On iOS, a Simulator device name or UDID (e.g. "iPhone 16 Pro"). On Android, an AVD hardware profile id (e.g. "pixel_7"). Defaults to a device chosen by the runner.',
|
|
48
|
+
}),
|
|
49
|
+
'build-id': core_1.Flags.string({
|
|
50
|
+
description: 'EAS Build to install and launch before the simulator session is ready.',
|
|
51
|
+
exclusive: ['application-archive-url', 'expo-go'],
|
|
52
|
+
}),
|
|
53
|
+
'application-archive-url': core_1.Flags.string({
|
|
54
|
+
description: 'Application archive URL to download, install, and launch before the simulator session is ready.',
|
|
55
|
+
exclusive: ['build-id', 'expo-go'],
|
|
56
|
+
}),
|
|
57
|
+
'expo-go': core_1.Flags.boolean({
|
|
58
|
+
description: "Install and launch Expo Go matching the current project's Expo SDK before the simulator session is ready.",
|
|
59
|
+
exclusive: ['build-id', 'application-archive-url'],
|
|
60
|
+
}),
|
|
45
61
|
type: core_1.Flags.option({
|
|
46
62
|
description: 'Type of simulator session to create',
|
|
47
63
|
options: Object.values(utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
|
|
@@ -92,12 +108,21 @@ class Simulator extends EasCommand_1.default {
|
|
|
92
108
|
// The server rejects blank names, so trim here and treat a whitespace-only
|
|
93
109
|
// --name as if it had been omitted rather than surfacing a validation error.
|
|
94
110
|
const name = flags.name?.trim() || undefined;
|
|
111
|
+
const deviceIdentifier = flags.device?.trim() || undefined;
|
|
112
|
+
const buildId = flags['build-id']?.trim() || undefined;
|
|
113
|
+
const applicationArchiveUrlFromFlag = flags['application-archive-url']?.trim() || undefined;
|
|
95
114
|
await (0, env_1.loadSimulatorEnvAsync)(projectDir);
|
|
96
115
|
const existingDeviceRunSessionId = process.env[env_1.EAS_SIMULATOR_SESSION_ID];
|
|
97
116
|
if (existingDeviceRunSessionId && !flags.force) {
|
|
98
117
|
throw new Error(`Existing simulator session in environment. Use --force to create a new simulator session.`);
|
|
99
118
|
}
|
|
100
119
|
const platform = await resolvePlatformAsync(flags.platform, nonInteractive);
|
|
120
|
+
const applicationArchiveUrl = flags['expo-go']
|
|
121
|
+
? await (0, expoGo_1.resolveExpoGoApplicationArchiveUrlAsync)({
|
|
122
|
+
platform: platform === generated_1.AppPlatform.Ios ? 'ios' : 'android',
|
|
123
|
+
projectDir,
|
|
124
|
+
})
|
|
125
|
+
: applicationArchiveUrlFromFlag;
|
|
101
126
|
if (existingDeviceRunSessionId) {
|
|
102
127
|
log_1.default.warn(` Overwriting previous simulator session (id: ${existingDeviceRunSessionId}). ` +
|
|
103
128
|
`The previous remote session will continue running until stopped. ` +
|
|
@@ -115,6 +140,9 @@ class Simulator extends EasCommand_1.default {
|
|
|
115
140
|
platform,
|
|
116
141
|
type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
117
142
|
packageVersion: flags['package-version'],
|
|
143
|
+
deviceIdentifier,
|
|
144
|
+
...(buildId ? { buildId } : {}),
|
|
145
|
+
...(applicationArchiveUrl ? { applicationArchiveUrl } : {}),
|
|
118
146
|
maxRunTimeMinutes: flags['max-duration-minutes'],
|
|
119
147
|
});
|
|
120
148
|
deviceRunSessionId = session.id;
|
|
@@ -282,7 +310,7 @@ async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessi
|
|
|
282
310
|
jobRunStatus === generated_1.JobRunStatus.Canceled ||
|
|
283
311
|
jobRunStatus === generated_1.JobRunStatus.Finished) {
|
|
284
312
|
spinner.succeed(`Simulator session ended. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
285
|
-
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
313
|
+
await resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId);
|
|
286
314
|
return;
|
|
287
315
|
}
|
|
288
316
|
await (0, promise_1.sleepAsync)(POLL_INTERVAL_MS, signal);
|
|
@@ -291,7 +319,7 @@ async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessi
|
|
|
291
319
|
const stopped = await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
292
320
|
if (stopped) {
|
|
293
321
|
spinner.succeed('Simulator session stopped');
|
|
294
|
-
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
322
|
+
await resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId);
|
|
295
323
|
}
|
|
296
324
|
else {
|
|
297
325
|
spinner.fail(`Could not confirm the simulator session was stopped. Run \`eas simulator:stop --id ${deviceRunSessionId}\` to terminate it and avoid unexpected charges.`);
|
|
@@ -331,7 +359,7 @@ async function stopDeviceRunSessionAfterInterruptAsync({ graphqlClient, deviceRu
|
|
|
331
359
|
const stopped = await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
332
360
|
if (stopped) {
|
|
333
361
|
spinner.succeed('Simulator session stopped');
|
|
334
|
-
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
362
|
+
await resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId);
|
|
335
363
|
}
|
|
336
364
|
else {
|
|
337
365
|
spinner.fail(`Could not confirm the simulator session was stopped. Run \`eas simulator:stop --id ${deviceRunSessionId}\` to terminate it and avoid unexpected charges.`);
|
|
@@ -342,9 +370,9 @@ async function stopDeviceRunSessionAfterInterruptAsync({ graphqlClient, deviceRu
|
|
|
342
370
|
}
|
|
343
371
|
process.exit(130);
|
|
344
372
|
}
|
|
345
|
-
async function resetSimulatorEnvVerboseAsync(projectDir) {
|
|
373
|
+
async function resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId) {
|
|
346
374
|
try {
|
|
347
|
-
await (0, env_1.resetSimulatorEnvAsync)(projectDir);
|
|
375
|
+
await (0, env_1.resetSimulatorEnvAsync)(projectDir, deviceRunSessionId);
|
|
348
376
|
}
|
|
349
377
|
catch (err) {
|
|
350
378
|
log_1.default.error(`Failed to clean up ${env_1.SIMULATOR_DOTENV_FILE_NAME}`);
|
|
@@ -46,6 +46,7 @@ class SimulatorStop extends EasCommand_1.default {
|
|
|
46
46
|
stopSpinner.fail(`Failed to stop simulator session ${flagId}`);
|
|
47
47
|
throw err;
|
|
48
48
|
}
|
|
49
|
+
await (0, env_1.resetSimulatorEnvAsync)(projectDir, flagId);
|
|
49
50
|
if (jsonFlag) {
|
|
50
51
|
(0, json_1.printJsonOnlyOutput)({ id: session.id, status: session.status });
|
|
51
52
|
}
|