eas-cli 22.2.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 +220 -205
- package/build/commands/go.d.ts +0 -1
- package/build/commands/go.js +2 -16
- package/build/commands/simulator/index.d.ts +3 -0
- package/build/commands/simulator/index.js +23 -0
- package/build/graphql/generated.d.ts +10 -0
- package/build/project/detectProjectSdkVersionAsync.d.ts +1 -0
- package/build/project/detectProjectSdkVersionAsync.js +17 -0
- package/build/simulator/expoGo.d.ts +5 -0
- package/build/simulator/expoGo.js +54 -0
- package/oclif.manifest.json +283 -251
- package/package.json +2 -2
package/build/commands/go.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import EasCommand from '../commandUtils/EasCommand';
|
|
2
|
-
export declare function detectProjectSdkVersionAsync(projectDir: string): Promise<string | undefined>;
|
|
3
2
|
export declare function toRepackTargetSdkVersion(sdkVersion: string | undefined): string | undefined;
|
|
4
3
|
export default class Go extends EasCommand {
|
|
5
4
|
static description: string;
|
package/build/commands/go.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectProjectSdkVersionAsync = detectProjectSdkVersionAsync;
|
|
4
3
|
exports.toRepackTargetSdkVersion = toRepackTargetSdkVersion;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
|
-
const config_1 = require("@expo/config");
|
|
7
5
|
const core_1 = require("@oclif/core");
|
|
8
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
7
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
@@ -27,7 +25,7 @@ const WorkflowRunQuery_1 = require("../graphql/queries/WorkflowRunQuery");
|
|
|
27
25
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
28
26
|
const prompts_1 = require("../prompts");
|
|
29
27
|
const ora_1 = require("../ora");
|
|
30
|
-
const
|
|
28
|
+
const detectProjectSdkVersionAsync_1 = require("../project/detectProjectSdkVersionAsync");
|
|
31
29
|
const fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1 = require("../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync");
|
|
32
30
|
const uploadAccountScopedFileAsync_1 = require("../project/uploadAccountScopedFileAsync");
|
|
33
31
|
const uploadAccountScopedProjectSourceAsync_1 = require("../project/uploadAccountScopedProjectSourceAsync");
|
|
@@ -39,18 +37,6 @@ const bundleIdentifier_1 = require("../project/ios/bundleIdentifier");
|
|
|
39
37
|
function deriveBundleIdSlug(bundleId) {
|
|
40
38
|
return bundleId.split('.').filter(Boolean).pop();
|
|
41
39
|
}
|
|
42
|
-
async function detectProjectSdkVersionAsync(projectDir) {
|
|
43
|
-
const paths = (0, config_1.getConfigFilePaths)(projectDir);
|
|
44
|
-
if (!paths.staticConfigPath && !paths.dynamicConfigPath) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
return (await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir)).sdkVersion;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
40
|
function toRepackTargetSdkVersion(sdkVersion) {
|
|
55
41
|
const coerced = semver_1.default.coerce(sdkVersion);
|
|
56
42
|
return coerced ? `${coerced.major}.0.0` : sdkVersion;
|
|
@@ -128,7 +114,7 @@ class Go extends EasCommand_1.default {
|
|
|
128
114
|
nonInteractive: false,
|
|
129
115
|
});
|
|
130
116
|
log_1.default.withTick(`Logged in as ${chalk_1.default.cyan((0, User_1.getActorDisplayName)(actor))}`);
|
|
131
|
-
const detectedSdkVersion = await detectProjectSdkVersionAsync(process.cwd());
|
|
117
|
+
const detectedSdkVersion = await (0, detectProjectSdkVersionAsync_1.detectProjectSdkVersionAsync)(process.cwd());
|
|
132
118
|
if (detectedSdkVersion && !flags['sdk-version']) {
|
|
133
119
|
log_1.default.log(`Current project using SDK ${detectedSdkVersion.split('.')[0]}. Auto-selected same version. To use a different version, pass --sdk-version.`);
|
|
134
120
|
}
|
|
@@ -9,6 +9,9 @@ export default class Simulator extends EasCommand {
|
|
|
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
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>;
|
|
12
15
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
16
|
'package-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
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");
|
|
@@ -45,6 +46,18 @@ class Simulator extends EasCommand_1.default {
|
|
|
45
46
|
device: core_1.Flags.string({
|
|
46
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.',
|
|
47
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
|
+
}),
|
|
48
61
|
type: core_1.Flags.option({
|
|
49
62
|
description: 'Type of simulator session to create',
|
|
50
63
|
options: Object.values(utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
|
|
@@ -96,12 +109,20 @@ class Simulator extends EasCommand_1.default {
|
|
|
96
109
|
// --name as if it had been omitted rather than surfacing a validation error.
|
|
97
110
|
const name = flags.name?.trim() || undefined;
|
|
98
111
|
const deviceIdentifier = flags.device?.trim() || undefined;
|
|
112
|
+
const buildId = flags['build-id']?.trim() || undefined;
|
|
113
|
+
const applicationArchiveUrlFromFlag = flags['application-archive-url']?.trim() || undefined;
|
|
99
114
|
await (0, env_1.loadSimulatorEnvAsync)(projectDir);
|
|
100
115
|
const existingDeviceRunSessionId = process.env[env_1.EAS_SIMULATOR_SESSION_ID];
|
|
101
116
|
if (existingDeviceRunSessionId && !flags.force) {
|
|
102
117
|
throw new Error(`Existing simulator session in environment. Use --force to create a new simulator session.`);
|
|
103
118
|
}
|
|
104
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;
|
|
105
126
|
if (existingDeviceRunSessionId) {
|
|
106
127
|
log_1.default.warn(` Overwriting previous simulator session (id: ${existingDeviceRunSessionId}). ` +
|
|
107
128
|
`The previous remote session will continue running until stopped. ` +
|
|
@@ -120,6 +141,8 @@ class Simulator extends EasCommand_1.default {
|
|
|
120
141
|
type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
121
142
|
packageVersion: flags['package-version'],
|
|
122
143
|
deviceIdentifier,
|
|
144
|
+
...(buildId ? { buildId } : {}),
|
|
145
|
+
...(applicationArchiveUrl ? { applicationArchiveUrl } : {}),
|
|
123
146
|
maxRunTimeMinutes: flags['max-duration-minutes'],
|
|
124
147
|
});
|
|
125
148
|
deviceRunSessionId = session.id;
|
|
@@ -4470,6 +4470,16 @@ export type CreateDeviceRunSessionEventLogUploadSessionResult = {
|
|
|
4470
4470
|
};
|
|
4471
4471
|
export type CreateDeviceRunSessionInput = {
|
|
4472
4472
|
appId: Scalars['ID']['input'];
|
|
4473
|
+
/**
|
|
4474
|
+
* Application archive URL to download, install, and launch before the simulator session
|
|
4475
|
+
* becomes available. Mutually exclusive with buildId.
|
|
4476
|
+
*/
|
|
4477
|
+
applicationArchiveUrl?: InputMaybe<Scalars['String']['input']>;
|
|
4478
|
+
/**
|
|
4479
|
+
* EAS Build to install and launch before the simulator session becomes available.
|
|
4480
|
+
* Mutually exclusive with applicationArchiveUrl.
|
|
4481
|
+
*/
|
|
4482
|
+
buildId?: InputMaybe<Scalars['ID']['input']>;
|
|
4473
4483
|
/**
|
|
4474
4484
|
* Identifier of the virtual device to start for the session. On iOS this is a
|
|
4475
4485
|
* Simulator device name or UDID (e.g. "iPhone 16 Pro"). On Android this is an
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectProjectSdkVersionAsync(projectDir: string): Promise<string | undefined>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectProjectSdkVersionAsync = detectProjectSdkVersionAsync;
|
|
4
|
+
const config_1 = require("@expo/config");
|
|
5
|
+
const expoConfig_1 = require("./expoConfig");
|
|
6
|
+
async function detectProjectSdkVersionAsync(projectDir) {
|
|
7
|
+
const paths = (0, config_1.getConfigFilePaths)(projectDir);
|
|
8
|
+
if (!paths.staticConfigPath && !paths.dynamicConfigPath) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
return (await (0, expoConfig_1.getPrivateExpoConfigAsync)(projectDir)).sdkVersion;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveExpoGoApplicationArchiveUrlAsync = resolveExpoGoApplicationArchiveUrlAsync;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
|
|
7
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
|
+
const errors_1 = require("../commandUtils/errors");
|
|
9
|
+
const detectProjectSdkVersionAsync_1 = require("../project/detectProjectSdkVersionAsync");
|
|
10
|
+
const EXPO_GO_DOWNLOAD_MESSAGE = 'Download Expo Go from';
|
|
11
|
+
function extractApplicationArchiveUrl(stdout) {
|
|
12
|
+
const output = (0, util_1.stripVTControlCharacters)(stdout);
|
|
13
|
+
const outputLines = output.trim().split(/\r?\n/);
|
|
14
|
+
const downloadMessageLine = outputLines.find(line => line.includes(EXPO_GO_DOWNLOAD_MESSAGE));
|
|
15
|
+
const bareUrlOutput = outputLines.length === 1 ? outputLines[0] : undefined;
|
|
16
|
+
const lineWithUrl = downloadMessageLine ?? bareUrlOutput;
|
|
17
|
+
return lineWithUrl?.match(/https?:\/\/[^\s\])]+/)?.[0];
|
|
18
|
+
}
|
|
19
|
+
async function resolveExpoGoApplicationArchiveUrlAsync({ platform, projectDir, }) {
|
|
20
|
+
const sdkVersion = await (0, detectProjectSdkVersionAsync_1.detectProjectSdkVersionAsync)(projectDir);
|
|
21
|
+
const sdkMajorVersion = semver_1.default.coerce(sdkVersion)?.major;
|
|
22
|
+
if (!sdkMajorVersion) {
|
|
23
|
+
throw new errors_1.EasCommandError("Unable to determine this project's Expo SDK version, so Expo Go could not be selected. " +
|
|
24
|
+
'Make sure the project has Expo installed and a valid app config, or use --build-id or --application-archive-url instead.');
|
|
25
|
+
}
|
|
26
|
+
const args = ['--yes', 'expo-go', 'url', platform, String(sdkMajorVersion)];
|
|
27
|
+
let stdout;
|
|
28
|
+
try {
|
|
29
|
+
({ stdout } = await (0, spawn_async_1.default)('npx', args, {
|
|
30
|
+
cwd: projectDir,
|
|
31
|
+
stdio: 'pipe',
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const reason = error instanceof Error ? ` ${error.message}` : '';
|
|
36
|
+
throw new errors_1.EasCommandError(`Failed to resolve the Expo Go download URL for SDK ${sdkMajorVersion} on ${platform}.${reason} ` +
|
|
37
|
+
`Run "npx expo-go url ${platform} ${sdkMajorVersion}" to diagnose the problem, or use --build-id or --application-archive-url instead.`);
|
|
38
|
+
}
|
|
39
|
+
const applicationArchiveUrl = extractApplicationArchiveUrl(stdout);
|
|
40
|
+
try {
|
|
41
|
+
if (!applicationArchiveUrl) {
|
|
42
|
+
throw new Error('Missing URL');
|
|
43
|
+
}
|
|
44
|
+
const parsedUrl = new URL(applicationArchiveUrl);
|
|
45
|
+
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
|
|
46
|
+
throw new Error('Unsupported protocol');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
throw new errors_1.EasCommandError(`expo-go returned an invalid download URL for SDK ${sdkMajorVersion} on ${platform}. ` +
|
|
51
|
+
`Run "npx expo-go url ${platform} ${sdkMajorVersion}" to diagnose the problem, or use --build-id or --application-archive-url instead.`);
|
|
52
|
+
}
|
|
53
|
+
return applicationArchiveUrl;
|
|
54
|
+
}
|