@@ -47,13 +47,6 @@ import { SupportedConfigValues } from "../tools/config-manipulation/config-trans
47
47
export class MigrateController
48
48
extends UpdateControllerBase
49
49
implements IMigrateController {
50
- // private static COMMON_MIGRATE_MESSAGE =
51
- // "not affect the codebase of the application and you might need to do additional changes manually – for more information, refer to the instructions in the following blog post: https://www.nativescript.org/blog/nativescript-6.0-application-migration";
52
- // private static UNABLE_TO_MIGRATE_APP_ERROR = `The current application is not compatible with NativeScript CLI 7.0.
53
- // Use the \`ns migrate\` command to migrate the app dependencies to a form compatible with NativeScript 7.0.
54
- // Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
55
- // private static MIGRATE_FINISH_MESSAGE = `The \`tns migrate\` command does ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
56
-
57
50
constructor (
58
51
protected $fs : IFileSystem ,
59
52
protected $platformCommandHelper : IPlatformCommandHelper ,
@@ -119,13 +112,13 @@ export class MigrateController
119
112
120
113
private migrationDependencies : IMigrationDependency [ ] = [
121
114
{
122
- packageName : constants . SCOPED_TNS_CORE_MODULES ,
115
+ packageName : "@nativescript/core" ,
123
116
minVersion : "6.5.0" ,
124
117
desiredVersion : "~8.1.0" ,
125
118
shouldAddIfMissing : true ,
126
119
} ,
127
120
{
128
- packageName : constants . TNS_CORE_MODULES_NAME ,
121
+ packageName : "tns-core-modules" ,
129
122
shouldRemove : true ,
130
123
} ,
131
124
{
@@ -141,12 +134,12 @@ export class MigrateController
141
134
isDev : true ,
142
135
} ,
143
136
{
144
- packageName : constants . TNS_CORE_MODULES_WIDGETS_NAME ,
137
+ packageName : "tns-core-modules-widgets" ,
145
138
shouldRemove : true ,
146
139
} ,
147
140
{
148
141
packageName : "nativescript-dev-webpack" ,
149
- replaceWith : constants . WEBPACK_PLUGIN_NAME ,
142
+ replaceWith : "@nativescript/webpack" ,
150
143
shouldRemove : true ,
151
144
isDev : true ,
152
145
async shouldMigrateAction ( ) {
@@ -155,7 +148,7 @@ export class MigrateController
155
148
migrateAction : this . migrateWebpack . bind ( this ) ,
156
149
} ,
157
150
{
158
- packageName : constants . WEBPACK_PLUGIN_NAME ,
151
+ packageName : "@nativescript/webpack" ,
159
152
minVersion : "3.0.0" ,
160
153
desiredVersion : "~5.0.0" ,
161
154
shouldAddIfMissing : true ,
@@ -190,7 +183,7 @@ export class MigrateController
190
183
{
191
184
packageName : "@nativescript/angular" ,
192
185
minVersion : "10.0.0" ,
193
- desiredVersion : "~12.0.6" , // :::~12.1.0
186
+ desiredVersion : "~12.2.0" ,
194
187
async shouldMigrateAction (
195
188
dependency : IMigrationDependency ,
196
189
projectData : IProjectData ,
@@ -304,19 +297,6 @@ export class MigrateController
304
297
} ,
305
298
] ;
306
299
307
- // get verifiedPlatformVersions(): IDictionary<IDependencyVersion> {
308
- // return {
309
- // [this.$devicePlatformsConstants.Android.toLowerCase()]: {
310
- // minVersion: "6.5.3",
311
- // desiredVersion: "~8.1.0", // :::8.1.0
312
- // },
313
- // [this.$devicePlatformsConstants.iOS.toLowerCase()]: {
314
- // minVersion: "6.5.4",
315
- // desiredVersion: "~8.1.0", // :::8.1.0
316
- // },
317
- // };
318
- // }
319
-
320
300
public async shouldMigrate ( {
321
301
projectDir,
322
302
platforms,
@@ -464,28 +444,9 @@ export class MigrateController
464
444
465
445
await this . migrateWebpack5 ( projectDir , projectData ) ;
466
446
467
- // npx -p @nativescript/webpack@alpha nativescript-webpack init
468
-
469
447
// run @nativescript /eslint over codebase
470
- // this.spinner.start("Checking project code...");
471
-
472
448
await this . runESLint ( projectDir ) ;
473
449
474
- // this.spinner.succeed("Updated tsconfig.json");
475
-
476
- // add latest runtimes (if they were specified in the nativescript key)
477
- // this.spinner.start("Updating runtimes");
478
- //
479
- // await wait(2000);
480
- // this.spinner.clear();
481
- // this.$logger.info(
482
- // ` - ${"@nativescript /android".yellow } ${"v7.0.0".green} has been added`
483
- // );
484
- // this.spinner.render();
485
- //
486
- // this.spinner.text = "Runtimes have been updated";
487
- // this.spinner.succeed();
488
-
489
450
this . spinner . succeed ( "Migration complete." ) ;
490
451
491
452
this . $logger . info ( "" ) ;
@@ -503,75 +464,6 @@ export class MigrateController
503
464
// restore all files - or perhaps let the user sort it out
504
465
// or ns migrate restore - to restore from pre-migration backup
505
466
// for some known cases, print suggestions perhaps
506
- //
507
- // return;
508
- //
509
- // this.spinner = this.$terminalSpinnerService.createSpinner();
510
- //
511
- // this.spinner.start("Migrating project...");
512
- // // const projectData = this.$projectDataService.getProjectData(projectDir);
513
- // const backupDir = path.join(projectDir, MigrateController.backupFolderName);
514
- //
515
- // try {
516
- // this.spinner.start("Backup project configuration.");
517
- // this.backup(
518
- // [
519
- // ...MigrateController.pathsToBackup,
520
- // path.join(projectData.getAppDirectoryRelativePath(), "package.json"),
521
- // ],
522
- // backupDir,
523
- // projectData.projectDir
524
- // );
525
- // this.spinner.text = "Backup project configuration complete.";
526
- // this.spinner.succeed();
527
- // } catch (error) {
528
- // // this.spinner.text = MigrateController.backupFailMessage;
529
- // this.spinner.fail();
530
- // // this.$logger.error(MigrateController.backupFailMessage);
531
- // await this.$projectCleanupService.cleanPath(backupDir);
532
- // // this.$fs.deleteDirectory(backupDir);
533
- // return;
534
- // }
535
- //
536
- // try {
537
- // this.spinner.start("Clean auto-generated files.");
538
- // this.handleAutoGeneratedFiles(backupDir, projectData);
539
- // this.spinner.text = "Clean auto-generated files complete.";
540
- // this.spinner.succeed();
541
- // } catch (error) {
542
- // this.$logger.trace(
543
- // `Error during auto-generated files handling. ${
544
- // (error && error.message) || error
545
- // }`
546
- // );
547
- // }
548
- //
549
- // // await this.migrateOldAndroidAppResources(projectData, backupDir);
550
- //
551
- // try {
552
- // await this.cleanUpProject(projectData);
553
- // // await this.migrateConfigs(projectData);
554
- // await this.migrateDependencies(
555
- // projectData,
556
- // platforms,
557
- // loose
558
- // );
559
- // } catch (error) {
560
- // const backupFolders = MigrateController.pathsToBackup;
561
- // const embeddedPackagePath = path.join(
562
- // projectData.getAppDirectoryRelativePath(),
563
- // "package.json"
564
- // );
565
- // backupFolders.push(embeddedPackagePath);
566
- // this.restoreBackup(backupFolders, backupDir, projectData.projectDir);
567
- // this.spinner.fail();
568
- // // this.$errors.fail(
569
- // // `${MigrateController.migrateFailMessage} The error is: ${error}`
570
- // // );
571
- // }
572
- //
573
- // this.spinner.stop();
574
- // // this.spinner.info(MigrateController.MIGRATE_FINISH_MESSAGE);
575
467
}
576
468
577
469
private async _shouldMigrate ( {
@@ -649,50 +541,6 @@ export class MigrateController
649
541
}
650
542
}
651
543
652
- // for (let platform of platforms) {
653
- // platform = platform?.toLowerCase();
654
-
655
- // if (
656
- // !this.$platformValidationService.isValidPlatform(platform, projectData)
657
- // ) {
658
- // continue;
659
- // }
660
-
661
- // const hasRuntimeDependency = this.hasRuntimeDependency({
662
- // platform,
663
- // projectData,
664
- // });
665
-
666
- // if (!hasRuntimeDependency) {
667
- // continue;
668
- // }
669
-
670
- // const verifiedPlatformVersion =
671
- // this.verifiedPlatformVersions[platform.toLowerCase()];
672
- // const shouldUpdateRuntime = await this.shouldUpdateRuntimeVersion(
673
- // verifiedPlatformVersion,
674
- // platform,
675
- // projectData,
676
- // loose
677
- // );
678
-
679
- // if (!shouldUpdateRuntime) {
680
- // continue;
681
- // }
682
-
683
- // this.$logger.trace(
684
- // `${shouldMigrateCommonMessage}Platform '${platform}' should be updated.`
685
- // );
686
- // if (loose) {
687
- // this.$logger.warn(
688
- // `Platform '${platform}' should be updated. The minimum version supported is ${verifiedPlatformVersion.minVersion}`
689
- // );
690
- // continue;
691
- // }
692
-
693
- // return true;
694
- // }
695
-
696
544
return false ;
697
545
}
698
546
@@ -1048,48 +896,6 @@ export class MigrateController
1048
896
1049
897
await this . migrateDependency ( dependency , projectData , loose ) ;
1050
898
}
1051
-
1052
- // for (const platform of platforms) {
1053
- // const lowercasePlatform = platform.toLowerCase();
1054
- // const hasRuntimeDependency = this.hasRuntimeDependency({
1055
- // platform,
1056
- // projectData,
1057
- // });
1058
-
1059
- // if (!hasRuntimeDependency) {
1060
- // continue;
1061
- // }
1062
-
1063
- // const shouldUpdate = await this.shouldUpdateRuntimeVersion(
1064
- // this.verifiedPlatformVersions[lowercasePlatform],
1065
- // platform,
1066
- // projectData,
1067
- // loose
1068
- // );
1069
-
1070
- // if (!shouldUpdate) {
1071
- // continue;
1072
- // }
1073
-
1074
- // const verifiedPlatformVersion =
1075
- // this.verifiedPlatformVersions[lowercasePlatform];
1076
- // const platformData = this.$platformsDataService.getPlatformData(
1077
- // lowercasePlatform,
1078
- // projectData
1079
- // );
1080
-
1081
- // this.spinner.info(
1082
- // `Updating ${platform} platform to version ${verifiedPlatformVersion.desiredVersion.green}.`
1083
- // );
1084
-
1085
- // await this.$addPlatformService.setPlatformVersion(
1086
- // platformData,
1087
- // projectData,
1088
- // verifiedPlatformVersion.desiredVersion
1089
- // );
1090
-
1091
- // this.spinner.succeed();
1092
- // }
1093
899
}
1094
900
1095
901
private async migrateDependency (
@@ -1406,10 +1212,6 @@ export class MigrateController
1406
1212
const minVersion = "10.0.0" ;
1407
1213
const desiredVersion = "~12.2.5" ;
1408
1214
1409
- /*
1410
- "@angular/router": "~11.2.7",
1411
- */
1412
-
1413
1215
const dependencies : IMigrationDependency [ ] = [
1414
1216
{
1415
1217
packageName : "@angular/animations" ,
0 commit comments