eas-cli 18.13.0 → 18.13.1

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) {
@@ -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');
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) {
@@ -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,
@@ -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,7 @@ 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 spawnExpoCommand(projectDir: string, args: string[], opts?: CommonSpawnOptions): spawnAsync.SpawnPromise<spawnAsync.SpawnResult>;
14
17
  export declare function expoCommandAsync(projectDir: string, args: string[], { silent, extraEnv, }?: {
15
18
  silent?: boolean;
16
19
  extraEnv?: Record<string, string | undefined>;
@@ -3,6 +3,7 @@ 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.spawnExpoCommand = spawnExpoCommand;
6
7
  exports.expoCommandAsync = expoCommandAsync;
7
8
  const tslib_1 = require("tslib");
8
9
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
@@ -66,7 +67,7 @@ function shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive(projectDir) {
66
67
  }
67
68
  exports.shouldUseVersionedExpoCLI = (0, memoize_1.memoize)(shouldUseVersionedExpoCLIExpensive);
68
69
  exports.shouldUseVersionedExpoCLIWithExplicitPlatforms = (0, memoize_1.memoize)(shouldUseVersionedExpoCLIWithExplicitPlatformsExpensive);
69
- async function expoCommandAsync(projectDir, args, { silent = false, extraEnv = {}, } = {}) {
70
+ function spawnExpoCommand(projectDir, args, opts) {
70
71
  let expoCliPath;
71
72
  try {
72
73
  expoCliPath =
@@ -79,23 +80,30 @@ async function expoCommandAsync(projectDir, args, { silent = false, extraEnv = {
79
80
  throw e;
80
81
  }
81
82
  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
83
+ cwd: projectDir,
84
+ ...opts,
83
85
  env: {
84
86
  ...process.env,
85
- ...extraEnv,
87
+ ...opts?.env,
86
88
  },
87
89
  });
88
- const { child: { stdout, stderr }, } = spawnPromise;
89
- if (!(stdout && stderr)) {
90
+ if (!spawnPromise.child.stdout && !spawnPromise.child.stderr) {
90
91
  throw new Error('Failed to spawn expo-cli');
91
92
  }
93
+ return spawnPromise;
94
+ }
95
+ async function expoCommandAsync(projectDir, args, { silent = false, extraEnv = {}, } = {}) {
96
+ const spawnPromise = spawnExpoCommand(projectDir, args, {
97
+ stdio: ['inherit', 'pipe', 'pipe'], // inherit stdin so user can install a missing expo-cli from inside this command
98
+ env: extraEnv,
99
+ });
92
100
  if (!silent) {
93
- stdout.on('data', data => {
101
+ spawnPromise.child.stdout?.on('data', data => {
94
102
  for (const line of data.toString().trim().split('\n')) {
95
103
  log_1.default.log(`${chalk_1.default.gray('[expo-cli]')} ${line}`);
96
104
  }
97
105
  });
98
- stderr.on('data', data => {
106
+ spawnPromise.child.stderr?.on('data', data => {
99
107
  for (const line of data.toString().trim().split('\n')) {
100
108
  log_1.default.warn(`${chalk_1.default.gray('[expo-cli]')} ${line}`);
101
109
  }