eoas 2.3.13-alpha.4 → 2.3.14

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.
@@ -10,6 +10,7 @@ export default class Publish extends Command {
10
10
  branch: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
11
  nonInteractive: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  outputDir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ packageRunner: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
14
  };
14
15
  private sanitizeFlags;
15
16
  run(): Promise<void>;
@@ -15,6 +15,7 @@ const fetch_1 = require("../lib/fetch");
15
15
  const log_1 = tslib_1.__importDefault(require("../lib/log"));
16
16
  const ora_1 = require("../lib/ora");
17
17
  const package_1 = require("../lib/package");
18
+ const packageRunner_1 = require("../lib/packageRunner");
18
19
  const prompts_1 = require("../lib/prompts");
19
20
  const repo_1 = require("../lib/repo");
20
21
  const runtimeVersion_1 = require("../lib/runtimeVersion");
@@ -55,6 +56,10 @@ class Publish extends core_1.Command {
55
56
  description: "Where to write build output. You can override the default dist output directory if it's being used by something else",
56
57
  default: 'dist',
57
58
  }),
59
+ packageRunner: core_1.Flags.string({
60
+ description: 'Package runner to use for spawning Expo CLI commands (e.g. npx, bunx, pnpx). Can also be set via EOAS_PACKAGE_RUNNER env var. Defaults to npx.',
61
+ required: false,
62
+ }),
58
63
  };
59
64
  sanitizeFlags(flags) {
60
65
  return {
@@ -63,6 +68,7 @@ class Publish extends core_1.Command {
63
68
  branch: flags.branch,
64
69
  nonInteractive: flags.nonInteractive,
65
70
  outputDir: flags.outputDir,
71
+ packageRunner: (0, packageRunner_1.resolvePackageRunner)(flags.packageRunner, process.cwd()),
66
72
  providedDeprecatedChannel: flags.channel,
67
73
  };
68
74
  }
@@ -73,7 +79,7 @@ class Publish extends core_1.Command {
73
79
  process.exit(1);
74
80
  }
75
81
  const { flags } = await this.parse(Publish);
76
- const { platform, nonInteractive, branch, outputDir, providedDeprecatedChannel, disableRepositoryCheck, } = this.sanitizeFlags(flags);
82
+ const { platform, nonInteractive, branch, outputDir, packageRunner, providedDeprecatedChannel, disableRepositoryCheck, } = this.sanitizeFlags(flags);
77
83
  if (!branch) {
78
84
  log_1.default.error('Branch name is required');
79
85
  process.exit(1);
@@ -93,6 +99,7 @@ class Publish extends core_1.Command {
93
99
  ...process.env,
94
100
  ...(providedDeprecatedChannel ? { RELEASE_CHANNEL: providedDeprecatedChannel } : {}),
95
101
  },
102
+ packageRunner,
96
103
  });
97
104
  const serverUrl = await (0, expoConfig_1.resolveServerUrl)(config).catch(e => {
98
105
  log_1.default.error(e.message);
@@ -170,7 +177,7 @@ class Publish extends core_1.Command {
170
177
  const exportSpinner = (0, ora_1.ora)('📦 Exporting project files...').start();
171
178
  try {
172
179
  const specifiedPlatform = platform === expoConfig_1.RequestedPlatform.All ? [] : ['--platform', platform];
173
- const { stdout } = await (0, spawn_async_1.default)('npx', ['expo', 'export', '--output-dir', outputDir, ...specifiedPlatform], {
180
+ const { stdout } = await (0, spawn_async_1.default)(packageRunner, ['expo', 'export', '--output-dir', outputDir, ...specifiedPlatform], {
174
181
  cwd: projectDir,
175
182
  env: {
176
183
  ...process.env,
@@ -186,6 +193,7 @@ class Publish extends core_1.Command {
186
193
  }
187
194
  const publicConfig = await (0, expoConfig_1.getPublicExpoConfigAsync)(projectDir, {
188
195
  skipSDKVersionRequirement: true,
196
+ packageRunner,
189
197
  });
190
198
  if (!publicConfig) {
191
199
  log_1.default.error('Could not find Expo config in this project. Please make sure you have an Expo config.');
@@ -14,6 +14,7 @@ export interface ExpoConfigOptions {
14
14
  env?: Env;
15
15
  skipSDKVersionRequirement?: boolean;
16
16
  skipPlugins?: boolean;
17
+ packageRunner?: string;
17
18
  }
18
19
  export declare function getPrivateExpoConfigAsync(projectDir: string, opts?: ExpoConfigOptions): Promise<ExpoConfig>;
19
20
  export declare function ensureExpoConfigExists(projectDir: string): void;
@@ -11,6 +11,7 @@ const jscodeshift_1 = tslib_1.__importDefault(require("jscodeshift"));
11
11
  const path_1 = tslib_1.__importDefault(require("path"));
12
12
  const log_1 = tslib_1.__importDefault(require("./log"));
13
13
  const package_1 = require("./package");
14
+ const packageRunner_1 = require("./packageRunner");
14
15
  var RequestedPlatform;
15
16
  (function (RequestedPlatform) {
16
17
  RequestedPlatform["Android"] = "android";
@@ -27,8 +28,9 @@ async function getExpoConfigInternalAsync(projectDir, opts = {}) {
27
28
  };
28
29
  let exp;
29
30
  if ((0, package_1.isExpoInstalled)(projectDir)) {
31
+ const runner = (0, packageRunner_1.resolvePackageRunner)(opts.packageRunner, projectDir);
30
32
  try {
31
- const { stdout } = await (0, spawn_async_1.default)('npx', ['expo', 'config', '--json', ...(opts.isPublicConfig ? ['--type', 'public'] : [])], {
33
+ const { stdout } = await (0, spawn_async_1.default)(runner, ['expo', 'config', '--json', ...(opts.isPublicConfig ? ['--type', 'public'] : [])], {
32
34
  cwd: projectDir,
33
35
  env: {
34
36
  ...process.env,
@@ -40,7 +42,7 @@ async function getExpoConfigInternalAsync(projectDir, opts = {}) {
40
42
  }
41
43
  catch (err) {
42
44
  if (!wasExpoConfigWarnPrinted) {
43
- log_1.default.warn(`Failed to read the app config from the project using "npx expo config" command: ${err.message}.`);
45
+ log_1.default.warn(`Failed to read the app config from the project using "${runner} expo config" command: ${err.message}.`);
44
46
  log_1.default.warn('Falling back to the version of "@expo/config" shipped with the EAS CLI.');
45
47
  wasExpoConfigWarnPrinted = true;
46
48
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Resolves the package runner command to use for spawning Expo CLI commands.
3
+ *
4
+ * Priority:
5
+ * 1. Explicit value passed as argument (e.g. from --packageRunner CLI flag)
6
+ * 2. EOAS_PACKAGE_RUNNER environment variable
7
+ * 3. Inferred from packageManager field in package.json
8
+ * 4. Falls back to 'npx'
9
+ *
10
+ * Supported values: npx, bunx, pnpx, or any other package runner binary.
11
+ */
12
+ export declare function resolvePackageRunner(explicit?: string, projectDir?: string): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvePackageRunner = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
+ const DEFAULT_PACKAGE_RUNNER = 'npx';
8
+ const VALID_RUNNER_RE = /^[a-zA-Z0-9._-]+$/;
9
+ function assertValidRunner(value, source) {
10
+ if (!VALID_RUNNER_RE.test(value)) {
11
+ throw new Error(`Invalid package runner "${value}" (from ${source}). Expected a simple binary name like npx, bunx or pnpx.`);
12
+ }
13
+ }
14
+ const PACKAGE_MANAGER_RUNNERS = {
15
+ bun: 'bunx',
16
+ pnpm: 'pnpx',
17
+ yarn: 'npx',
18
+ npm: 'npx',
19
+ };
20
+ /**
21
+ * Resolves the package runner command to use for spawning Expo CLI commands.
22
+ *
23
+ * Priority:
24
+ * 1. Explicit value passed as argument (e.g. from --packageRunner CLI flag)
25
+ * 2. EOAS_PACKAGE_RUNNER environment variable
26
+ * 3. Inferred from packageManager field in package.json
27
+ * 4. Falls back to 'npx'
28
+ *
29
+ * Supported values: npx, bunx, pnpx, or any other package runner binary.
30
+ */
31
+ function resolvePackageRunner(explicit, projectDir) {
32
+ if (explicit) {
33
+ assertValidRunner(explicit, '--packageRunner flag');
34
+ return explicit;
35
+ }
36
+ if (process.env.EOAS_PACKAGE_RUNNER) {
37
+ assertValidRunner(process.env.EOAS_PACKAGE_RUNNER, 'EOAS_PACKAGE_RUNNER environment variable');
38
+ return process.env.EOAS_PACKAGE_RUNNER;
39
+ }
40
+ if (projectDir) {
41
+ const detected = detectRunnerFromPackageJson(projectDir);
42
+ if (detected)
43
+ return detected;
44
+ }
45
+ return DEFAULT_PACKAGE_RUNNER;
46
+ }
47
+ exports.resolvePackageRunner = resolvePackageRunner;
48
+ /**
49
+ * Walks up from projectDir to find a package.json with a packageManager field
50
+ * and maps it to the corresponding package runner binary.
51
+ */
52
+ function detectRunnerFromPackageJson(startDir) {
53
+ let dir = path_1.default.resolve(startDir);
54
+ const root = path_1.default.parse(dir).root;
55
+ while (dir !== root) {
56
+ const pkgPath = path_1.default.join(dir, 'package.json');
57
+ try {
58
+ if (fs_extra_1.default.existsSync(pkgPath)) {
59
+ const pkg = fs_extra_1.default.readJsonSync(pkgPath);
60
+ if (pkg.packageManager) {
61
+ const name = pkg.packageManager.split('@')[0];
62
+ return PACKAGE_MANAGER_RUNNERS[name];
63
+ }
64
+ }
65
+ }
66
+ catch {
67
+ // Ignore read errors, keep walking up
68
+ }
69
+ dir = path_1.default.dirname(dir);
70
+ }
71
+ return undefined;
72
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eoas",
3
- "version": "2.3.13-alpha.4",
3
+ "version": "2.3.14",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.json",