@@ -15,6 +15,7 @@ import {
1515import { IPluginsService } from "../definitions/plugins" ;
1616import { IFileSystem , IErrors , IDictionary } from "../common/declarations" ;
1717import { injector } from "../common/yok" ;
18+ import { PackageVersion } from "../constants" ;
1819
1920interface IPackage {
2021 name : string ;
@@ -160,17 +161,12 @@ export class UpdateController
160161 lowercasePlatform ,
161162 projectData
162163 ) ;
163- const templatePlatformData = this . $projectDataService . getNSValueFromContent (
164- templateManifest ,
165- platformData . frameworkPackageName
166- ) ;
167- const templateRuntimeVersion =
168- templatePlatformData && templatePlatformData . version ;
164+
169165 if (
170166 await this . shouldUpdateRuntimeVersion (
171167 // templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json
172168 // in other cases, we are just going to default to using the latest
173- templateRuntimeVersion || "*" ,
169+ PackageVersion . LATEST ,
174170 platformData . frameworkPackageName ,
175171 platform ,
176172 projectData
@@ -241,7 +237,7 @@ export class UpdateController
241237 this . $logger . info ( "Finished updating devDependencies." ) ;
242238
243239 this . $logger . info ( "Start updating runtimes." ) ;
244- await this . updateRuntimes ( templateManifest , projectData ) ;
240+ await this . updateRuntimes ( projectData ) ;
245241 this . $logger . info ( "Finished updating runtimes." ) ;
246242
247243 this . $logger . info ( "Install packages." ) ;
@@ -425,38 +421,28 @@ export class UpdateController
425421 }
426422 }
427423
428- private async updateRuntimes (
429- templateManifest : Object ,
430- projectData : IProjectData
431- ) {
424+ private async updateRuntimes ( projectData : IProjectData ) {
432425 for ( const platform in this . $devicePlatformsConstants ) {
433426 const lowercasePlatform = platform . toLowerCase ( ) ;
434427 const platformData = this . $platformsDataService . getPlatformData (
435428 lowercasePlatform ,
436429 projectData
437430 ) ;
438- const templatePlatformData = this . $projectDataService . getNSValueFromContent (
439- templateManifest ,
440- platformData . frameworkPackageName
441- ) ;
442- const templateRuntimeVersion =
443- templatePlatformData && templatePlatformData . version ;
431+
444432 if (
445433 await this . shouldUpdateRuntimeVersion (
446434 // templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json
447435 // in other cases, we are just going to default to using the latest
448- templateRuntimeVersion || "*" ,
436+ PackageVersion . LATEST ,
449437 platformData . frameworkPackageName ,
450438 platform ,
451439 projectData
452440 )
453441 ) {
454- const version =
455- templateRuntimeVersion ||
456- ( await this . $packageInstallationManager . getMaxSatisfyingVersionSafe (
457- platformData . frameworkPackageName ,
458- "*"
459- ) ) ;
442+ const version = await this . $packageInstallationManager . getMaxSatisfyingVersionSafe (
443+ platformData . frameworkPackageName ,
444+ PackageVersion . LATEST
445+ ) ;
460446
461447 this . $logger . info (
462448 `Updating ${ platform } platform to version '${ version } '.`
@@ -465,7 +451,7 @@ export class UpdateController
465451 await this . $addPlatformService . setPlatformVersion (
466452 platformData ,
467453 projectData ,
468- templateRuntimeVersion
454+ version
469455 ) ;
470456 }
471457 }
0 commit comments