-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathclean-app.ts
83 lines (69 loc) · 3 KB
/
clean-app.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
75
76
77
78
79
80
81
82
83
import { ValidatePlatformCommandBase } from "./command-base";
export class CleanAppCommandBase extends ValidatePlatformCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];
protected platform: string;
constructor($options: IOptions,
$projectData: IProjectData,
$platformService: IPlatformService,
protected $errors: IErrors,
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
$platformsData: IPlatformsData,
private $logger: ILogger) {
super($options, $platformsData, $platformService, $projectData);
this.$projectData.initializeProjectData();
}
public async execute(args: string[]): Promise<void> {
this.$logger.warn(`"tns clean-app ${this.platform.toLowerCase()}" command has been deprecated and will be removed in the upcoming NativeScript CLI v6.0.0. More info can be found in this issue https://github.com/NativeScript/nativescript-cli/issues/4518.`);
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = {
bundle: !!this.$options.bundle,
release: this.$options.release,
useHotModuleReload: false
};
const platformInfo: IPreparePlatformInfo = {
appFilesUpdaterOptions,
platform: this.platform.toLowerCase(),
config: this.$options,
platformTemplate: this.$options.platformTemplate,
projectData: this.$projectData,
env: this.$options.env
};
return this.$platformService.cleanDestinationApp(platformInfo);
}
public async canExecute(args: string[]): Promise<ICanExecuteCommandOutput> {
if (!this.$platformService.isPlatformSupportedForOS(this.platform, this.$projectData)) {
this.$errors.fail(`Applications for platform ${this.platform} can not be built on this OS`);
}
const result = await super.canExecuteCommandBase(this.platform);
return result;
}
}
export class CleanAppIosCommand extends CleanAppCommandBase implements ICommand {
constructor(protected $options: IOptions,
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
protected $platformsData: IPlatformsData,
protected $errors: IErrors,
$platformService: IPlatformService,
$projectData: IProjectData,
$logger: ILogger) {
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData, $logger);
}
protected get platform(): string {
return this.$devicePlatformsConstants.iOS;
}
}
$injector.registerCommand("clean-app|ios", CleanAppIosCommand);
export class CleanAppAndroidCommand extends CleanAppCommandBase implements ICommand {
constructor(protected $options: IOptions,
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
protected $platformsData: IPlatformsData,
protected $errors: IErrors,
$platformService: IPlatformService,
$projectData: IProjectData,
$logger: ILogger) {
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData, $logger);
}
protected get platform(): string {
return this.$devicePlatformsConstants.Android;
}
}
$injector.registerCommand("clean-app|android", CleanAppAndroidCommand);