@@ -95,7 +95,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
95
95
} ;
96
96
}
97
97
98
- public async migrate ( { projectDir } : { projectDir : string } ) : Promise < void > {
98
+ public async migrate ( { projectDir, platforms } : IMigrationData ) : Promise < void > {
99
99
const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
100
100
const backupDir = path . join ( projectDir , MigrateController . backupFolder ) ;
101
101
@@ -121,7 +121,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
121
121
122
122
try {
123
123
await this . cleanUpProject ( projectData ) ;
124
- await this . migrateDependencies ( projectData ) ;
124
+ await this . migrateDependencies ( projectData , platforms ) ;
125
125
} catch ( error ) {
126
126
this . restoreBackup ( MigrateController . folders , backupDir , projectData . projectDir ) ;
127
127
this . $errors . failWithoutHelp ( `${ MigrateController . migrateFailMessage } The error is: ${ error } ` ) ;
@@ -130,7 +130,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
130
130
this . $logger . info ( MigrateController . MIGRATE_FINISH_MESSAGE ) ;
131
131
}
132
132
133
- public async shouldMigrate ( { projectDir } : IProjectDir ) : Promise < boolean > {
133
+ public async shouldMigrate ( { projectDir, platforms } : IMigrationData ) : Promise < boolean > {
134
134
const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
135
135
const shouldMigrateCommonMessage = "The app is not compatible with this CLI version and it should be migrated. Reason: " ;
136
136
@@ -159,7 +159,9 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
159
159
}
160
160
}
161
161
162
- for ( const platform in this . $devicePlatformsConstants ) {
162
+ for ( let platform of platforms ) {
163
+ platform = platform && platform . toLowerCase ( ) ;
164
+
163
165
const hasRuntimeDependency = this . hasRuntimeDependency ( { platform, projectData } ) ;
164
166
if ( hasRuntimeDependency && await this . shouldUpdateRuntimeVersion ( { targetVersion : this . verifiedPlatformVersions [ platform . toLowerCase ( ) ] , platform, projectData } ) ) {
165
167
this . $logger . trace ( `${ shouldMigrateCommonMessage } Platform '${ platform } ' should be updated.` ) ;
@@ -168,8 +170,8 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
168
170
}
169
171
}
170
172
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 } ) ;
173
175
if ( shouldMigrate ) {
174
176
this . $errors . failWithoutHelp ( MigrateController . UNABLE_TO_MIGRATE_APP_ERROR ) ;
175
177
}
@@ -273,7 +275,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
273
275
return autoGeneratedFiles ;
274
276
}
275
277
276
- private async migrateDependencies ( projectData : IProjectData ) : Promise < void > {
278
+ private async migrateDependencies ( projectData : IProjectData , platforms : string [ ] ) : Promise < void > {
277
279
this . $logger . info ( "Start dependencies migration." ) ;
278
280
for ( let i = 0 ; i < this . migrationDependencies . length ; i ++ ) {
279
281
const dependency = this . migrationDependencies [ i ] ;
@@ -289,7 +291,7 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
289
291
await this . migrateDependency ( dependency , projectData ) ;
290
292
}
291
293
292
- for ( const platform in this . $devicePlatformsConstants ) {
294
+ for ( const platform of platforms ) {
293
295
const lowercasePlatform = platform . toLowerCase ( ) ;
294
296
const hasRuntimeDependency = this . hasRuntimeDependency ( { platform, projectData } ) ;
295
297
if ( hasRuntimeDependency && await this . shouldUpdateRuntimeVersion ( { targetVersion : this . verifiedPlatformVersions [ lowercasePlatform ] , platform, projectData } ) ) {
0 commit comments