@@ -2,6 +2,7 @@ import { IProjectData } from "../definitions/project";
2
2
import { IMigrateController } from "../definitions/migrate" ;
3
3
import { ICommand , ICommandParameter } from "../common/definitions/commands" ;
4
4
import { injector } from "../common/yok" ;
5
+ import { ShouldMigrate } from "../constants" ;
5
6
6
7
export class MigrateCommand implements ICommand {
7
8
public allowedParameters : ICommandParameter [ ] = [ ] ;
@@ -16,28 +17,31 @@ export class MigrateCommand implements ICommand {
16
17
}
17
18
18
19
public async execute ( args : string [ ] ) : Promise < void > {
19
- const shouldMigrateResult = await this . $migrateController . shouldMigrate ( {
20
+ const migrationData = {
20
21
projectDir : this . $projectData . projectDir ,
21
22
platforms : [
22
23
this . $devicePlatformsConstants . Android ,
23
24
this . $devicePlatformsConstants . iOS ,
24
25
] ,
25
- } ) ;
26
+ } ;
27
+ const shouldMigrateResult = await this . $migrateController . shouldMigrate (
28
+ migrationData
29
+ ) ;
26
30
27
- if ( ! shouldMigrateResult ) {
31
+ if ( shouldMigrateResult . shouldMigrate === ShouldMigrate . NO ) {
28
32
this . $logger . printMarkdown (
29
33
'__Project is compatible with NativeScript "v7.0.0". To get the latest NativeScript packages execute "ns update".__'
30
34
) ;
31
35
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 ;
32
42
}
33
43
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 ) ;
41
45
}
42
46
}
43
47
0 commit comments