xref: /expo/tools/src/EASCLI.ts (revision 5f54863a)
1import spawnAsync from '@expo/spawn-async';
2import process from 'process';
3
4import { EXPO_DIR } from './Constants';
5
6type Options = {
7  cwd?: string;
8  stdio?: 'inherit' | 'pipe' | 'ignore';
9};
10
11export async function runEASCliAsync(
12  command: string,
13  args: string[] = [],
14  options: Options = {}
15): Promise<string> {
16  // Don't handle SIGINT/SIGTERM in this process...defer to expo-cli
17  process.on('SIGINT', () => {});
18  process.on('SIGTERM', () => {});
19
20  const result = await spawnAsync('eas', [command, ...args], {
21    cwd: options.cwd || EXPO_DIR,
22    env: {
23      ...process.env,
24      EXPO_NO_DOCTOR: 'true',
25    },
26  });
27
28  return result.stdout;
29}
30