@@ -95,7 +95,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
9595 } ;
9696 }
9797
98- public async migrate ( { projectDir } : { projectDir : string } ) : Promise < void > {
98+ public async migrate ( { projectDir, platforms } : IMigrationData ) : Promise < void > {
9999 const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
100100 const backupDir = path . join ( projectDir , MigrateController . backupFolder ) ;
101101
@@ -121,7 +121,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
121121
122122 try {
123123 await this . cleanUpProject ( projectData ) ;
124- await this . migrateDependencies ( projectData ) ;
124+ await this . migrateDependencies ( projectData , platforms ) ;
125125 } catch ( error ) {
126126 this . restoreBackup ( MigrateController . folders , backupDir , projectData . projectDir ) ;
127127 this . $errors . failWithoutHelp ( `${ MigrateController . migrateFailMessage } The error is: ${ error } ` ) ;
@@ -130,7 +130,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
130130 this . $logger . info ( MigrateController . MIGRATE_FINISH_MESSAGE ) ;
131131 }
132132
133- public async shouldMigrate ( { projectDir } : IProjectDir ) : Promise < boolean > {
133+ public async shouldMigrate ( { projectDir, platforms } : IMigrationData ) : Promise < boolean > {
134134 const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
135135 const shouldMigrateCommonMessage = "The app is not compatible with this CLI version and it should be migrated. Reason: " ;
136136
@@ -159,7 +159,9 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
159159 }
160160 }
161161
162- for ( const platform in this . $devicePlatformsConstants ) {
162+ for ( let platform of platforms ) {
163+ platform = platform && platform . toLowerCase ( ) ;
164+
163165 const hasRuntimeDependency = this . hasRuntimeDependency ( { platform, projectData } ) ;
164166 if ( hasRuntimeDependency && await this . shouldUpdateRuntimeVersion ( { targetVersion : this . verifiedPlatformVersions [ platform . toLowerCase ( ) ] , platform, projectData } ) ) {
165167 this . $logger . trace ( `${ shouldMigrateCommonMessage } Platform '${ platform } ' should be updated.` ) ;
@@ -168,8 +170,8 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
168170 }
169171 }
170172
171- public async validate ( { projectDir } : IProjectDir ) : Promise < void > {
172- const shouldMigrate = await this . shouldMigrate ( { projectDir } ) ;
173+ public async validate ( { projectDir, platforms } : IMigrationData ) : Promise < void > {
174+ const shouldMigrate = await this . shouldMigrate ( { projectDir, platforms } ) ;
173175 if ( shouldMigrate ) {
174176 this . $errors . failWithoutHelp ( MigrateController . UNABLE_TO_MIGRATE_APP_ERROR ) ;
175177 }
@@ -273,7 +275,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
273275 return autoGeneratedFiles ;
274276 }
275277
276- private async migrateDependencies ( projectData : IProjectData ) : Promise < void > {
278+ private async migrateDependencies ( projectData : IProjectData , platforms : string [ ] ) : Promise < void > {
277279 this . $logger . info ( "Start dependencies migration." ) ;
278280 for ( let i = 0 ; i < this . migrationDependencies . length ; i ++ ) {
279281 const dependency = this . migrationDependencies [ i ] ;
@@ -289,7 +291,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
289291 await this . migrateDependency ( dependency , projectData ) ;
290292 }
291293
292- for ( const platform in this . $devicePlatformsConstants ) {
294+ for ( const platform of platforms ) {
293295 const lowercasePlatform = platform . toLowerCase ( ) ;
294296 const hasRuntimeDependency = this . hasRuntimeDependency ( { platform, projectData } ) ;
295297 if ( hasRuntimeDependency && await this . shouldUpdateRuntimeVersion ( { targetVersion : this . verifiedPlatformVersions [ lowercasePlatform ] , platform, projectData } ) ) {
0 commit comments