eas-cli 19.0.5 → 19.0.6
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 +100 -100
- package/build/commands/simulator/get.d.ts +1 -0
- package/build/commands/simulator/get.js +17 -2
- package/build/commands/simulator/start.js +3 -11
- package/build/commands/simulator/stop.d.ts +1 -0
- package/build/commands/simulator/stop.js +10 -2
- package/build/simulator/utils.d.ts +4 -1
- package/build/simulator/utils.js +14 -0
- package/oclif.manifest.json +1159 -1147
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@ export default class SimulatorGet extends EasCommand {
|
|
|
3
3
|
static hidden: boolean;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
7
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
9
|
};
|
|
@@ -10,6 +10,7 @@ const DeviceRunSessionQuery_1 = require("../../graphql/queries/DeviceRunSessionQ
|
|
|
10
10
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
11
11
|
const ora_1 = require("../../ora");
|
|
12
12
|
const utils_1 = require("../../simulator/utils");
|
|
13
|
+
const json_1 = require("../../utils/json");
|
|
13
14
|
class SimulatorGet extends EasCommand_1.default {
|
|
14
15
|
static hidden = true;
|
|
15
16
|
static description = '[EXPERIMENTAL] get info about a remote simulator session on EAS by its device run session ID';
|
|
@@ -18,15 +19,19 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
18
19
|
description: 'Device run session ID',
|
|
19
20
|
required: true,
|
|
20
21
|
}),
|
|
21
|
-
...flags_1.
|
|
22
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
22
23
|
};
|
|
23
24
|
static contextDefinition = {
|
|
24
25
|
...this.ContextOptions.LoggedIn,
|
|
25
26
|
};
|
|
26
27
|
async runAsync() {
|
|
27
28
|
const { flags } = await this.parse(SimulatorGet);
|
|
29
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
30
|
+
if (jsonFlag) {
|
|
31
|
+
(0, json_1.enableJsonOutput)();
|
|
32
|
+
}
|
|
28
33
|
const { loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorGet, {
|
|
29
|
-
nonInteractive
|
|
34
|
+
nonInteractive,
|
|
30
35
|
});
|
|
31
36
|
const fetchSpinner = (0, ora_1.ora)(`Fetching device run session ${flags.id}`).start();
|
|
32
37
|
let session;
|
|
@@ -41,6 +46,16 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
41
46
|
const jobRunUrl = session.turtleJobRun
|
|
42
47
|
? (0, url_1.getBareJobRunUrl)(session.app.ownerAccount.name, session.app.slug, session.turtleJobRun.id)
|
|
43
48
|
: '';
|
|
49
|
+
if (jsonFlag) {
|
|
50
|
+
(0, json_1.printJsonOnlyOutput)({
|
|
51
|
+
id: session.id,
|
|
52
|
+
type: (0, utils_1.deviceRunSessionTypeToFlagValue)(session.type),
|
|
53
|
+
status: session.status,
|
|
54
|
+
jobRunUrl: jobRunUrl || undefined,
|
|
55
|
+
remoteConfig: session.remoteConfig,
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
44
59
|
log_1.default.newLine();
|
|
45
60
|
log_1.default.log(`ID: ${session.id}`);
|
|
46
61
|
log_1.default.log(`Type: ${session.type}`);
|
|
@@ -16,14 +16,6 @@ const promise_1 = require("../../utils/promise");
|
|
|
16
16
|
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
17
17
|
const POLL_INTERVAL_MS = 5_000; // 5 seconds
|
|
18
18
|
const POLL_TIMEOUT_MS = 15 * 60 * 1_000; // 15 minutes
|
|
19
|
-
// Mapping enum → CLI flag value. Declared as Record<DeviceRunSessionType, string>
|
|
20
|
-
// so adding a new enum value in codegen fails the build until it is wired up here.
|
|
21
|
-
const DEVICE_RUN_SESSION_TYPE_FLAG_VALUES = {
|
|
22
|
-
[generated_1.DeviceRunSessionType.AgentDevice]: 'agent-device',
|
|
23
|
-
[generated_1.DeviceRunSessionType.Argent]: 'argent',
|
|
24
|
-
[generated_1.DeviceRunSessionType.ServeSim]: 'serve-sim',
|
|
25
|
-
};
|
|
26
|
-
const DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE = Object.fromEntries(Object.entries(DEVICE_RUN_SESSION_TYPE_FLAG_VALUES).map(([type, value]) => [value, type]));
|
|
27
19
|
class SimulatorStart extends EasCommand_1.default {
|
|
28
20
|
static hidden = true;
|
|
29
21
|
static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it';
|
|
@@ -35,8 +27,8 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
35
27
|
})(),
|
|
36
28
|
type: core_1.Flags.option({
|
|
37
29
|
description: 'Type of device run session to create',
|
|
38
|
-
options: Object.values(DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
|
|
39
|
-
default: DEVICE_RUN_SESSION_TYPE_FLAG_VALUES[generated_1.DeviceRunSessionType.AgentDevice],
|
|
30
|
+
options: Object.values(utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
|
|
31
|
+
default: utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES[generated_1.DeviceRunSessionType.AgentDevice],
|
|
40
32
|
})(),
|
|
41
33
|
'package-version': core_1.Flags.string({
|
|
42
34
|
description: 'Version of the package backing the device run session (e.g. "0.1.3-alpha.3"). Defaults to "latest" when omitted.',
|
|
@@ -64,7 +56,7 @@ class SimulatorStart extends EasCommand_1.default {
|
|
|
64
56
|
const session = await DeviceRunSessionMutation_1.DeviceRunSessionMutation.createDeviceRunSessionAsync(graphqlClient, {
|
|
65
57
|
appId: projectId,
|
|
66
58
|
platform,
|
|
67
|
-
type: DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
59
|
+
type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
68
60
|
packageVersion: flags['package-version'],
|
|
69
61
|
});
|
|
70
62
|
deviceRunSessionId = session.id;
|
|
@@ -3,6 +3,7 @@ export default class SimulatorStop extends EasCommand {
|
|
|
3
3
|
static hidden: boolean;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
7
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
9
|
};
|
|
@@ -6,6 +6,7 @@ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasComm
|
|
|
6
6
|
const flags_1 = require("../../commandUtils/flags");
|
|
7
7
|
const DeviceRunSessionMutation_1 = require("../../graphql/mutations/DeviceRunSessionMutation");
|
|
8
8
|
const ora_1 = require("../../ora");
|
|
9
|
+
const json_1 = require("../../utils/json");
|
|
9
10
|
class SimulatorStop extends EasCommand_1.default {
|
|
10
11
|
static hidden = true;
|
|
11
12
|
static description = '[EXPERIMENTAL] stop a remote simulator session on EAS by its device run session ID';
|
|
@@ -14,20 +15,27 @@ class SimulatorStop extends EasCommand_1.default {
|
|
|
14
15
|
description: 'Device run session ID',
|
|
15
16
|
required: true,
|
|
16
17
|
}),
|
|
17
|
-
...flags_1.
|
|
18
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
18
19
|
};
|
|
19
20
|
static contextDefinition = {
|
|
20
21
|
...this.ContextOptions.LoggedIn,
|
|
21
22
|
};
|
|
22
23
|
async runAsync() {
|
|
23
24
|
const { flags } = await this.parse(SimulatorStop);
|
|
25
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
26
|
+
if (jsonFlag) {
|
|
27
|
+
(0, json_1.enableJsonOutput)();
|
|
28
|
+
}
|
|
24
29
|
const { loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorStop, {
|
|
25
|
-
nonInteractive
|
|
30
|
+
nonInteractive,
|
|
26
31
|
});
|
|
27
32
|
const stopSpinner = (0, ora_1.ora)(`🛑 Stopping device run session ${flags.id}`).start();
|
|
28
33
|
try {
|
|
29
34
|
const session = await DeviceRunSessionMutation_1.DeviceRunSessionMutation.ensureDeviceRunSessionStoppedAsync(graphqlClient, flags.id);
|
|
30
35
|
stopSpinner.succeed(`🎉 Device run session ${session.id} is ${session.status.toLowerCase()}`);
|
|
36
|
+
if (jsonFlag) {
|
|
37
|
+
(0, json_1.printJsonOnlyOutput)({ id: session.id, status: session.status });
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
catch (err) {
|
|
33
41
|
stopSpinner.fail(`Failed to stop device run session ${flags.id}`);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { DeviceRunSessionByIdQuery } from '../graphql/generated';
|
|
1
|
+
import { DeviceRunSessionByIdQuery, DeviceRunSessionType } from '../graphql/generated';
|
|
2
2
|
type DeviceRunSessionByIdResult = DeviceRunSessionByIdQuery['deviceRunSessions']['byId'];
|
|
3
3
|
export type DeviceRunSessionRemoteConfig = NonNullable<DeviceRunSessionByIdResult['remoteConfig']>;
|
|
4
|
+
export declare const DEVICE_RUN_SESSION_TYPE_FLAG_VALUES: Record<DeviceRunSessionType, string>;
|
|
5
|
+
export declare const DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE: Record<string, DeviceRunSessionType>;
|
|
6
|
+
export declare function deviceRunSessionTypeToFlagValue(type: DeviceRunSessionType): string;
|
|
4
7
|
export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig): string;
|
|
5
8
|
export {};
|
package/build/simulator/utils.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE = exports.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES = void 0;
|
|
4
|
+
exports.deviceRunSessionTypeToFlagValue = deviceRunSessionTypeToFlagValue;
|
|
3
5
|
exports.formatRemoteSessionInstructions = formatRemoteSessionInstructions;
|
|
6
|
+
const generated_1 = require("../graphql/generated");
|
|
7
|
+
// Mapping enum -> CLI flag value. Declared as Record<DeviceRunSessionType, string>
|
|
8
|
+
// so adding a new enum value in codegen fails the build until it is wired up here.
|
|
9
|
+
exports.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES = {
|
|
10
|
+
[generated_1.DeviceRunSessionType.AgentDevice]: 'agent-device',
|
|
11
|
+
[generated_1.DeviceRunSessionType.Argent]: 'argent',
|
|
12
|
+
[generated_1.DeviceRunSessionType.ServeSim]: 'serve-sim',
|
|
13
|
+
};
|
|
14
|
+
exports.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE = Object.fromEntries(Object.entries(exports.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES).map(([type, value]) => [value, type]));
|
|
15
|
+
function deviceRunSessionTypeToFlagValue(type) {
|
|
16
|
+
return exports.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES[type];
|
|
17
|
+
}
|
|
4
18
|
function formatRemoteSessionInstructions(remoteConfig) {
|
|
5
19
|
switch (remoteConfig.__typename) {
|
|
6
20
|
case 'AgentDeviceRunSessionRemoteConfig': {
|