eas-cli 20.3.0 → 20.5.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 +136 -113
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/commandUtils/new/templates/AGENTS.md +25 -146
- package/build/commandUtils/new/templates/CLAUDE.md +1 -9
- package/build/commands/integrations/posthog/connect.d.ts +3 -0
- package/build/commands/integrations/posthog/connect.js +66 -12
- package/build/commands/observe/session.d.ts +18 -0
- package/build/commands/observe/session.js +65 -0
- package/build/commands/simulator/get.js +8 -10
- package/build/commands/simulator/list.js +7 -13
- package/build/commands/simulator/start.js +27 -27
- package/build/commands/simulator/stop.js +5 -5
- package/build/graphql/generated.d.ts +353 -78
- package/build/graphql/generated.js +41 -5
- package/build/graphql/mutations/PostHogMutation.d.ts +2 -2
- package/build/graphql/mutations/PostHogMutation.js +13 -7
- package/build/graphql/queries/AccountQuery.js +5 -0
- package/build/graphql/queries/PostHogQuery.d.ts +3 -1
- package/build/graphql/queries/PostHogQuery.js +5 -2
- package/build/graphql/types/Observe.js +1 -0
- package/build/graphql/types/PostHogConnection.d.ts +8 -0
- package/build/observe/fetchCustomEvents.d.ts +2 -2
- package/build/observe/fetchCustomEvents.js +2 -2
- package/build/observe/fetchEvents.d.ts +4 -3
- package/build/observe/fetchEvents.js +4 -3
- package/build/observe/fetchSessions.d.ts +51 -0
- package/build/observe/fetchSessions.js +86 -0
- package/build/observe/formatEvents.d.ts +1 -0
- package/build/observe/formatEvents.js +1 -0
- package/build/observe/formatSessions.d.ts +15 -0
- package/build/observe/formatSessions.js +100 -0
- package/build/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.js +23 -26
- package/build/utils/usage/checkForOverages.d.ts +13 -3
- package/build/utils/usage/checkForOverages.js +72 -21
- package/oclif.manifest.json +1644 -1549
- package/package.json +4 -3
|
@@ -31,19 +31,19 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
31
31
|
required: true,
|
|
32
32
|
})(),
|
|
33
33
|
type: core_1.Flags.option({
|
|
34
|
-
description: 'Type of
|
|
34
|
+
description: 'Type of simulator session to create',
|
|
35
35
|
options: Object.values(utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
|
|
36
36
|
default: utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES[generated_1.DeviceRunSessionType.AgentDevice],
|
|
37
37
|
})(),
|
|
38
38
|
'package-version': core_1.Flags.string({
|
|
39
|
-
description: 'Version of the package backing the
|
|
39
|
+
description: 'Version of the package backing the simulator session (e.g. "0.1.3-alpha.3"). Defaults to "latest" when omitted.',
|
|
40
40
|
}),
|
|
41
41
|
'max-duration-minutes': core_1.Flags.integer({
|
|
42
|
-
description: 'Maximum duration of the
|
|
42
|
+
description: 'Maximum duration of the simulator session in minutes before it is automatically stopped. Only customizable on paid plans. Defaults to a value derived from the job run priority when omitted.',
|
|
43
43
|
min: 0,
|
|
44
44
|
}),
|
|
45
45
|
force: core_1.Flags.boolean({
|
|
46
|
-
description: '[default: true] Create a new
|
|
46
|
+
description: '[default: true] Create a new simulator session even when an existing simulator session is present in the environment.',
|
|
47
47
|
default: true,
|
|
48
48
|
allowNo: true,
|
|
49
49
|
}),
|
|
@@ -71,7 +71,7 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
71
71
|
await (0, env_1.loadSimulatorEnvAsync)(projectDir);
|
|
72
72
|
const existingDeviceRunSessionId = process.env[env_1.EAS_SIMULATOR_SESSION_ID];
|
|
73
73
|
if (existingDeviceRunSessionId && !flags.force) {
|
|
74
|
-
throw new Error(`Existing simulator session in environment. Use --force to create a new
|
|
74
|
+
throw new Error(`Existing simulator session in environment. Use --force to create a new simulator session.`);
|
|
75
75
|
}
|
|
76
76
|
if (existingDeviceRunSessionId) {
|
|
77
77
|
log_1.default.warn(` Overwriting previous simulator session (id: ${existingDeviceRunSessionId}). ` +
|
|
@@ -80,9 +80,9 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
80
80
|
log_1.default.newLine();
|
|
81
81
|
}
|
|
82
82
|
const platform = flags.platform === 'android' ? generated_1.AppPlatform.Android : generated_1.AppPlatform.Ios;
|
|
83
|
-
const createSpinner = (0, ora_1.ora)('🚀 Creating
|
|
83
|
+
const createSpinner = (0, ora_1.ora)('🚀 Creating simulator session').start();
|
|
84
84
|
let deviceRunSessionId;
|
|
85
|
-
let
|
|
85
|
+
let deviceRunSessionUrl;
|
|
86
86
|
try {
|
|
87
87
|
const session = await DeviceRunSessionMutation_1.DeviceRunSessionMutation.createDeviceRunSessionAsync(graphqlClient, {
|
|
88
88
|
appId: projectId,
|
|
@@ -92,17 +92,17 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
92
92
|
maxRunTimeMinutes: flags['max-duration-minutes'],
|
|
93
93
|
});
|
|
94
94
|
deviceRunSessionId = session.id;
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
(0, nullthrows_1.default)(session.turtleJobRun?.id, 'Expected simulator session to start');
|
|
96
|
+
deviceRunSessionUrl = (0, url_1.getDeviceRunSessionUrl)(session.app.ownerAccount.name, session.app.slug, deviceRunSessionId);
|
|
97
97
|
const simulatorEnvWritten = !jsonFlag && flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv
|
|
98
98
|
? await writeSimulatorEnvSafelyAsync(projectDir, {
|
|
99
99
|
[env_1.EAS_SIMULATOR_SESSION_ID]: deviceRunSessionId,
|
|
100
100
|
})
|
|
101
101
|
: false;
|
|
102
|
-
createSpinner.succeed(`
|
|
102
|
+
createSpinner.succeed(`Simulator session created (id: ${deviceRunSessionId}${simulatorEnvWritten ? `, saved to ${env_1.SIMULATOR_DOTENV_FILE_NAME}` : ''}) ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
103
103
|
}
|
|
104
104
|
catch (err) {
|
|
105
|
-
createSpinner.fail('Failed to create
|
|
105
|
+
createSpinner.fail('Failed to create simulator session');
|
|
106
106
|
throw err;
|
|
107
107
|
}
|
|
108
108
|
const pollSpinner = (0, ora_1.ora)(`⏳ Waiting for ${flags.type} session to be ready`).start();
|
|
@@ -113,13 +113,13 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
113
113
|
const session = await DeviceRunSessionQuery_1.DeviceRunSessionQuery.byIdAsync(graphqlClient, deviceRunSessionId);
|
|
114
114
|
if (session.status === generated_1.DeviceRunSessionStatus.Errored ||
|
|
115
115
|
session.status === generated_1.DeviceRunSessionStatus.Stopped) {
|
|
116
|
-
throw new Error(`
|
|
116
|
+
throw new Error(`Simulator session ${deviceRunSessionId} ${session.status.toLowerCase()} before the ${flags.type} session was ready. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
117
117
|
}
|
|
118
118
|
const jobRunStatus = session.turtleJobRun?.status;
|
|
119
119
|
if (jobRunStatus === generated_1.JobRunStatus.Errored ||
|
|
120
120
|
jobRunStatus === generated_1.JobRunStatus.Canceled ||
|
|
121
121
|
jobRunStatus === generated_1.JobRunStatus.Finished) {
|
|
122
|
-
throw new Error(`Turtle job run for
|
|
122
|
+
throw new Error(`Turtle job run for simulator session ${deviceRunSessionId} ${jobRunStatus.toLowerCase()} before the ${flags.type} session was ready. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
123
123
|
}
|
|
124
124
|
if (session.remoteConfig) {
|
|
125
125
|
remoteConfig = session.remoteConfig;
|
|
@@ -137,7 +137,7 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
137
137
|
if (!remoteConfig) {
|
|
138
138
|
pollSpinner.fail(`Timed out waiting for ${flags.type} session to be ready`);
|
|
139
139
|
await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
140
|
-
throw new Error(`Timed out after ${Math.round(POLL_TIMEOUT_MS / 1000)}s waiting for ${flags.type} session to be ready. ${(0, log_1.link)(
|
|
140
|
+
throw new Error(`Timed out after ${Math.round(POLL_TIMEOUT_MS / 1000)}s waiting for ${flags.type} session to be ready. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
141
141
|
}
|
|
142
142
|
if (flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv) {
|
|
143
143
|
await writeSimulatorEnvSafelyAsync(projectDir, {
|
|
@@ -149,7 +149,7 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
149
149
|
(0, json_1.printJsonOnlyOutput)({
|
|
150
150
|
id: deviceRunSessionId,
|
|
151
151
|
type: flags.type,
|
|
152
|
-
|
|
152
|
+
deviceRunSessionUrl,
|
|
153
153
|
remoteConfig,
|
|
154
154
|
});
|
|
155
155
|
return;
|
|
@@ -164,7 +164,7 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
164
164
|
await waitForSessionEndOrInterruptAsync({
|
|
165
165
|
graphqlClient,
|
|
166
166
|
deviceRunSessionId,
|
|
167
|
-
|
|
167
|
+
deviceRunSessionUrl,
|
|
168
168
|
projectDir,
|
|
169
169
|
});
|
|
170
170
|
}
|
|
@@ -180,8 +180,8 @@ async function writeSimulatorEnvSafelyAsync(projectDir, environmentVariables) {
|
|
|
180
180
|
return false;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessionId,
|
|
184
|
-
const spinner = (0, ora_1.ora)(`
|
|
183
|
+
async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessionId, deviceRunSessionUrl, projectDir, }) {
|
|
184
|
+
const spinner = (0, ora_1.ora)(`Simulator session active — press Ctrl+C to stop, or run \`eas simulator:stop --id ${deviceRunSessionId}\` from another shell`).start();
|
|
185
185
|
const abortController = new AbortController();
|
|
186
186
|
const { signal } = abortController;
|
|
187
187
|
const abortPromise = new Promise(resolve => {
|
|
@@ -193,7 +193,7 @@ async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessi
|
|
|
193
193
|
if (signal.aborted) {
|
|
194
194
|
// Force exit on a second Ctrl+C in case cleanup is hanging. The session may still be
|
|
195
195
|
// running on EAS, so tell the user how to make sure it gets terminated.
|
|
196
|
-
spinner.fail(`Aborted before the
|
|
196
|
+
spinner.fail(`Aborted before the simulator session could be stopped. Run \`eas simulator:stop --id ${deviceRunSessionId}\` to terminate it and avoid unexpected charges.`);
|
|
197
197
|
process.exit(130);
|
|
198
198
|
}
|
|
199
199
|
abortController.abort();
|
|
@@ -206,33 +206,33 @@ async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessi
|
|
|
206
206
|
session = await DeviceRunSessionQuery_1.DeviceRunSessionQuery.byIdAsync(graphqlClient, deviceRunSessionId);
|
|
207
207
|
}
|
|
208
208
|
catch (err) {
|
|
209
|
-
log_1.default.debug(`Failed to poll
|
|
209
|
+
log_1.default.debug(`Failed to poll simulator session: ${err instanceof Error ? err.message : String(err)}`);
|
|
210
210
|
await Promise.race([(0, promise_1.sleepAsync)(POLL_INTERVAL_MS), abortPromise]);
|
|
211
211
|
continue;
|
|
212
212
|
}
|
|
213
213
|
const jobRunStatus = session.turtleJobRun?.status;
|
|
214
214
|
if (session.status === generated_1.DeviceRunSessionStatus.Errored ||
|
|
215
215
|
jobRunStatus === generated_1.JobRunStatus.Errored) {
|
|
216
|
-
spinner.fail(`
|
|
217
|
-
throw new Error(`
|
|
216
|
+
spinner.fail(`Simulator session errored. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
217
|
+
throw new Error(`Simulator session ${deviceRunSessionId} errored.`);
|
|
218
218
|
}
|
|
219
219
|
if (session.status === generated_1.DeviceRunSessionStatus.Stopped ||
|
|
220
220
|
jobRunStatus === generated_1.JobRunStatus.Canceled ||
|
|
221
221
|
jobRunStatus === generated_1.JobRunStatus.Finished) {
|
|
222
|
-
spinner.succeed(`
|
|
222
|
+
spinner.succeed(`Simulator session ended. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
223
223
|
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
await Promise.race([(0, promise_1.sleepAsync)(POLL_INTERVAL_MS), abortPromise]);
|
|
227
227
|
}
|
|
228
|
-
spinner.text = 'Stopping
|
|
228
|
+
spinner.text = 'Stopping simulator session...';
|
|
229
229
|
const stopped = await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
230
230
|
if (stopped) {
|
|
231
|
-
spinner.succeed('
|
|
231
|
+
spinner.succeed('Simulator session stopped');
|
|
232
232
|
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
233
233
|
}
|
|
234
234
|
else {
|
|
235
|
-
spinner.fail(`Could not confirm the
|
|
235
|
+
spinner.fail(`Could not confirm the simulator session was stopped. Run \`eas simulator:stop --id ${deviceRunSessionId}\` to terminate it and avoid unexpected charges.`);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
finally {
|
|
@@ -255,7 +255,7 @@ async function ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRun
|
|
|
255
255
|
}
|
|
256
256
|
catch (err) {
|
|
257
257
|
// Cleanup is best-effort; surface the failure but don't mask the original error.
|
|
258
|
-
log_1.default.warn(`Failed to stop
|
|
258
|
+
log_1.default.warn(`Failed to stop simulator session ${deviceRunSessionId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
259
259
|
return false;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
@@ -10,10 +10,10 @@ const env_1 = require("../../simulator/env");
|
|
|
10
10
|
const json_1 = require("../../utils/json");
|
|
11
11
|
class SimulatorStop extends EasCommand_1.default {
|
|
12
12
|
static hidden = true;
|
|
13
|
-
static description = '[EXPERIMENTAL] stop a remote simulator session on EAS by its
|
|
13
|
+
static description = '[EXPERIMENTAL] stop a remote simulator session on EAS by its simulator session ID';
|
|
14
14
|
static flags = {
|
|
15
15
|
id: core_1.Flags.string({
|
|
16
|
-
description: `
|
|
16
|
+
description: `Simulator session ID. Defaults to ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`,
|
|
17
17
|
}),
|
|
18
18
|
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
19
19
|
};
|
|
@@ -35,14 +35,14 @@ class SimulatorStop extends EasCommand_1.default {
|
|
|
35
35
|
if (!flagId) {
|
|
36
36
|
throw new Error(`No simulator session ID provided. Pass --id, or run \`eas simulator:start\` first to write ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`);
|
|
37
37
|
}
|
|
38
|
-
const stopSpinner = (0, ora_1.ora)(`🛑 Stopping
|
|
38
|
+
const stopSpinner = (0, ora_1.ora)(`🛑 Stopping simulator session ${flagId}`).start();
|
|
39
39
|
let session;
|
|
40
40
|
try {
|
|
41
41
|
session = await DeviceRunSessionMutation_1.DeviceRunSessionMutation.ensureDeviceRunSessionStoppedAsync(graphqlClient, flagId);
|
|
42
|
-
stopSpinner.succeed(`🎉
|
|
42
|
+
stopSpinner.succeed(`🎉 Simulator session ${session.id} is ${session.status.toLowerCase()}`);
|
|
43
43
|
}
|
|
44
44
|
catch (err) {
|
|
45
|
-
stopSpinner.fail(`Failed to stop
|
|
45
|
+
stopSpinner.fail(`Failed to stop simulator session ${flagId}`);
|
|
46
46
|
throw err;
|
|
47
47
|
}
|
|
48
48
|
if (jsonFlag) {
|