@@ -2,6 +2,7 @@ import { IProjectData } from "../definitions/project";
22import { IMigrateController } from "../definitions/migrate" ;
33import { ICommand , ICommandParameter } from "../common/definitions/commands" ;
44import { injector } from "../common/yok" ;
5+ import { ShouldMigrate } from "../constants" ;
56
67export class MigrateCommand implements ICommand {
78 public allowedParameters : ICommandParameter [ ] = [ ] ;
@@ -16,28 +17,31 @@ export class MigrateCommand implements ICommand {
1617 }
1718
1819 public async execute ( args : string [ ] ) : Promise < void > {
19- const shouldMigrateResult = await this . $migrateController . shouldMigrate ( {
20+ const migrationData = {
2021 projectDir : this . $projectData . projectDir ,
2122 platforms : [
2223 this . $devicePlatformsConstants . Android ,
2324 this . $devicePlatformsConstants . iOS ,
2425 ] ,
25- } ) ;
26+ } ;
27+ const shouldMigrateResult = await this . $migrateController . shouldMigrate (
28+ migrationData
29+ ) ;
2630
27- if ( ! shouldMigrateResult ) {
31+ if ( shouldMigrateResult . shouldMigrate === ShouldMigrate . NO ) {
2832 this . $logger . printMarkdown (
2933 '__Project is compatible with NativeScript "v7.0.0". To get the latest NativeScript packages execute "ns update".__'
3034 ) ;
3135 return ;
36+ } else if ( shouldMigrateResult . shouldMigrate === ShouldMigrate . ADVISED ) {
37+ // todo: this shouldn't be here, because this is already the `ns migrate` path.
38+ this . $logger . printMarkdown (
39+ '__Project should work with NativeScript "v7.0.0" but a migration is advised. Run ns migrate to migrate.__'
40+ ) ;
41+ return ;
3242 }
3343
34- await this . $migrateController . migrate ( {
35- projectDir : this . $projectData . projectDir ,
36- platforms : [
37- this . $devicePlatformsConstants . Android ,
38- this . $devicePlatformsConstants . iOS ,
39- ] ,
40- } ) ;
44+ await this . $migrateController . migrate ( migrationData ) ;
4145 }
4246}
4347
0 commit comments