-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathemulate.ts
68 lines (59 loc) · 2.61 KB
/
emulate.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
export class EmulateCommandBase {
constructor(private $options: IOptions,
private $projectData: IProjectData,
private $logger: ILogger,
private $platformService: IPlatformService) {
this.$projectData.initializeProjectData();
}
public async executeCore(args: string[]): Promise<void> {
this.$logger.warn(`Emulate command is deprecated and will soon be removed. Please use "tns run <platform>" instead. All options available for "tns emulate" are present in "tns run" command. To run on all available emulators, use "tns run <platform> --emulator".`);
this.$options.emulator = true;
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
const emulateOptions: IEmulatePlatformOptions = {
avd: this.$options.avd,
clean: this.$options.clean,
device: this.$options.device,
release: this.$options.release,
emulator: this.$options.emulator,
projectDir: this.$options.path,
justlaunch: this.$options.justlaunch,
availableDevices: this.$options.availableDevices,
platformTemplate: this.$options.platformTemplate,
provision: this.$options.provision,
teamId: this.$options.teamId,
keyStoreAlias: this.$options.keyStoreAlias,
keyStoreAliasPassword: this.$options.keyStoreAliasPassword,
keyStorePassword: this.$options.keyStorePassword,
keyStorePath: this.$options.keyStorePath
};
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, this.$options);
}
}
export class EmulateIosCommand extends EmulateCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];
constructor($options: IOptions,
$projectData: IProjectData,
$logger: ILogger,
$platformService: IPlatformService,
private $platformsData: IPlatformsData) {
super($options, $projectData, $logger, $platformService);
}
public async execute(args: string[]): Promise<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}
}
$injector.registerCommand("emulate|ios", EmulateIosCommand);
export class EmulateAndroidCommand extends EmulateCommandBase implements ICommand {
constructor($options: IOptions,
$projectData: IProjectData,
$logger: ILogger,
$platformService: IPlatformService,
private $platformsData: IPlatformsData) {
super($options, $projectData, $logger, $platformService);
}
public allowedParameters: ICommandParameter[] = [];
public async execute(args: string[]): Promise<void> {
return this.executeCore([this.$platformsData.availablePlatforms.Android]);
}
}
$injector.registerCommand("emulate|android", EmulateAndroidCommand);