@@ -12,6 +12,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
12
12
protected $platformsDataService : IPlatformsDataService ,
13
13
protected $packageInstallationManager : IPackageInstallationManager ,
14
14
protected $packageManager : IPackageManager ,
15
+ private $androidResourcesMigrationService : IAndroidResourcesMigrationService ,
15
16
private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
16
17
private $logger : ILogger ,
17
18
private $errors : IErrors ,
@@ -37,16 +38,15 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
37
38
] ;
38
39
39
40
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 " } ,
41
42
{ packageName : constants . TNS_CORE_MODULES_WIDGETS_NAME , verifiedVersion : "6.0.0" } ,
42
43
{ packageName : "tns-platform-declarations" , isDev : true , verifiedVersion : "6.0.0-rc-2019-06-28-175837-02" } ,
43
44
{ packageName : "node-sass" , isDev : true , verifiedVersion : "4.12.0" } ,
44
45
{ packageName : "typescript" , isDev : true , verifiedVersion : "3.4.1" } ,
45
- { packageName : "less" , isDev : true , verifiedVersion : "3.9.0" } ,
46
46
{ packageName : "nativescript-dev-sass" , isDev : true , replaceWith : "node-sass" } ,
47
47
{ 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 " } ,
50
50
{ packageName : "nativescript-camera" , verifiedVersion : "4.5.0" } ,
51
51
{ packageName : "nativescript-geolocation" , verifiedVersion : "5.1.0" } ,
52
52
{ packageName : "nativescript-imagepicker" , verifiedVersion : "6.2.0" } ,
@@ -68,7 +68,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
68
68
{ packageName : "nativescript-permissions" , verifiedVersion : "1.3.0" } ,
69
69
{ packageName : "nativescript-cardview" , verifiedVersion : "3.2.0" } ,
70
70
{
71
- packageName : "nativescript-unit-test-runner" , verifiedVersion : "0.6.3 " ,
71
+ packageName : "nativescript-unit-test-runner" , verifiedVersion : "0.6.4 " ,
72
72
shouldMigrateAction : ( projectData : IProjectData ) => this . hasDependency ( { packageName : "nativescript-unit-test-runner" , isDev : false } , projectData ) ,
73
73
migrateAction : this . migrateUnitTestRunner . bind ( this )
74
74
}
@@ -103,6 +103,8 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
103
103
this . $logger . trace ( `Error during auto-generated files handling. ${ ( error && error . message ) || error } ` ) ;
104
104
}
105
105
106
+ await this . migrateOldAndroidAppResources ( projectData ) ;
107
+
106
108
try {
107
109
await this . cleanUpProject ( projectData ) ;
108
110
await this . migrateDependencies ( projectData ) ;
@@ -112,6 +114,14 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
112
114
}
113
115
}
114
116
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
+
115
125
public async shouldMigrate ( { projectDir } : IProjectDir ) : Promise < boolean > {
116
126
const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
117
127
@@ -123,7 +133,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
123
133
return true ;
124
134
}
125
135
126
- if ( hasDependency && dependency . replaceWith ) {
136
+ if ( hasDependency && ( dependency . replaceWith || dependency . shouldRemove ) ) {
127
137
return true ;
128
138
}
129
139
@@ -134,6 +144,10 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
134
144
if ( ! hasDependency && dependency . shouldAddIfMissing ) {
135
145
return true ;
136
146
}
147
+
148
+ if ( ! this . $androidResourcesMigrationService . hasMigrated ( projectData . getAppResourcesDirectoryPath ( ) ) ) {
149
+ return true ;
150
+ }
137
151
}
138
152
139
153
for ( const platform in this . $devicePlatformsConstants ) {
@@ -146,6 +160,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
146
160
147
161
private async cleanUpProject ( projectData : IProjectData ) : Promise < void > {
148
162
this . $logger . info ( "Clean old project artefacts." ) ;
163
+ this . $projectDataService . removeNSConfigProperty ( projectData . projectDir , "useLegacyWorkflow" ) ;
149
164
this . $fs . deleteDirectory ( path . join ( projectData . projectDir , constants . HOOKS_DIR_NAME ) ) ;
150
165
this . $fs . deleteDirectory ( path . join ( projectData . projectDir , constants . PLATFORMS_DIR_NAME ) ) ;
151
166
this . $fs . deleteDirectory ( path . join ( projectData . projectDir , constants . NODE_MODULES_FOLDER_NAME ) ) ;
@@ -244,15 +259,21 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
244
259
245
260
private async migrateDependency ( dependency : IMigrationDependency , projectData : IProjectData ) : Promise < void > {
246
261
const hasDependency = this . hasDependency ( dependency , projectData ) ;
262
+ if ( dependency . warning ) {
263
+ this . $logger . warn ( dependency . warning ) ;
264
+ }
247
265
248
- if ( hasDependency && dependency . replaceWith ) {
266
+ if ( hasDependency && ( dependency . replaceWith || dependency . shouldRemove ) ) {
249
267
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 ) ;
253
275
}
254
- this . $logger . info ( `Replacing '${ dependency . packageName } ' with '${ replacementDep . packageName } '.` ) ;
255
- this . $pluginsService . addToPackageJson ( replacementDep . packageName , replacementDep . verifiedVersion , replacementDep . isDev , projectData . projectDir ) ;
276
+
256
277
return ;
257
278
}
258
279
0 commit comments