eas-cli 21.0.3 → 21.2.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.
@@ -143,5 +143,9 @@ function truncateGitCommitMessage(msg, maxLength = 4096) {
143
143
  if (msg === undefined) {
144
144
  return undefined;
145
145
  }
146
- return msg.length > maxLength ? `${msg.substring(0, maxLength - 3)}...` : msg;
146
+ if (msg.length <= maxLength) {
147
+ return msg;
148
+ }
149
+ const truncated = msg.substring(0, maxLength - 3).replace(/[\uD800-\uDBFF]$/, '');
150
+ return `${truncated}...`;
147
151
  }
@@ -0,0 +1,14 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class SimulatorAvailability extends EasCommand {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static flags: {
6
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ };
9
+ static contextDefinition: {
10
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
11
+ projectId: import("../../commandUtils/context/ProjectIdContextField").ProjectIdContextField;
12
+ };
13
+ runAsync(): Promise<void>;
14
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
5
+ const flags_1 = require("../../commandUtils/flags");
6
+ const DeviceRunSessionAvailabilityQuery_1 = require("../../graphql/queries/DeviceRunSessionAvailabilityQuery");
7
+ const log_1 = tslib_1.__importDefault(require("../../log"));
8
+ const ora_1 = require("../../ora");
9
+ const json_1 = require("../../utils/json");
10
+ class SimulatorAvailability extends EasCommand_1.default {
11
+ static hidden = true;
12
+ static description = '[EXPERIMENTAL] check whether EAS Simulator is enabled for the current project account';
13
+ static flags = {
14
+ ...flags_1.EasNonInteractiveAndJsonFlags,
15
+ };
16
+ static contextDefinition = {
17
+ ...this.ContextOptions.ProjectId,
18
+ ...this.ContextOptions.LoggedIn,
19
+ };
20
+ async runAsync() {
21
+ const { flags } = await this.parse(SimulatorAvailability);
22
+ const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
23
+ if (jsonFlag) {
24
+ (0, json_1.enableJsonOutput)();
25
+ }
26
+ const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorAvailability, {
27
+ nonInteractive,
28
+ });
29
+ const fetchSpinner = jsonFlag ? null : (0, ora_1.ora)('Checking EAS Simulator availability').start();
30
+ let accountName;
31
+ let available;
32
+ try {
33
+ ({ accountName, available } = await DeviceRunSessionAvailabilityQuery_1.DeviceRunSessionAvailabilityQuery.byAppIdAsync(graphqlClient, projectId));
34
+ fetchSpinner?.stop();
35
+ }
36
+ catch (err) {
37
+ fetchSpinner?.fail('Failed to check EAS Simulator availability');
38
+ throw err;
39
+ }
40
+ if (jsonFlag) {
41
+ (0, json_1.printJsonOnlyOutput)({ available, accountName });
42
+ return;
43
+ }
44
+ if (available) {
45
+ log_1.default.log(`✅ EAS Simulator is enabled for ${accountName}.`);
46
+ return;
47
+ }
48
+ log_1.default.log(`EAS Simulator isn't available on ${accountName} yet — it's coming soon.`);
49
+ }
50
+ }
51
+ exports.default = SimulatorAvailability;
@@ -1,11 +1,12 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class SimulatorStart extends EasCommand {
3
3
  static hidden: boolean;
4
+ static aliases: string[];
4
5
  static description: string;
5
6
  static flags: {
6
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
8
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
- platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios", import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
10
  type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
11
  'package-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
12
  'max-duration-minutes': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -11,6 +11,7 @@ const DeviceRunSessionMutation_1 = require("../../graphql/mutations/DeviceRunSes
11
11
  const DeviceRunSessionQuery_1 = require("../../graphql/queries/DeviceRunSessionQuery");
12
12
  const log_1 = tslib_1.__importStar(require("../../log"));
13
13
  const ora_1 = require("../../ora");
14
+ const prompts_1 = require("../../prompts");
14
15
  const env_1 = require("../../simulator/env");
15
16
  const utils_1 = require("../../simulator/utils");
16
17
  const json_1 = require("../../utils/json");
@@ -21,15 +22,20 @@ const OUT_CONFIG_TYPE_VALUES = {
21
22
  Env: 'env',
22
23
  Dotenv: 'dotenv',
23
24
  };
25
+ const PLATFORM_FLAG_VALUES = ['android', 'ios'];
26
+ const APP_PLATFORM_BY_FLAG_VALUE = {
27
+ android: generated_1.AppPlatform.Android,
28
+ ios: generated_1.AppPlatform.Ios,
29
+ };
24
30
  class SimulatorStart extends EasCommand_1.default {
25
31
  static hidden = true;
32
+ static aliases = ['simulator'];
26
33
  static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it';
27
34
  static flags = {
28
35
  platform: core_1.Flags.option({
29
36
  char: 'p',
30
37
  description: 'Device platform',
31
- options: ['android', 'ios'],
32
- required: true,
38
+ options: PLATFORM_FLAG_VALUES,
33
39
  })(),
34
40
  type: core_1.Flags.option({
35
41
  description: 'Type of simulator session to create',
@@ -74,13 +80,13 @@ class SimulatorStart extends EasCommand_1.default {
74
80
  if (existingDeviceRunSessionId && !flags.force) {
75
81
  throw new Error(`Existing simulator session in environment. Use --force to create a new simulator session.`);
76
82
  }
83
+ const platform = await resolvePlatformAsync(flags.platform, nonInteractive);
77
84
  if (existingDeviceRunSessionId) {
78
85
  log_1.default.warn(` Overwriting previous simulator session (id: ${existingDeviceRunSessionId}). ` +
79
86
  `The previous remote session will continue running until stopped. ` +
80
87
  `To stop it, run: eas simulator:stop --id ${existingDeviceRunSessionId}`);
81
88
  log_1.default.newLine();
82
89
  }
83
- const platform = flags.platform === 'android' ? generated_1.AppPlatform.Android : generated_1.AppPlatform.Ios;
84
90
  const createSpinner = (0, ora_1.ora)('🚀 Creating simulator session').start();
85
91
  let deviceRunSessionId;
86
92
  let deviceRunSessionUrl;
@@ -171,6 +177,24 @@ class SimulatorStart extends EasCommand_1.default {
171
177
  }
172
178
  }
173
179
  exports.default = SimulatorStart;
180
+ async function resolvePlatformAsync(platform, nonInteractive) {
181
+ if (platform) {
182
+ return APP_PLATFORM_BY_FLAG_VALUE[platform];
183
+ }
184
+ if (nonInteractive) {
185
+ throw new Error('The --platform flag must be set when running in non-interactive mode.');
186
+ }
187
+ const { selectedPlatform } = await (0, prompts_1.promptAsync)({
188
+ type: 'select',
189
+ message: 'Select platform',
190
+ name: 'selectedPlatform',
191
+ choices: [
192
+ { title: 'Android', value: generated_1.AppPlatform.Android },
193
+ { title: 'iOS', value: generated_1.AppPlatform.Ios },
194
+ ],
195
+ });
196
+ return selectedPlatform;
197
+ }
174
198
  async function writeSimulatorEnvSafelyAsync(projectDir, environmentVariables) {
175
199
  try {
176
200
  await (0, env_1.writeSimulatorEnvAsync)(projectDir, environmentVariables);
@@ -16566,6 +16566,26 @@ export type AccountBillingPeriodQuery = {
16566
16566
  };
16567
16567
  };
16568
16568
  };
16569
+ export type SimulatorAvailabilityQueryVariables = Exact<{
16570
+ appId: Scalars['String']['input'];
16571
+ filter?: InputMaybe<Array<Scalars['String']['input']> | Scalars['String']['input']>;
16572
+ }>;
16573
+ export type SimulatorAvailabilityQuery = {
16574
+ __typename?: 'RootQuery';
16575
+ app: {
16576
+ __typename?: 'AppQuery';
16577
+ byId: {
16578
+ __typename?: 'App';
16579
+ id: string;
16580
+ ownerAccount: {
16581
+ __typename?: 'Account';
16582
+ id: string;
16583
+ name: string;
16584
+ accountFeatureGates: any;
16585
+ };
16586
+ };
16587
+ };
16588
+ };
16569
16589
  export type AppByIdQueryVariables = Exact<{
16570
16590
  appId: Scalars['String']['input'];
16571
16591
  }>;
@@ -6,7 +6,9 @@ const graphql_1 = require("graphql");
6
6
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
7
  const client_1 = require("../client");
8
8
  const Update_1 = require("../types/Update");
9
- const turtleJobRunId = process.env.EAS_BUILD_ID;
9
+ function getTurtleJobRunId() {
10
+ return process.env.EAS_BUILD_PLATFORM ? undefined : process.env.EAS_BUILD_ID;
11
+ }
10
12
  exports.PublishMutation = {
11
13
  async getUploadURLsAsync(graphqlClient, contentTypes) {
12
14
  const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
@@ -25,6 +27,7 @@ exports.PublishMutation = {
25
27
  return data.asset.getSignedAssetUploadSpecifications;
26
28
  },
27
29
  async publishUpdateGroupAsync(graphqlClient, publishUpdateGroupsInput) {
30
+ const turtleJobRunId = getTurtleJobRunId();
28
31
  const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
29
32
  .mutation((0, graphql_tag_1.default) `
30
33
  mutation UpdatePublishMutation($publishUpdateGroupsInput: [PublishUpdateGroupInput!]!) {
@@ -0,0 +1,7 @@
1
+ import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
2
+ export declare const DeviceRunSessionAvailabilityQuery: {
3
+ byAppIdAsync(graphqlClient: ExpoGraphqlClient, appId: string): Promise<{
4
+ accountName: string;
5
+ available: boolean;
6
+ }>;
7
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceRunSessionAvailabilityQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
6
+ const client_1 = require("../client");
7
+ const DEVICE_RUN_SESSIONS_GATE = 'device-run-sessions';
8
+ exports.DeviceRunSessionAvailabilityQuery = {
9
+ async byAppIdAsync(graphqlClient, appId) {
10
+ const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
11
+ .query((0, graphql_tag_1.default) `
12
+ query SimulatorAvailabilityQuery($appId: String!, $filter: [String!]) {
13
+ app {
14
+ byId(appId: $appId) {
15
+ id
16
+ ownerAccount {
17
+ id
18
+ name
19
+ accountFeatureGates(filter: $filter)
20
+ }
21
+ }
22
+ }
23
+ }
24
+ `, { appId, filter: [DEVICE_RUN_SESSIONS_GATE] }, { additionalTypenames: ['Account'] })
25
+ .toPromise());
26
+ const ownerAccount = data.app.byId.ownerAccount;
27
+ const gates = ownerAccount.accountFeatureGates;
28
+ return {
29
+ accountName: ownerAccount.name,
30
+ available: gates[DEVICE_RUN_SESSIONS_GATE] === true,
31
+ };
32
+ },
33
+ };