Skip to content

Commit 5e15627

Browse files
committed
fix: update should update runtime versions
1 parent 419ecda commit 5e15627

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

lib/controllers/update-controller.ts

+19-9
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,14 @@ export class UpdateController
167167
const templateRuntimeVersion =
168168
templatePlatformData && templatePlatformData.version;
169169
if (
170-
templateRuntimeVersion &&
171-
(await this.shouldUpdateRuntimeVersion(
172-
templateRuntimeVersion,
170+
await this.shouldUpdateRuntimeVersion(
171+
// templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json
172+
// in other cases, we are just going to default to using the latest
173+
templateRuntimeVersion || "*",
173174
platformData.frameworkPackageName,
174175
platform,
175176
projectData
176-
))
177+
)
177178
) {
178179
return true;
179180
}
@@ -441,17 +442,26 @@ export class UpdateController
441442
const templateRuntimeVersion =
442443
templatePlatformData && templatePlatformData.version;
443444
if (
444-
templateRuntimeVersion &&
445-
(await this.shouldUpdateRuntimeVersion(
446-
templateRuntimeVersion,
445+
await this.shouldUpdateRuntimeVersion(
446+
// templateRuntimeVersion is only set if the template has the legacy nativescript key in package.json
447+
// in other cases, we are just going to default to using the latest
448+
templateRuntimeVersion || "*",
447449
platformData.frameworkPackageName,
448450
platform,
449451
projectData
450-
))
452+
)
451453
) {
454+
const version =
455+
templateRuntimeVersion ||
456+
(await this.$packageInstallationManager.getMaxSatisfyingVersionSafe(
457+
platformData.frameworkPackageName,
458+
"*"
459+
));
460+
452461
this.$logger.info(
453-
`Updating ${platform} platform to version '${templateRuntimeVersion}'.`
462+
`Updating ${platform} platform to version '${version}'.`
454463
);
464+
455465
await this.$addPlatformService.setPlatformVersion(
456466
platformData,
457467
projectData,

0 commit comments

Comments
 (0)