diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index 7ecc2fa512..3f4aad3a53 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -14,6 +14,7 @@ interface IProjectDataService { initialize(projectDir: string): void; getValue(propertyName: string): IFuture; setValue(key: string, value: any): IFuture; + removeProperty(propertyName: string): IFuture; } interface IProjectTemplatesService { diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 38233386eb..f248539124 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -214,11 +214,16 @@ export class PlatformService implements IPlatformService { public removePlatforms(platforms: string[]): IFuture { return (() => { + this.$projectDataService.initialize(this.$projectData.projectDir); + _.each(platforms, platform => { this.validatePlatformInstalled(platform); + let platformData = this.$platformsData.getPlatformData(platform); var platformDir = path.join(this.$projectData.platformsDir, platform); this.$fs.deleteDirectory(platformDir).wait(); + this.$projectDataService.removeProperty(platformData.frameworkPackageName).wait(); + this.$logger.out(`Platform ${platform} successfully removed.`); }); diff --git a/lib/services/project-data-service.ts b/lib/services/project-data-service.ts index 2f6a00a837..f369f15b71 100644 --- a/lib/services/project-data-service.ts +++ b/lib/services/project-data-service.ts @@ -38,6 +38,14 @@ export class ProjectDataService implements IProjectDataService { this.$fs.writeJson(this.projectFilePath, this.projectData, "\t").wait(); }).future()(); } + + public removeProperty(propertyName: string): IFuture { + return (() => { + this.loadProjectFile().wait(); + delete this.projectData[this.$staticConfig.CLIENT_NAME_KEY_IN_PROJECT_FILE][propertyName]; + this.$fs.writeJson(this.projectFilePath, this.projectData, "\t").wait(); + }).future()(); + } private loadProjectFile(): IFuture { return (() => { diff --git a/test/stubs.ts b/test/stubs.ts index 9d7279956b..e718909776 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -320,6 +320,10 @@ export class ProjectDataService implements IProjectDataService { setValue(key: string, value: any): IFuture { return Future.fromResult(); } + + removeProperty(propertyName: string): IFuture { + return Future.fromResult(); + } } export class ProjectHelperStub implements IProjectHelper {