-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathdeploy.ts
59 lines (48 loc) · 2.27 KB
/
deploy.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
import { ANDROID_RELEASE_BUILD_ERROR_MESSAGE } from "../constants";
import { ValidatePlatformCommandBase } from "./command-base";
import { DeployCommandHelper } from "../helpers/deploy-command-helper";
export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];
public dashedOptions = {
watch: { type: OptionType.Boolean, default: false, hasSensitiveValue: false },
hmr: { type: OptionType.Boolean, default: false, hasSensitiveValue: false },
};
constructor($platformValidationService: IPlatformValidationService,
private $platformCommandParameter: ICommandParameter,
$options: IOptions,
$projectData: IProjectData,
private $errors: IErrors,
private $mobileHelper: Mobile.IMobileHelper,
$platformsDataService: IPlatformsDataService,
private $deployCommandHelper: DeployCommandHelper,
private $markingModeService: IMarkingModeService,
private $migrateController: IMigrateController) {
super($options, $platformsDataService, $platformValidationService, $projectData);
this.$projectData.initializeProjectData();
}
public async execute(args: string[]): Promise<void> {
const platform = args[0];
if (this.$mobileHelper.isAndroidPlatform(platform)) {
await this.$markingModeService.handleMarkingModeFullDeprecation({ projectDir: this.$projectData.projectDir, skipWarnings: true });
}
await this.$deployCommandHelper.deploy(platform);
}
public async canExecute(args: string[]): Promise<boolean> {
const platform = args[0];
if (!this.$options.force) {
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
}
if (!args || !args.length || args.length > 1) {
return false;
}
if (!(await this.$platformCommandParameter.validate(platform))) {
return false;
}
if (this.$mobileHelper.isAndroidPlatform(platform) && this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
this.$errors.failWithHelp(ANDROID_RELEASE_BUILD_ERROR_MESSAGE);
}
const result = await super.canExecuteCommandBase(platform, { validateOptions: true });
return result;
}
}
$injector.registerCommand("deploy", DeployOnDeviceCommand);