@@ -44,32 +44,6 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
4444 { packageName : constants . TNS_CORE_MODULES_WIDGETS_NAME , verifiedVersion : "6.0.0" } ,
4545 { packageName : "tns-platform-declarations" , isDev : true , verifiedVersion : "6.0.0-rc-2019-07-09-183845-06" } ,
4646 { packageName : "node-sass" , isDev : true , verifiedVersion : "4.12.0" } ,
47- {
48- packageName : MigrateController . typescriptPackageName , isDev : true , getVerifiedVersion : async ( projectData : IProjectData ) => {
49- let verifiedVersion = "3.4.1" ;
50- try {
51- const ngcPackageName = "@angular/compiler-cli" ;
52- // e.g. ~8.0.0
53- let ngcVersion = projectData . dependencies [ ngcPackageName ] || projectData . devDependencies [ ngcPackageName ] ;
54- if ( ngcVersion ) {
55- // e.g. ~8.0.3
56- ngcVersion = await this . $packageInstallationManager . maxSatisfyingVersion ( ngcPackageName , ngcVersion ) ;
57- const ngcManifest = await this . getTemplateManifest ( ngcPackageName , ngcVersion ) ;
58- // e.g. >=3.4 <3.5
59- verifiedVersion = ( ngcManifest && ngcManifest . peerDependencies &&
60- ngcManifest . peerDependencies [ MigrateController . typescriptPackageName ] ) || verifiedVersion ;
61-
62- // e.g. 3.4.4
63- verifiedVersion = await this . $packageInstallationManager . maxSatisfyingVersion (
64- MigrateController . typescriptPackageName , verifiedVersion ) ;
65- }
66- } catch ( error ) {
67- this . $logger . warn ( `Unable to determine the TypeScript version based on the Angular packages. Error is: '${ error } '.` ) ;
68- }
69-
70- return verifiedVersion ;
71- }
72- } ,
7347 { packageName : "nativescript-dev-sass" , isDev : true , replaceWith : "node-sass" } ,
7448 { packageName : "nativescript-dev-typescript" , isDev : true , replaceWith : MigrateController . typescriptPackageName } ,
7549 { packageName : "nativescript-dev-less" , isDev : true , shouldRemove : true , warning : "LESS CSS is not supported out of the box. In order to enable it, follow the steps in this feature request: https://github.com/NativeScript/nativescript-dev-webpack/issues/967" } ,
@@ -96,7 +70,8 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
9670 packageName : "nativescript-unit-test-runner" , verifiedVersion : "0.6.4" ,
9771 shouldMigrateAction : ( projectData : IProjectData ) => this . hasDependency ( { packageName : "nativescript-unit-test-runner" , isDev : false } , projectData ) ,
9872 migrateAction : this . migrateUnitTestRunner . bind ( this )
99- }
73+ } ,
74+ { packageName : MigrateController . typescriptPackageName , isDev : true , getVerifiedVersion : this . getAngularTypeScriptVersion . bind ( this ) }
10075 ] ;
10176
10277 get verifiedPlatformVersions ( ) : IDictionary < string > {
@@ -175,7 +150,32 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
175150 }
176151 }
177152
178- private async migrateOldAndroidAppResources ( projectData : IProjectData ) {
153+ private async getAngularTypeScriptVersion ( projectData : IProjectData ) : Promise < string > {
154+ let verifiedVersion = "3.4.1" ;
155+ try {
156+ const ngcPackageName = "@angular/compiler-cli" ;
157+ // e.g. ~8.0.0
158+ let ngcVersion = projectData . dependencies [ ngcPackageName ] || projectData . devDependencies [ ngcPackageName ] ;
159+ if ( ngcVersion ) {
160+ // e.g. 8.0.3
161+ ngcVersion = await this . $packageInstallationManager . maxSatisfyingVersion ( ngcPackageName , ngcVersion ) ;
162+ const ngcManifest = await this . getTemplateManifest ( ngcPackageName , ngcVersion ) ;
163+ // e.g. >=3.4 <3.5
164+ verifiedVersion = ( ngcManifest && ngcManifest . peerDependencies &&
165+ ngcManifest . peerDependencies [ MigrateController . typescriptPackageName ] ) || verifiedVersion ;
166+
167+ // e.g. 3.4.4
168+ verifiedVersion = await this . $packageInstallationManager . maxSatisfyingVersion (
169+ MigrateController . typescriptPackageName , verifiedVersion ) ;
170+ }
171+ } catch ( error ) {
172+ this . $logger . warn ( `Unable to determine the TypeScript version based on the Angular packages. Error is: '${ error } '.` ) ;
173+ }
174+
175+ return verifiedVersion ;
176+ }
177+
178+ private async migrateOldAndroidAppResources ( projectData : IProjectData , backupDir : string ) {
179179 const appResourcesPath = projectData . getAppResourcesDirectoryPath ( ) ;
180180 if ( ! this . $androidResourcesMigrationService . hasMigrated ( appResourcesPath ) ) {
181181 this . $logger . info ( "Migrate old Android App_Resources structure." ) ;
0 commit comments