@@ -12,6 +12,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
1212 protected $platformsDataService : IPlatformsDataService ,
1313 protected $packageInstallationManager : IPackageInstallationManager ,
1414 protected $packageManager : IPackageManager ,
15+ private $androidResourcesMigrationService : IAndroidResourcesMigrationService ,
1516 private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
1617 private $logger : ILogger ,
1718 private $errors : IErrors ,
@@ -37,16 +38,15 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
3738 ] ;
3839
3940 private migrationDependencies : IMigrationDependency [ ] = [
40- { packageName : constants . TNS_CORE_MODULES_NAME , verifiedVersion : "6.0.0-rc-2019-06-28-175837-02 " } ,
41+ { packageName : constants . TNS_CORE_MODULES_NAME , verifiedVersion : "6.0.0-rc-2019-07-08-111131-01 " } ,
4142 { packageName : constants . TNS_CORE_MODULES_WIDGETS_NAME , verifiedVersion : "6.0.0" } ,
4243 { packageName : "tns-platform-declarations" , isDev : true , verifiedVersion : "6.0.0-rc-2019-06-28-175837-02" } ,
4344 { packageName : "node-sass" , isDev : true , verifiedVersion : "4.12.0" } ,
4445 { packageName : "typescript" , isDev : true , verifiedVersion : "3.4.1" } ,
45- { packageName : "less" , isDev : true , verifiedVersion : "3.9.0" } ,
4646 { packageName : "nativescript-dev-sass" , isDev : true , replaceWith : "node-sass" } ,
4747 { packageName : "nativescript-dev-typescript" , isDev : true , replaceWith : "typescript" } ,
48- { packageName : "nativescript-dev-less" , isDev : true , replaceWith : "less " } ,
49- { packageName : constants . WEBPACK_PLUGIN_NAME , isDev : true , shouldAddIfMissing : true , verifiedVersion : "1.0.0-rc-2019-07-02-161545-02 " } ,
48+ { packageName : "nativescript-dev-less" , isDev : true , shouldRemove : true , warning : "LESS CSS is not supported out of the box. In order to enable it, follow the steps in this feature request: https://github.com/NativeScript/nativescript-dev-webpack/issues/967 " } ,
49+ { packageName : constants . WEBPACK_PLUGIN_NAME , isDev : true , shouldAddIfMissing : true , verifiedVersion : "1.0.0-rc-2019-07-08-135456-03 " } ,
5050 { packageName : "nativescript-camera" , verifiedVersion : "4.5.0" } ,
5151 { packageName : "nativescript-geolocation" , verifiedVersion : "5.1.0" } ,
5252 { packageName : "nativescript-imagepicker" , verifiedVersion : "6.2.0" } ,
@@ -68,7 +68,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
6868 { packageName : "nativescript-permissions" , verifiedVersion : "1.3.0" } ,
6969 { packageName : "nativescript-cardview" , verifiedVersion : "3.2.0" } ,
7070 {
71- packageName : "nativescript-unit-test-runner" , verifiedVersion : "0.6.3 " ,
71+ packageName : "nativescript-unit-test-runner" , verifiedVersion : "0.6.4 " ,
7272 shouldMigrateAction : ( projectData : IProjectData ) => this . hasDependency ( { packageName : "nativescript-unit-test-runner" , isDev : false } , projectData ) ,
7373 migrateAction : this . migrateUnitTestRunner . bind ( this )
7474 }
@@ -103,6 +103,8 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
103103 this . $logger . trace ( `Error during auto-generated files handling. ${ ( error && error . message ) || error } ` ) ;
104104 }
105105
106+ await this . migrateOldAndroidAppResources ( projectData ) ;
107+
106108 try {
107109 await this . cleanUpProject ( projectData ) ;
108110 await this . migrateDependencies ( projectData ) ;
@@ -112,6 +114,14 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
112114 }
113115 }
114116
117+ private async migrateOldAndroidAppResources ( projectData : IProjectData ) {
118+ const appResourcesPath = projectData . getAppResourcesDirectoryPath ( ) ;
119+ if ( ! this . $androidResourcesMigrationService . hasMigrated ( appResourcesPath ) ) {
120+ this . $logger . info ( "Migrate old Android App_Resources structure." ) ;
121+ await this . $androidResourcesMigrationService . migrate ( appResourcesPath ) ;
122+ }
123+ }
124+
115125 public async shouldMigrate ( { projectDir } : IProjectDir ) : Promise < boolean > {
116126 const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
117127
@@ -123,7 +133,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
123133 return true ;
124134 }
125135
126- if ( hasDependency && dependency . replaceWith ) {
136+ if ( hasDependency && ( dependency . replaceWith || dependency . shouldRemove ) ) {
127137 return true ;
128138 }
129139
@@ -134,6 +144,10 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
134144 if ( ! hasDependency && dependency . shouldAddIfMissing ) {
135145 return true ;
136146 }
147+
148+ if ( ! this . $androidResourcesMigrationService . hasMigrated ( projectData . getAppResourcesDirectoryPath ( ) ) ) {
149+ return true ;
150+ }
137151 }
138152
139153 for ( const platform in this . $devicePlatformsConstants ) {
@@ -146,6 +160,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
146160
147161 private async cleanUpProject ( projectData : IProjectData ) : Promise < void > {
148162 this . $logger . info ( "Clean old project artefacts." ) ;
163+ this . $projectDataService . removeNSConfigProperty ( projectData . projectDir , "useLegacyWorkflow" ) ;
149164 this . $fs . deleteDirectory ( path . join ( projectData . projectDir , constants . HOOKS_DIR_NAME ) ) ;
150165 this . $fs . deleteDirectory ( path . join ( projectData . projectDir , constants . PLATFORMS_DIR_NAME ) ) ;
151166 this . $fs . deleteDirectory ( path . join ( projectData . projectDir , constants . NODE_MODULES_FOLDER_NAME ) ) ;
@@ -244,15 +259,21 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
244259
245260 private async migrateDependency ( dependency : IMigrationDependency , projectData : IProjectData ) : Promise < void > {
246261 const hasDependency = this . hasDependency ( dependency , projectData ) ;
262+ if ( dependency . warning ) {
263+ this . $logger . warn ( dependency . warning ) ;
264+ }
247265
248- if ( hasDependency && dependency . replaceWith ) {
266+ if ( hasDependency && ( dependency . replaceWith || dependency . shouldRemove ) ) {
249267 this . $pluginsService . removeFromPackageJson ( dependency . packageName , projectData . projectDir ) ;
250- const replacementDep = _ . find ( this . migrationDependencies , migrationPackage => migrationPackage . packageName === dependency . replaceWith ) ;
251- if ( ! replacementDep ) {
252- this . $errors . failWithoutHelp ( "Failed to find replacement dependency." ) ;
268+ if ( dependency . replaceWith ) {
269+ const replacementDep = _ . find ( this . migrationDependencies , migrationPackage => migrationPackage . packageName === dependency . replaceWith ) ;
270+ if ( ! replacementDep ) {
271+ this . $errors . failWithoutHelp ( "Failed to find replacement dependency." ) ;
272+ }
273+ this . $logger . info ( `Replacing '${ dependency . packageName } ' with '${ replacementDep . packageName } '.` ) ;
274+ this . $pluginsService . addToPackageJson ( replacementDep . packageName , replacementDep . verifiedVersion , replacementDep . isDev , projectData . projectDir ) ;
253275 }
254- this . $logger . info ( `Replacing '${ dependency . packageName } ' with '${ replacementDep . packageName } '.` ) ;
255- this . $pluginsService . addToPackageJson ( replacementDep . packageName , replacementDep . verifiedVersion , replacementDep . isDev , projectData . projectDir ) ;
276+
256277 return ;
257278 }
258279
0 commit comments