eas-cli 18.13.0 → 19.0.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.
@@ -5,6 +5,7 @@ exports.getReactNativeVersionAsync = getReactNativeVersionAsync;
5
5
  exports.truncateGitCommitMessage = truncateGitCommitMessage;
6
6
  const tslib_1 = require("tslib");
7
7
  const eas_build_job_1 = require("@expo/eas-build-job");
8
+ const results_1 = require("@expo/results");
8
9
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
9
10
  const resolve_from_1 = tslib_1.__importDefault(require("resolve-from"));
10
11
  const version_1 = require("./android/version");
@@ -20,6 +21,14 @@ const User_1 = require("../user/User");
20
21
  async function collectMetadataAsync(ctx, runtimeAndFingerprintMetadata) {
21
22
  const channelObject = await resolveChannelAsync(ctx);
22
23
  const distribution = ctx.buildProfile.distribution ?? types_1.BuildDistributionType.STORE;
24
+ const expoPackageVersionResult = await (0, results_1.asyncResult)((0, eas_build_job_1.getInstalledExpoPackageVersionAsync)({
25
+ env: process.env,
26
+ projectDir: ctx.projectDir,
27
+ }));
28
+ if (!expoPackageVersionResult.ok) {
29
+ log_1.default.debug('Failed to resolve expo package version:');
30
+ log_1.default.debug(expoPackageVersionResult.reason);
31
+ }
23
32
  const metadata = {
24
33
  trackingContext: ctx.analyticsEventProperties,
25
34
  ...(await maybeResolveVersionsAsync(ctx)),
@@ -30,6 +39,7 @@ async function collectMetadataAsync(ctx, runtimeAndFingerprintMetadata) {
30
39
  runtimeVersion: runtimeAndFingerprintMetadata?.runtimeVersion,
31
40
  fingerprintHash: runtimeAndFingerprintMetadata?.fingerprintHash,
32
41
  reactNativeVersion: await getReactNativeVersionAsync(ctx.projectDir),
42
+ expoPackageVersion: expoPackageVersionResult.value,
33
43
  ...channelObject,
34
44
  distribution,
35
45
  appName: ctx.exp.name,
@@ -12,6 +12,7 @@ const git_1 = require("../../onboarding/git");
12
12
  const installDependencies_1 = require("../../onboarding/installDependencies");
13
13
  const runCommand_1 = require("../../onboarding/runCommand");
14
14
  const ora_1 = require("../../ora");
15
+ const expoCli_1 = require("../../utils/expoCli");
15
16
  async function cloneTemplateAsync(targetProjectDir) {
16
17
  const githubUsername = 'expo';
17
18
  const githubRepositoryName = 'expo-template-default';
@@ -40,16 +41,8 @@ async function installProjectDependenciesAsync(projectDir, packageManager) {
40
41
  packageManager,
41
42
  });
42
43
  const dependencies = ['expo-updates', '@expo/metro-runtime'];
43
- for (const dependency of dependencies) {
44
- spinner.text = `Installing ${chalk_1.default.bold(dependency)}`;
45
- await (0, runCommand_1.runCommandAsync)({
46
- cwd: projectDir,
47
- command: 'npx',
48
- args: ['expo', 'install', dependency],
49
- showOutput: false,
50
- showSpinner: false,
51
- });
52
- }
44
+ spinner.text = `Installing ${dependencies.map(dep => chalk_1.default.bold(dep)).join(', ')}`;
45
+ await (0, expoCli_1.expoCommandAsync)(projectDir, ['install', ...dependencies], { silent: true });
53
46
  spinner.succeed(`Installed project dependencies`);
54
47
  }
55
48
  async function initializeGitRepositoryAsync(projectDir) {
@@ -13,14 +13,15 @@ class AccountLogin extends EasCommand_1.default {
13
13
  static flags = {
14
14
  // can pass either --sso or -s
15
15
  sso: core_1.Flags.boolean({
16
- description: 'Login with SSO',
16
+ description: 'Log in with SSO',
17
17
  char: 's',
18
18
  default: false,
19
19
  }),
20
20
  browser: core_1.Flags.boolean({
21
- description: 'Login with your browser',
21
+ description: 'Log in with your browser (default; use --no-browser for CLI-based login)',
22
22
  char: 'b',
23
- default: false,
23
+ default: true,
24
+ allowNo: true,
24
25
  }),
25
26
  };
26
27
  static contextDefinition = {
@@ -7,6 +7,7 @@ export default class ObserveRoutes extends EasCommand {
7
7
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
8
  'project-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
9
  'build-number': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ 'route-name': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
11
  'update-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
12
  'app-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
13
  start: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -44,6 +44,10 @@ class ObserveRoutes extends EasCommand_1.default {
44
44
  'build-number': core_1.Flags.string({
45
45
  description: 'Filter by app build number',
46
46
  }),
47
+ 'route-name': core_1.Flags.string({
48
+ description: 'Filter by route name (can be specified multiple times to include several routes)',
49
+ multiple: true,
50
+ }),
47
51
  ...flags_2.ObserveProjectIdFlag,
48
52
  ...flags_1.EasNonInteractiveAndJsonFlags,
49
53
  };
@@ -75,6 +79,9 @@ class ObserveRoutes extends EasCommand_1.default {
75
79
  const argumentsStat = flags.stat?.length
76
80
  ? Array.from(new Set(flags.stat.map(formatNavigationRoutes_1.resolveNavigationStatKey)))
77
81
  : undefined;
82
+ const routeNames = flags['route-name']?.length
83
+ ? Array.from(new Set(flags['route-name']))
84
+ : undefined;
78
85
  const { daysBack, startTime, endTime } = (0, startAndEndTime_1.resolveTimeRange)(flags);
79
86
  const platforms = (0, platforms_1.appPlatformsFromFlag)(flags.platform);
80
87
  const { routes, pageInfoByPlatform } = await (0, fetchNavigationRoutes_1.fetchObserveNavigationRoutesAsync)(graphqlClient, projectId, {
@@ -86,6 +93,7 @@ class ObserveRoutes extends EasCommand_1.default {
86
93
  appVersion: flags['app-version'],
87
94
  updateId: flags['update-id'],
88
95
  buildNumber: flags['build-number'],
96
+ routeNames,
89
97
  });
90
98
  if (flags.json) {
91
99
  const stats = argumentsStat ?? DEFAULT_STATS_JSON;
@@ -24,6 +24,7 @@ const platform_1 = require("../../platform");
24
24
  const expoConfig_1 = require("../../project/expoConfig");
25
25
  const prompts_1 = require("../../prompts");
26
26
  const easCli_1 = require("../../utils/easCli");
27
+ const expoCli_1 = require("../../utils/expoCli");
27
28
  const git_2 = tslib_1.__importDefault(require("../../vcs/clients/git"));
28
29
  class Onboarding extends EasCommand_1.default {
29
30
  static aliases = ['init:onboarding', 'onboarding'];
@@ -146,23 +147,12 @@ class Onboarding extends EasCommand_1.default {
146
147
  actor,
147
148
  });
148
149
  if (!app.githubRepository) {
149
- await (0, runCommand_1.runCommandAsync)({
150
- cwd: finalTargetProjectDirectory,
151
- command: 'npx',
152
- args: ['expo', 'install', 'expo-updates'],
153
- });
154
- log_1.default.log();
155
- await (0, runCommand_1.runCommandAsync)({
156
- cwd: finalTargetProjectDirectory,
157
- command: 'npx',
158
- args: ['expo', 'install', 'expo-insights'],
159
- });
160
- log_1.default.log();
161
- await (0, runCommand_1.runCommandAsync)({
162
- cwd: finalTargetProjectDirectory,
163
- command: 'npx',
164
- args: ['expo', 'install', 'expo-dev-client'],
165
- });
150
+ await (0, expoCli_1.expoCommandAsync)(finalTargetProjectDirectory, [
151
+ 'install',
152
+ 'expo-updates',
153
+ 'expo-insights',
154
+ 'expo-dev-client',
155
+ ]);
166
156
  log_1.default.log();
167
157
  }
168
158
  await vcsClient.trackFileAsync('package-lock.json');
@@ -162,6 +162,7 @@ export type Account = {
162
162
  /** Billing information. Only visible to members with the ADMIN or OWNER role. */
163
163
  billing?: Maybe<Billing>;
164
164
  billingPeriod: BillingPeriod;
165
+ concurrencyConsumers: Array<ConcurrencyConsumer>;
165
166
  /** Convex team connections for this account */
166
167
  convexTeamConnections: Array<ConvexTeamConnection>;
167
168
  createdAt: Scalars['DateTime']['output'];
@@ -407,6 +408,13 @@ export type AccountAuditLogsPaginatedArgs = {
407
408
  export type AccountBillingPeriodArgs = {
408
409
  date: Scalars['DateTime']['input'];
409
410
  };
411
+ /**
412
+ * An account is a container owning projects, credentials, billing and other organization
413
+ * data and settings. Actors may own and be members of accounts.
414
+ */
415
+ export type AccountConcurrencyConsumersArgs = {
416
+ limit?: Scalars['Int']['input'];
417
+ };
410
418
  /**
411
419
  * An account is a container owning projects, credentials, billing and other organization
412
420
  * data and settings. Actors may own and be members of accounts.
@@ -1868,6 +1876,7 @@ export type AppObserveCustomEventNamesArgs = {
1868
1876
  appVersion?: InputMaybe<Scalars['String']['input']>;
1869
1877
  endTime: Scalars['DateTime']['input'];
1870
1878
  environment?: InputMaybe<Scalars['String']['input']>;
1879
+ isEmbeddedUpdate?: InputMaybe<Scalars['Boolean']['input']>;
1871
1880
  orderBy?: InputMaybe<AppObserveCustomEventNamesOrderBy>;
1872
1881
  platform?: InputMaybe<AppObservePlatform>;
1873
1882
  startTime: Scalars['DateTime']['input'];
@@ -1899,10 +1908,22 @@ export type AppObserveTimeSeriesArgs = {
1899
1908
  export type AppObserveUpdatesArgs = {
1900
1909
  input: AppObserveUpdatesInput;
1901
1910
  };
1911
+ export type AppObserveAppBuildEmbeddedSummary = {
1912
+ __typename?: 'AppObserveAppBuildEmbeddedSummary';
1913
+ eventCount: Scalars['Int']['output'];
1914
+ firstSeenAt: Scalars['DateTime']['output'];
1915
+ uniqueUserCount: Scalars['Int']['output'];
1916
+ };
1902
1917
  export type AppObserveAppBuildNumber = {
1903
1918
  __typename?: 'AppObserveAppBuildNumber';
1904
1919
  appBuildNumber: Scalars['String']['output'];
1905
1920
  easBuilds: Array<AppObserveAppEasBuild>;
1921
+ /**
1922
+ * Summary restricted to events running this build's embedded bundle
1923
+ * (no OTA update applied). Null when the build has no such events
1924
+ * in the queried time range.
1925
+ */
1926
+ embedded?: Maybe<AppObserveAppBuildEmbeddedSummary>;
1906
1927
  eventCount: Scalars['Int']['output'];
1907
1928
  firstSeenAt: Scalars['DateTime']['output'];
1908
1929
  uniqueUserCount: Scalars['Int']['output'];
@@ -1917,6 +1938,7 @@ export type AppObserveAppEasBuild = {
1917
1938
  export type AppObserveAppUpdate = {
1918
1939
  __typename?: 'AppObserveAppUpdate';
1919
1940
  appUpdateId: Scalars['String']['output'];
1941
+ appUpdateMessage?: Maybe<Scalars['String']['output']>;
1920
1942
  easBuilds: Array<AppObserveAppEasBuild>;
1921
1943
  eventCount: Scalars['Int']['output'];
1922
1944
  firstSeenAt: Scalars['DateTime']['output'];
@@ -1944,6 +1966,7 @@ export type AppObserveCustomEvent = {
1944
1966
  appEasBuildId?: Maybe<Scalars['String']['output']>;
1945
1967
  appIdentifier: Scalars['String']['output'];
1946
1968
  appUpdateId?: Maybe<Scalars['String']['output']>;
1969
+ appUpdateMessage?: Maybe<Scalars['String']['output']>;
1947
1970
  appVersion: Scalars['String']['output'];
1948
1971
  clientVersion?: Maybe<Scalars['String']['output']>;
1949
1972
  countryCode?: Maybe<Scalars['String']['output']>;
@@ -1982,6 +2005,7 @@ export type AppObserveCustomEventCountsInput = {
1982
2005
  endTime: Scalars['DateTime']['input'];
1983
2006
  environment?: InputMaybe<Scalars['String']['input']>;
1984
2007
  eventName: Scalars['String']['input'];
2008
+ isEmbeddedUpdate?: InputMaybe<Scalars['Boolean']['input']>;
1985
2009
  platform: AppObservePlatform;
1986
2010
  startTime: Scalars['DateTime']['input'];
1987
2011
  };
@@ -2004,6 +2028,7 @@ export type AppObserveCustomEventListFilter = {
2004
2028
  endTime?: InputMaybe<Scalars['DateTime']['input']>;
2005
2029
  environment?: InputMaybe<Scalars['String']['input']>;
2006
2030
  eventName?: InputMaybe<Scalars['String']['input']>;
2031
+ isEmbeddedUpdate?: InputMaybe<Scalars['Boolean']['input']>;
2007
2032
  platform?: InputMaybe<AppObservePlatform>;
2008
2033
  propertyFilters?: InputMaybe<Array<AppObserveCustomEventPropertyFilter>>;
2009
2034
  sessionId?: InputMaybe<Scalars['String']['input']>;
@@ -2041,6 +2066,7 @@ export type AppObserveEvent = {
2041
2066
  appIdentifier: Scalars['String']['output'];
2042
2067
  appName: Scalars['String']['output'];
2043
2068
  appUpdateId?: Maybe<Scalars['String']['output']>;
2069
+ appUpdateMessage?: Maybe<Scalars['String']['output']>;
2044
2070
  appVersion: Scalars['String']['output'];
2045
2071
  clientVersion?: Maybe<Scalars['String']['output']>;
2046
2072
  countryCode?: Maybe<Scalars['String']['output']>;
@@ -2091,6 +2117,7 @@ export type AppObserveEventsFilter = {
2091
2117
  easClientId?: InputMaybe<Scalars['String']['input']>;
2092
2118
  endTime?: InputMaybe<Scalars['DateTime']['input']>;
2093
2119
  environment?: InputMaybe<Scalars['String']['input']>;
2120
+ isEmbeddedUpdate?: InputMaybe<Scalars['Boolean']['input']>;
2094
2121
  metricName?: InputMaybe<Scalars['String']['input']>;
2095
2122
  platform?: InputMaybe<AppObservePlatform>;
2096
2123
  routeName?: InputMaybe<Scalars['String']['input']>;
@@ -2140,6 +2167,7 @@ export type AppObserveNavigationRoutesFilter = {
2140
2167
  endTime: Scalars['DateTime']['input'];
2141
2168
  environment?: InputMaybe<Scalars['String']['input']>;
2142
2169
  platform: AppObservePlatform;
2170
+ routeNames?: InputMaybe<Array<Scalars['String']['input']>>;
2143
2171
  startTime: Scalars['DateTime']['input'];
2144
2172
  };
2145
2173
  export type AppObserveNavigationRoutesOrderBy = {
@@ -2208,6 +2236,7 @@ export type AppObserveTimeSeriesInput = {
2208
2236
  bucketIntervalMinutes?: InputMaybe<Scalars['Int']['input']>;
2209
2237
  endTime: Scalars['DateTime']['input'];
2210
2238
  environment?: InputMaybe<Scalars['String']['input']>;
2239
+ isEmbeddedUpdate?: InputMaybe<Scalars['Boolean']['input']>;
2211
2240
  metricName: Scalars['String']['input'];
2212
2241
  platform: AppObservePlatform;
2213
2242
  routeName?: InputMaybe<Scalars['String']['input']>;
@@ -2227,6 +2256,7 @@ export type AppObserveTimeSeriesStatistics = {
2227
2256
  export type AppObserveUpdate = {
2228
2257
  __typename?: 'AppObserveUpdate';
2229
2258
  appUpdateId: Scalars['String']['output'];
2259
+ appUpdateMessage?: Maybe<Scalars['String']['output']>;
2230
2260
  appVersion: Scalars['String']['output'];
2231
2261
  downloadCount: Scalars['Int']['output'];
2232
2262
  firstSeenAt: Scalars['DateTime']['output'];
@@ -3566,6 +3596,7 @@ export declare enum BuildPhase {
3566
3596
  OnBuildErrorHook = "ON_BUILD_ERROR_HOOK",
3567
3597
  OnBuildSuccessHook = "ON_BUILD_SUCCESS_HOOK",
3568
3598
  ParseCustomWorkflowConfig = "PARSE_CUSTOM_WORKFLOW_CONFIG",
3599
+ ParseXcactivitylog = "PARSE_XCACTIVITYLOG",
3569
3600
  PostInstallHook = "POST_INSTALL_HOOK",
3570
3601
  Prebuild = "PREBUILD",
3571
3602
  PrepareArtifacts = "PREPARE_ARTIFACTS",
@@ -3758,6 +3789,7 @@ export type Concurrencies = {
3758
3789
  ios: Scalars['Int']['output'];
3759
3790
  total: Scalars['Int']['output'];
3760
3791
  };
3792
+ export type ConcurrencyConsumer = Build | JobRun;
3761
3793
  export declare enum ContinentCode {
3762
3794
  Af = "AF",
3763
3795
  An = "AN",
@@ -5075,6 +5107,28 @@ export type EditUpdateBranchInput = {
5075
5107
  name?: InputMaybe<Scalars['String']['input']>;
5076
5108
  newName: Scalars['String']['input'];
5077
5109
  };
5110
+ export type EmbeddedUpdateAssetMutation = {
5111
+ __typename?: 'EmbeddedUpdateAssetMutation';
5112
+ /**
5113
+ * Returns a presigned POST URL for uploading an embedded update bundle.
5114
+ * Requires PUBLISH permission on the app.
5115
+ */
5116
+ getSignedEmbeddedUpdateAssetUploadSpecifications: EmbeddedUpdateAssetUploadSpec;
5117
+ };
5118
+ export type EmbeddedUpdateAssetMutationGetSignedEmbeddedUpdateAssetUploadSpecificationsArgs = {
5119
+ appId: Scalars['ID']['input'];
5120
+ contentType: Scalars['String']['input'];
5121
+ embeddedUpdateId: Scalars['ID']['input'];
5122
+ };
5123
+ export type EmbeddedUpdateAssetUploadSpec = {
5124
+ __typename?: 'EmbeddedUpdateAssetUploadSpec';
5125
+ /** Form fields that must be included with the POST request alongside the file. */
5126
+ fields: Scalars['JSONObject']['output'];
5127
+ /** Presigned POST URL targeting the upload bucket. Valid for one hour. */
5128
+ presignedUrl: Scalars['String']['output'];
5129
+ /** Storage key (`{appId}/{embeddedUpdateId}`). Same key in both upload and destination buckets. */
5130
+ storageKey: Scalars['String']['output'];
5131
+ };
5078
5132
  export declare enum EntityTypeName {
5079
5133
  AccountEntity = "AccountEntity",
5080
5134
  AccountSsoConfigurationEntity = "AccountSSOConfigurationEntity",
@@ -6134,6 +6188,8 @@ export type JobRun = {
6134
6188
  logFileUrls: Array<Scalars['String']['output']>;
6135
6189
  name: Scalars['String']['output'];
6136
6190
  priority: JobRunPriority;
6191
+ /** String describing the worker profile used to run this job run. */
6192
+ resourceClassDisplayName: Scalars['String']['output'];
6137
6193
  startedAt?: Maybe<Scalars['DateTime']['output']>;
6138
6194
  status: JobRunStatus;
6139
6195
  updateGroups: Array<Array<Update>>;
@@ -6870,6 +6926,7 @@ export type RootMutation = {
6870
6926
  echoTurn: EchoTurnMutation;
6871
6927
  /** Mutations for Echo versions */
6872
6928
  echoVersion: EchoVersionMutation;
6929
+ embeddedUpdateAsset: EmbeddedUpdateAssetMutation;
6873
6930
  /** Mutations that create and delete EnvironmentSecrets */
6874
6931
  environmentSecret: EnvironmentSecretMutation;
6875
6932
  /** Mutations that create and delete EnvironmentVariables */
@@ -287,6 +287,7 @@ var BuildPhase;
287
287
  BuildPhase["OnBuildErrorHook"] = "ON_BUILD_ERROR_HOOK";
288
288
  BuildPhase["OnBuildSuccessHook"] = "ON_BUILD_SUCCESS_HOOK";
289
289
  BuildPhase["ParseCustomWorkflowConfig"] = "PARSE_CUSTOM_WORKFLOW_CONFIG";
290
+ BuildPhase["ParseXcactivitylog"] = "PARSE_XCACTIVITYLOG";
290
291
  BuildPhase["PostInstallHook"] = "POST_INSTALL_HOOK";
291
292
  BuildPhase["Prebuild"] = "PREBUILD";
292
293
  BuildPhase["PrepareArtifacts"] = "PREPARE_ARTIFACTS";
package/build/log.js CHANGED
@@ -4,12 +4,12 @@ exports.link = link;
4
4
  exports.learnMore = learnMore;
5
5
  const tslib_1 = require("tslib");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const debug_1 = tslib_1.__importDefault(require("debug"));
7
8
  const figures_1 = tslib_1.__importDefault(require("figures"));
8
9
  const getenv_1 = require("getenv");
9
10
  const log_symbols_1 = tslib_1.__importDefault(require("log-symbols"));
10
11
  const terminal_link_1 = tslib_1.__importDefault(require("terminal-link"));
11
- // eslint-disable-next-line eslint-import/no-extraneous-dependencies
12
- const nodeDebug = require('debug')('eas:log:debug');
12
+ const nodeDebug = (0, debug_1.default)('eas:log:debug');
13
13
  class Log {
14
14
  static isDebug = (0, getenv_1.boolish)('EXPO_DEBUG', false);
15
15
  static log(...args) {
@@ -43,7 +43,8 @@ class Log {
43
43
  }
44
44
  else {
45
45
  Log.updateIsLastLineNewLine(args);
46
- nodeDebug(...args);
46
+ const [first, ...rest] = args;
47
+ nodeDebug(first, ...rest);
47
48
  }
48
49
  }
49
50
  static gray(...args) {
@@ -13,6 +13,7 @@ export interface FetchNavigationRoutesOptions {
13
13
  appVersion?: string;
14
14
  updateId?: string;
15
15
  buildNumber?: string;
16
+ routeNames?: string[];
16
17
  orderBy?: AppObserveNavigationRoutesOrderBy;
17
18
  }
18
19
  export interface FetchNavigationRoutesResult {
@@ -23,6 +23,7 @@ async function fetchObserveNavigationRoutesAsync(graphqlClient, appId, options)
23
23
  ...(options.appVersion && { appVersion: options.appVersion }),
24
24
  ...(options.updateId && { appUpdateId: options.updateId }),
25
25
  ...(options.buildNumber && { appBuildNumber: options.buildNumber }),
26
+ ...(options.routeNames?.length && { routeNames: options.routeNames }),
26
27
  },
27
28
  first: options.limit,
28
29
  ...(options.after && { after: options.after }),
@@ -7,12 +7,11 @@ exports.isUsingStaticExpoConfig = isUsingStaticExpoConfig;
7
7
  exports.getPublicExpoConfigAsync = getPublicExpoConfigAsync;
8
8
  const tslib_1 = require("tslib");
9
9
  const config_1 = require("@expo/config");
10
- const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
11
10
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
11
  const joi_1 = tslib_1.__importDefault(require("joi"));
13
12
  const path_1 = tslib_1.__importDefault(require("path"));
14
13
  const projectUtils_1 = require("./projectUtils");
15
- const log_1 = tslib_1.__importDefault(require("../log"));
14
+ const expoCli_1 = require("../utils/expoCli");
16
15
  async function createOrModifyExpoConfigAsync(projectDir, exp, readOptions) {
17
16
  ensureExpoConfigExists(projectDir);
18
17
  if (readOptions) {
@@ -22,7 +21,6 @@ async function createOrModifyExpoConfigAsync(projectDir, exp, readOptions) {
22
21
  return await (0, config_1.modifyConfigAsync)(projectDir, exp);
23
22
  }
24
23
  }
25
- let wasExpoConfigWarnPrinted = false;
26
24
  async function getExpoConfigInternalAsync(projectDir, opts = {}) {
27
25
  const originalProcessEnv = process.env;
28
26
  try {
@@ -32,29 +30,12 @@ async function getExpoConfigInternalAsync(projectDir, opts = {}) {
32
30
  };
33
31
  let exp;
34
32
  if ((0, projectUtils_1.isExpoInstalled)(projectDir)) {
35
- try {
36
- const { stdout } = await (0, spawn_async_1.default)('npx', ['expo', 'config', '--json', ...(opts.isPublicConfig ? ['--type', 'public'] : [])], {
37
- cwd: projectDir,
38
- env: {
39
- ...process.env,
40
- ...opts.env,
41
- EXPO_NO_DOTENV: '1',
42
- },
43
- });
44
- exp = JSON.parse(stdout);
45
- }
46
- catch (err) {
47
- if (!wasExpoConfigWarnPrinted) {
48
- log_1.default.warn(`Failed to read the app config from the project using "npx expo config" command: ${err.message}.`);
49
- log_1.default.warn('Falling back to the version of "@expo/config" shipped with the EAS CLI.');
50
- wasExpoConfigWarnPrinted = true;
51
- }
52
- exp = (0, config_1.getConfig)(projectDir, {
53
- skipSDKVersionRequirement: true,
54
- ...(opts.isPublicConfig ? { isPublicConfig: true } : {}),
55
- ...(opts.skipPlugins ? { skipPlugins: true } : {}),
56
- }).exp;
57
- }
33
+ const { stdout } = await (0, expoCli_1.spawnExpoCommand)(projectDir, ['config', '--json', ...(opts.isPublicConfig ? ['--type', 'public'] : [])], {
34
+ env: {
35
+ EXPO_NO_DOTENV: '1',
36
+ },
37
+ });
38
+ exp = JSON.parse(stdout);
58
39
  }
59
40
  else {
60
41
  exp = (0, config_1.getConfig)(projectDir, {
@@ -1,9 +1,8 @@
1
1
  import { JSONObject } from '@expo/json-file';
2
- import { Client } from '../../vcs/vcs';
3
2
  interface Target {
4
3
  buildConfiguration?: string;
5
4
  targetName: string;
6
5
  }
7
- export declare function getManagedApplicationTargetEntitlementsAsync(projectDir: string, env: Record<string, string>, vcsClient: Client): Promise<JSONObject>;
6
+ export declare function getManagedApplicationTargetEntitlementsAsync(projectDir: string, env: Record<string, string>): Promise<JSONObject>;
8
7
  export declare function getNativeTargetEntitlementsAsync(projectDir: string, target: Target): Promise<JSONObject | null>;
9
8
  export {};
@@ -2,52 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getManagedApplicationTargetEntitlementsAsync = getManagedApplicationTargetEntitlementsAsync;
4
4
  exports.getNativeTargetEntitlementsAsync = getNativeTargetEntitlementsAsync;
5
- const tslib_1 = require("tslib");
6
5
  const config_plugins_1 = require("@expo/config-plugins");
7
- const prebuild_config_1 = require("@expo/prebuild-config");
8
- const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
9
- const log_1 = tslib_1.__importDefault(require("../../log"));
6
+ const expoCli_1 = require("../../utils/expoCli");
10
7
  const plist_1 = require("../../utils/plist");
11
- const workflow_1 = require("../workflow");
12
- let wasExpoConfigPluginsWarnPrinted = false;
13
- async function getManagedApplicationTargetEntitlementsAsync(projectDir, env, vcsClient) {
14
- const originalProcessEnv = process.env;
15
- try {
16
- process.env = {
17
- ...process.env,
18
- ...env,
19
- };
20
- let expWithMods;
21
- try {
22
- const { stdout } = await (0, spawn_async_1.default)('npx', ['expo', 'config', '--json', '--type', 'introspect'], {
23
- cwd: projectDir,
24
- env: {
25
- ...process.env,
26
- ...env,
27
- EXPO_NO_DOTENV: '1',
28
- },
29
- });
30
- expWithMods = JSON.parse(stdout);
31
- }
32
- catch (err) {
33
- if (!wasExpoConfigPluginsWarnPrinted) {
34
- log_1.default.warn(`Failed to read the app config from the project using "npx expo config" command: ${err.message}.`);
35
- log_1.default.warn('Falling back to the version of "@expo/config" shipped with the EAS CLI.');
36
- wasExpoConfigPluginsWarnPrinted = true;
37
- }
38
- const { exp } = await (0, prebuild_config_1.getPrebuildConfigAsync)(projectDir, { platforms: ['ios'] });
39
- expWithMods = await (0, config_plugins_1.compileModsAsync)(exp, {
40
- projectRoot: projectDir,
41
- platforms: ['ios'],
42
- introspect: true,
43
- ignoreExistingNativeFiles: await (0, workflow_1.hasIgnoredIosProjectAsync)(projectDir, vcsClient),
44
- });
45
- }
46
- return expWithMods.ios?.entitlements ?? {};
47
- }
48
- finally {
49
- process.env = originalProcessEnv;
50
- }
8
+ async function getManagedApplicationTargetEntitlementsAsync(projectDir, env) {
9
+ const { stdout } = await (0, expoCli_1.spawnExpoCommand)(projectDir, ['config', '--json', '--type', 'introspect'], {
10
+ env,
11
+ });
12
+ const expWithMods = JSON.parse(stdout);
13
+ return expWithMods.ios?.entitlements ?? {};
51
14
  }
52
15
  async function getNativeTargetEntitlementsAsync(projectDir, target) {
53
16
  const entitlementsPath = config_plugins_1.IOSConfig.Entitlements.getEntitlementsPath(projectDir, target);
@@ -29,7 +29,7 @@ async function resolveManagedProjectTargetsAsync({ exp, projectDir, xcodeBuildCo
29
29
  targetName: applicationTargetName,
30
30
  buildConfiguration,
31
31
  });
32
- const applicationTargetEntitlements = await (0, entitlements_1.getManagedApplicationTargetEntitlementsAsync)(projectDir, env ?? {}, vcsClient);
32
+ const applicationTargetEntitlements = await (0, entitlements_1.getManagedApplicationTargetEntitlementsAsync)(projectDir, env ?? {});
33
33
  const appExtensions = exp.extra?.eas?.build?.experimental?.ios?.appExtensions ?? [];
34
34
  const { error } = AppExtensionsConfigSchema.validate(appExtensions, {
35
35
  allowUnknown: false,
@@ -56,7 +56,25 @@ function isExpoNotificationsInstalled(projectDir) {
56
56
  }
57
57
  function isExpoInstalled(projectDir) {
58
58
  const packageJson = (0, config_1.getPackageJson)(projectDir);
59
- return !!(packageJson.dependencies && 'expo' in packageJson.dependencies);
59
+ if (!!(packageJson.dependencies && 'expo' in packageJson.dependencies)) {
60
+ // NOTE(@kitten): We usually don't apply strict checks for installed packages, but
61
+ // `isExpoInstalled` is often used to check if we should call the Expo CLI, so we're
62
+ // also checking if we can resolve `expo` here
63
+ try {
64
+ return !!(0, expoCli_1.resolveExpoCli)(projectDir);
65
+ }
66
+ catch (e) {
67
+ if (e.code === 'MODULE_NOT_FOUND') {
68
+ return false;
69
+ }
70
+ else {
71
+ throw e;
72
+ }
73
+ }
74
+ }
75
+ else {
76
+ return false;
77
+ }
60
78
  }
61
79
  function isExpoUpdatesInstalledAsDevDependency(projectDir) {
62
80
  const packageJson = (0, config_1.getPackageJson)(projectDir);
@@ -1,4 +1,6 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
+ import spawnAsync from '@expo/spawn-async';
3
+ import type { CommonSpawnOptions } from 'node:child_process';
2
4
  /**
3
5
  * @returns `true` if the project is SDK +46, has `@expo/cli`, and `EXPO_USE_LOCAL_CLI` is not set to a _false_ value.
4
6
  */
@@ -11,6 +13,8 @@ export declare function shouldUseVersionedExpoCLIExpensive(projectDir: string, e
11
13
  export declare function shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive(projectDir: string): boolean;
12
14
  export declare const shouldUseVersionedExpoCLI: typeof shouldUseVersionedExpoCLIExpensive;
13
15
  export declare const shouldUseVersionedExpoCLIWithExplicitPlatforms: typeof shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive;
16
+ export declare function resolveExpoCli(projectDir: string): string;
17
+ export declare function spawnExpoCommand(projectDir: string, args: string[], opts?: CommonSpawnOptions): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
14
18
  export declare function expoCommandAsync(projectDir: string, args: string[], { silent, extraEnv, }?: {
15
19
  silent?: boolean;
16
20
  extraEnv?: Record<string, string | undefined>;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shouldUseVersionedExpoCLIWithExplicitPlatforms = exports.shouldUseVersionedExpoCLI = void 0;
4
4
  exports.shouldUseVersionedExpoCLIExpensive = shouldUseVersionedExpoCLIExpensive;
5
5
  exports.shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive = shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive;
6
+ exports.resolveExpoCli = resolveExpoCli;
7
+ exports.spawnExpoCommand = spawnExpoCommand;
6
8
  exports.expoCommandAsync = expoCommandAsync;
7
9
  const tslib_1 = require("tslib");
8
10
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
@@ -66,11 +68,13 @@ function shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive(projectDir) {
66
68
  }
67
69
  exports.shouldUseVersionedExpoCLI = (0, memoize_1.memoize)(shouldUseVersionedExpoCLIExpensive);
68
70
  exports.shouldUseVersionedExpoCLIWithExplicitPlatforms = (0, memoize_1.memoize)(shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive);
69
- async function expoCommandAsync(projectDir, args, { silent = false, extraEnv = {}, } = {}) {
71
+ function resolveExpoCli(projectDir) {
72
+ return ((0, resolve_from_1.silent)(projectDir, 'expo/bin/cli') ?? (0, resolve_from_1.default)(projectDir, 'expo/bin/cli.js'));
73
+ }
74
+ function spawnExpoCommand(projectDir, args, opts) {
70
75
  let expoCliPath;
71
76
  try {
72
- expoCliPath =
73
- (0, resolve_from_1.silent)(projectDir, 'expo/bin/cli') ?? (0, resolve_from_1.default)(projectDir, 'expo/bin/cli.js');
77
+ expoCliPath = resolveExpoCli(projectDir);
74
78
  }
75
79
  catch (e) {
76
80
  if (e.code === 'MODULE_NOT_FOUND') {
@@ -79,23 +83,30 @@ async function expoCommandAsync(projectDir, args, { silent = false, extraEnv = {
79
83
  throw e;
80
84
  }
81
85
  const spawnPromise = (0, spawn_async_1.default)(expoCliPath, args, {
82
- stdio: ['inherit', 'pipe', 'pipe'], // inherit stdin so user can install a missing expo-cli from inside this command
86
+ cwd: projectDir,
87
+ ...opts,
83
88
  env: {
84
89
  ...process.env,
85
- ...extraEnv,
90
+ ...opts?.env,
86
91
  },
87
92
  });
88
- const { child: { stdout, stderr }, } = spawnPromise;
89
- if (!(stdout && stderr)) {
93
+ if (!spawnPromise.child.stdout && !spawnPromise.child.stderr) {
90
94
  throw new Error('Failed to spawn expo-cli');
91
95
  }
96
+ return spawnPromise;
97
+ }
98
+ async function expoCommandAsync(projectDir, args, { silent = false, extraEnv = {}, } = {}) {
99
+ const spawnPromise = spawnExpoCommand(projectDir, args, {
100
+ stdio: ['inherit', 'pipe', 'pipe'], // inherit stdin so user can install a missing expo-cli from inside this command
101
+ env: extraEnv,
102
+ });
92
103
  if (!silent) {
93
- stdout.on('data', data => {
104
+ spawnPromise.child.stdout?.on('data', data => {
94
105
  for (const line of data.toString().trim().split('\n')) {
95
106
  log_1.default.log(`${chalk_1.default.gray('[expo-cli]')} ${line}`);
96
107
  }
97
108
  });
98
- stderr.on('data', data => {
109
+ spawnPromise.child.stderr?.on('data', data => {
99
110
  for (const line of data.toString().trim().split('\n')) {
100
111
  log_1.default.warn(`${chalk_1.default.gray('[expo-cli]')} ${line}`);
101
112
  }