From e1aaf389920d4181f1a7019ffdcac3981725e8cc Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 9 Sep 2020 12:01:19 +0200 Subject: [PATCH] fix: platform clean not adding the platform back fixes #5365 --- lib/controllers/platform-controller.ts | 9 +++++++-- lib/services/platform/platform-validation-service.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/controllers/platform-controller.ts b/lib/controllers/platform-controller.ts index c78e7e27c6..2203c1a56e 100644 --- a/lib/controllers/platform-controller.ts +++ b/lib/controllers/platform-controller.ts @@ -114,8 +114,13 @@ export class PlatformController implements IPlatformController { projectData.projectDir, platformData.platformNameLowerCase as SupportedPlatform ); - // if no version is explicitly added, then we use the latest - if (!version && !desiredRuntimePackage.version) { + + if (version) { + desiredRuntimePackage.version = version; + } + + if (!desiredRuntimePackage.version) { + // if no version is explicitly added, then we use the latest desiredRuntimePackage.version = await this.$packageInstallationManager.getLatestCompatibleVersion( desiredRuntimePackage.name ); diff --git a/lib/services/platform/platform-validation-service.ts b/lib/services/platform/platform-validation-service.ts index 0ed35428ec..c29d96b9f8 100644 --- a/lib/services/platform/platform-validation-service.ts +++ b/lib/services/platform/platform-validation-service.ts @@ -54,7 +54,7 @@ export class PlatformValidationService implements IPlatformValidationService { ); if (!hasPlatformDirectory) { this.$errors.fail( - "The platform %s is not added to this project. Please use 'tns platform add '", + "The platform %s is not added to this project. Please use 'ns platform add '", platform ); }