@@ -6,6 +6,10 @@ import { UpdateControllerBase } from "./update-controller-base";
66import { fromWindowsRelativePathToUnix } from "../common/helpers" ;
77
88export class MigrateController extends UpdateControllerBase implements IMigrateController {
9+ // TODO: Improve the messages here
10+ public UNABLE_TO_MIGRATE_APP_ERROR = "The project is not compatible with NativeScript 6.0" ;
11+ public MIGRATE_MESSAGE = "" ;
12+
913 constructor (
1014 protected $fs : IFileSystem ,
1115 protected $platformCommandHelper : IPlatformCommandHelper ,
@@ -71,7 +75,10 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
7175 shouldMigrateAction : ( projectData : IProjectData ) => this . hasDependency ( { packageName : "nativescript-unit-test-runner" , isDev : false } , projectData ) ,
7276 migrateAction : this . migrateUnitTestRunner . bind ( this )
7377 } ,
74- { packageName : MigrateController . typescriptPackageName , isDev : true , getVerifiedVersion : this . getAngularTypeScriptVersion . bind ( this ) }
78+ { packageName : MigrateController . typescriptPackageName , isDev : true , getVerifiedVersion : this . getAngularTypeScriptVersion . bind ( this ) } ,
79+ { packageName : "nativescript-localize" , verifiedVersion : "4.2.0" } ,
80+ { packageName : "nativescript-dev-babel" , verifiedVersion : "0.2.1" } ,
81+ { packageName : "nativescript-nfc" , verifiedVersion : "4.0.1" }
7582 ] ;
7683
7784 get verifiedPlatformVersions ( ) : IDictionary < string > {
@@ -112,6 +119,8 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
112119 this . restoreBackup ( MigrateController . folders , backupDir , projectData . projectDir ) ;
113120 this . $errors . failWithoutHelp ( `${ MigrateController . migrateFailMessage } The error is: ${ error } ` ) ;
114121 }
122+
123+ this . $logger . info ( this . MIGRATE_MESSAGE ) ;
115124 }
116125
117126 public async shouldMigrate ( { projectDir } : IProjectDir ) : Promise < boolean > {
@@ -136,10 +145,10 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
136145 if ( ! hasDependency && dependency . shouldAddIfMissing ) {
137146 return true ;
138147 }
148+ }
139149
140- if ( ! this . $androidResourcesMigrationService . hasMigrated ( projectData . getAppResourcesDirectoryPath ( ) ) ) {
141- return true ;
142- }
150+ if ( ! this . $androidResourcesMigrationService . hasMigrated ( projectData . getAppResourcesDirectoryPath ( ) ) ) {
151+ return true ;
143152 }
144153
145154 for ( const platform in this . $devicePlatformsConstants ) {
@@ -150,6 +159,13 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
150159 }
151160 }
152161
162+ public async validate ( { projectDir } : IProjectDir ) : Promise < void > {
163+ const shouldMigrate = await this . shouldMigrate ( { projectDir } ) ;
164+ if ( shouldMigrate ) {
165+ this . $errors . failWithoutHelp ( this . UNABLE_TO_MIGRATE_APP_ERROR ) ;
166+ }
167+ }
168+
153169 private async getAngularTypeScriptVersion ( projectData : IProjectData ) : Promise < string > {
154170 let verifiedVersion = "3.4.1" ;
155171 try {
0 commit comments