From 5e15627be81f164444b0525dbd0a322185b46d6d Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 1 Sep 2020 12:38:11 +0200 Subject: [PATCH] fix: update should update runtime versions --- lib/controllers/update-controller.ts | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/controllers/update-controller.ts b/lib/controllers/update-controller.ts index 9a03b84b08..6fd085a5a3 100644 --- a/lib/controllers/update-controller.ts +++ b/lib/controllers/update-controller.ts @@ -167,13 +167,14 @@ export class UpdateController const templateRuntimeVersion = templatePlatformData && templatePlatformData.version; if ( - templateRuntimeVersion && - (await this.shouldUpdateRuntimeVersion( - templateRuntimeVersion, + await this.shouldUpdateRuntimeVersion( + // templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json + // in other cases, we are just going to default to using the latest + templateRuntimeVersion || "*", platformData.frameworkPackageName, platform, projectData - )) + ) ) { return true; } @@ -441,17 +442,26 @@ export class UpdateController const templateRuntimeVersion = templatePlatformData && templatePlatformData.version; if ( - templateRuntimeVersion && - (await this.shouldUpdateRuntimeVersion( - templateRuntimeVersion, + await this.shouldUpdateRuntimeVersion( + // templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json + // in other cases, we are just going to default to using the latest + templateRuntimeVersion || "*", platformData.frameworkPackageName, platform, projectData - )) + ) ) { + const version = + templateRuntimeVersion || + (await this.$packageInstallationManager.getMaxSatisfyingVersionSafe( + platformData.frameworkPackageName, + "*" + )); + this.$logger.info( - `Updating ${platform} platform to version '${templateRuntimeVersion}'.` + `Updating ${platform} platform to version '${version}'.` ); + await this.$addPlatformService.setPlatformVersion( platformData, projectData,