-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathprepare.ts
39 lines (33 loc) · 1.45 KB
/
prepare.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
export class PrepareCommand implements ICommand {
public allowedParameters = [this.$platformCommandParameter];
constructor(private $options: IOptions,
private $platformService: IPlatformService,
private $projectData: IProjectData,
private $platformCommandParameter: ICommandParameter,
private $platformsData: IPlatformsData) {
this.$projectData.initializeProjectData();
}
public async execute(args: string[]): Promise<void> {
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: !!this.$options.bundle, release: this.$options.release };
const platformInfo: IPreparePlatformInfo = {
platform: args[0],
appFilesUpdaterOptions,
platformTemplate: this.$options.platformTemplate,
projectData: this.$projectData,
config: this.$options,
env: this.$options.env
};
await this.$platformService.preparePlatform(platformInfo);
}
public async canExecute(args: string[]): Promise<boolean> {
const platform = args[0];
const result = await this.$platformCommandParameter.validate(platform) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, platform);
if (result) {
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
const platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);
}
return result;
}
}
$injector.registerCommand("prepare", PrepareCommand);