-
Notifications
You must be signed in to change notification settings - Fork 75
/
configure-build.ts
65 lines (57 loc) · 1.96 KB
/
configure-build.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
import { Platform } from '@expo/eas-build-job';
import { Flags } from '@oclif/core';
import EasCommand from '../../commandUtils/EasCommand';
import { SelectBuildProfileFromEasJson } from '../../credentials/manager/SelectBuildProfileFromEasJson';
import { SetUpBuildCredentialsCommandAction } from '../../credentials/manager/SetUpBuildCredentialsCommandAction';
import { selectPlatformAsync } from '../../platform';
export default class InitializeBuildCredentials extends EasCommand {
static override description = 'Set up credentials for building your project.';
static override flags = {
platform: Flags.enum({
char: 'p',
options: [Platform.ANDROID, Platform.IOS],
}),
profile: Flags.string({
char: 'e',
description: 'The name of the build profile in eas.json.',
helpValue: 'PROFILE_NAME',
}),
};
static override contextDefinition = {
...this.ContextOptions.LoggedIn,
...this.ContextOptions.ProjectConfig,
...this.ContextOptions.DynamicProjectConfig,
...this.ContextOptions.Analytics,
...this.ContextOptions.Vcs,
};
async runAsync(): Promise<void> {
const { flags } = await this.parse(InitializeBuildCredentials);
const {
loggedIn: { actor, graphqlClient },
privateProjectConfig,
getDynamicPrivateProjectConfigAsync,
analytics,
vcsClient,
} = await this.getContextAsync(InitializeBuildCredentials, {
nonInteractive: false,
});
const platform = await selectPlatformAsync(flags.platform);
const buildProfile =
flags.profile ??
(await new SelectBuildProfileFromEasJson(
privateProjectConfig.projectDir,
Platform.IOS
).getProfileNameFromEasConfigAsync());
await new SetUpBuildCredentialsCommandAction(
actor,
graphqlClient,
vcsClient,
analytics,
privateProjectConfig ?? null,
getDynamicPrivateProjectConfigAsync,
platform,
buildProfile,
process.cwd()
).runAsync();
}
}