-
Notifications
You must be signed in to change notification settings - Fork 75
/
diagnostics.ts
68 lines (60 loc) · 2.08 KB
/
diagnostics.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { Platform } from '@expo/eas-build-job';
import chalk from 'chalk';
import envinfo from 'envinfo';
import EasCommand from '../commandUtils/EasCommand';
import Log from '../log';
import { ora } from '../ora';
import { resolveWorkflowAsync } from '../project/workflow';
import { easCliVersion } from '../utils/easCli';
import { Client } from '../vcs/vcs';
export default class Diagnostics extends EasCommand {
static override description = 'display environment info';
static override contextDefinition = {
...this.ContextOptions.ProjectDir,
...this.ContextOptions.Vcs,
};
async runAsync(): Promise<void> {
const { projectDir, vcsClient } = await this.getContextAsync(Diagnostics, {
nonInteractive: true,
});
const spinner = ora().start(`Gathering diagnostic information...`);
const info = await envinfo.run(
{
System: ['OS', 'Shell'],
Binaries: ['Node', 'Yarn', 'npm'],
Utilities: ['Git'],
npmPackages: [
'expo',
'expo-cli',
'react',
'react-dom',
'react-native',
'react-native-web',
'react-navigation',
'@expo/webpack-config',
'expo-dev-client',
'expo-updates',
],
npmGlobalPackages: ['eas-cli', 'expo-cli'],
},
{
title: chalk.bold(`EAS CLI ${easCliVersion} environment info`),
}
);
spinner.succeed('All needed information gathered!');
Log.log(info.trimEnd());
await this.printWorkflowAsync(projectDir, vcsClient);
Log.newLine();
}
private async printWorkflowAsync(projectDir: string, vcsClient: Client): Promise<void> {
const androidWorkflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const iosWorkflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
if (androidWorkflow === iosWorkflow) {
Log.log(` Project workflow: ${androidWorkflow}`);
} else {
Log.log(` Project workflow:`);
Log.log(` Android: ${androidWorkflow}`);
Log.log(` iOS: ${iosWorkflow}`);
}
}
}