@@ -15,6 +15,7 @@ import {
15
15
import { IPluginsService } from "../definitions/plugins" ;
16
16
import { IFileSystem , IErrors , IDictionary } from "../common/declarations" ;
17
17
import { injector } from "../common/yok" ;
18
+ import { PackageVersion } from "../constants" ;
18
19
19
20
interface IPackage {
20
21
name : string ;
@@ -160,17 +161,12 @@ export class UpdateController
160
161
lowercasePlatform ,
161
162
projectData
162
163
) ;
163
- const templatePlatformData = this . $projectDataService . getNSValueFromContent (
164
- templateManifest ,
165
- platformData . frameworkPackageName
166
- ) ;
167
- const templateRuntimeVersion =
168
- templatePlatformData && templatePlatformData . version ;
164
+
169
165
if (
170
166
await this . shouldUpdateRuntimeVersion (
171
167
// templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json
172
168
// in other cases, we are just going to default to using the latest
173
- templateRuntimeVersion || "*" ,
169
+ PackageVersion . LATEST ,
174
170
platformData . frameworkPackageName ,
175
171
platform ,
176
172
projectData
@@ -241,7 +237,7 @@ export class UpdateController
241
237
this . $logger . info ( "Finished updating devDependencies." ) ;
242
238
243
239
this . $logger . info ( "Start updating runtimes." ) ;
244
- await this . updateRuntimes ( templateManifest , projectData ) ;
240
+ await this . updateRuntimes ( projectData ) ;
245
241
this . $logger . info ( "Finished updating runtimes." ) ;
246
242
247
243
this . $logger . info ( "Install packages." ) ;
@@ -425,38 +421,28 @@ export class UpdateController
425
421
}
426
422
}
427
423
428
- private async updateRuntimes (
429
- templateManifest : Object ,
430
- projectData : IProjectData
431
- ) {
424
+ private async updateRuntimes ( projectData : IProjectData ) {
432
425
for ( const platform in this . $devicePlatformsConstants ) {
433
426
const lowercasePlatform = platform . toLowerCase ( ) ;
434
427
const platformData = this . $platformsDataService . getPlatformData (
435
428
lowercasePlatform ,
436
429
projectData
437
430
) ;
438
- const templatePlatformData = this . $projectDataService . getNSValueFromContent (
439
- templateManifest ,
440
- platformData . frameworkPackageName
441
- ) ;
442
- const templateRuntimeVersion =
443
- templatePlatformData && templatePlatformData . version ;
431
+
444
432
if (
445
433
await this . shouldUpdateRuntimeVersion (
446
434
// templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json
447
435
// in other cases, we are just going to default to using the latest
448
- templateRuntimeVersion || "*" ,
436
+ PackageVersion . LATEST ,
449
437
platformData . frameworkPackageName ,
450
438
platform ,
451
439
projectData
452
440
)
453
441
) {
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
+ ) ;
460
446
461
447
this . $logger . info (
462
448
`Updating ${ platform } platform to version '${ version } '.`
@@ -465,7 +451,7 @@ export class UpdateController
465
451
await this . $addPlatformService . setPlatformVersion (
466
452
platformData ,
467
453
projectData ,
468
- templateRuntimeVersion
454
+ version
469
455
) ;
470
456
}
471
457
}
0 commit comments