-
Notifications
You must be signed in to change notification settings - Fork 85
/
configure.ts
74 lines (64 loc) · 2.35 KB
/
configure.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
69
70
71
72
73
74
import { Flags } from '@oclif/core';
import chalk from 'chalk';
import { easJsonExistsAsync } from '../../build/configure';
import EasCommand from '../../commandUtils/EasCommand';
import { EASNonInteractiveFlag, EasUpdateEnvironmentFlag } from '../../commandUtils/flags';
import Log, { learnMore } from '../../log';
import { RequestedPlatform } from '../../platform';
import {
ensureEASUpdateIsConfiguredAsync,
ensureEASUpdateIsConfiguredInEasJsonAsync,
} from '../../update/configure';
export default class UpdateConfigure extends EasCommand {
static override description = 'configure the project to support EAS Update';
static override flags = {
platform: Flags.enum<RequestedPlatform>({
description: 'Platform to configure',
char: 'p',
options: Object.values(RequestedPlatform),
default: RequestedPlatform.All,
}),
...EasUpdateEnvironmentFlag,
...EASNonInteractiveFlag,
};
static override contextDefinition = {
...this.ContextOptions.ProjectConfig,
...this.ContextOptions.LoggedIn,
...this.ContextOptions.Vcs,
};
async runAsync(): Promise<void> {
const { flags } = await this.parse(UpdateConfigure);
const {
privateProjectConfig: { projectId, exp, projectDir },
vcsClient,
} = await this.getContextAsync(UpdateConfigure, {
nonInteractive: flags['non-interactive'],
withServerSideEnvironment: flags['environment'],
});
Log.log(
'💡 The following process will configure your project to use EAS Update. These changes only apply to your local project files and you can safely revert them at any time.'
);
await vcsClient.ensureRepoExistsAsync();
await ensureEASUpdateIsConfiguredAsync({
exp,
projectId,
projectDir,
platform: flags['platform'],
vcsClient,
env: undefined,
});
await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
Log.addNewLineIfNone();
Log.log(`🎉 Your app is configured to use EAS Update!`);
Log.newLine();
const easJsonExists = await easJsonExistsAsync(projectDir);
if (!easJsonExists) {
Log.log(`- Run ${chalk.bold('eas build:configure')} to complete your installation`);
}
Log.log(
`- ${learnMore('https://docs.expo.dev/eas-update/introduction/', {
learnMoreMessage: 'Learn more about other capabilities of EAS Update',
})}`
);
}
}