Skip to content

Commit baaea89

Browse files
author
Emil Tabakov
committed
Move clean command logic to platform service
1 parent 4cb7ebf commit baaea89

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/commands/platform-clean.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export class CleanCommand implements ICommand {
99
}
1010

1111
public async execute(args: string[]): Promise<void> {
12-
await this.$platformService.removePlatforms(args, this.$projectData);
13-
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
12+
await this.$platformService.cleanPlatforms(args, this.$options.platformTemplate, this.$projectData, {provision: this.$options.provision, sdk: this.$options.sdk });
1413
}
1514

1615
public async canExecute(args: string[]): Promise<boolean> {

lib/definitions/platform.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
interface IPlatformService extends NodeJS.EventEmitter {
2+
cleanPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, framework?: string): Promise<void>;
3+
24
addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise<void>;
35

46
/**

lib/services/platform-service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export class PlatformService extends EventEmitter implements IPlatformService {
4646
super();
4747
}
4848

49+
public async cleanPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, framworkPath?: string): Promise<void> {
50+
await this.removePlatforms(platforms, projectData);
51+
await this.addPlatforms(platforms, platformTemplate, projectData, platformSpecificData);
52+
}
53+
4954
public async addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise<void> {
5055
let platformsDir = projectData.platformsDir;
5156
this.$fs.ensureDirectoryExists(platformsDir);

0 commit comments

Comments
 (0)