@@ -47,13 +47,6 @@ import { SupportedConfigValues } from "../tools/config-manipulation/config-trans
4747export class MigrateController
4848 extends UpdateControllerBase
4949 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-
5750 constructor (
5851 protected $fs : IFileSystem ,
5952 protected $platformCommandHelper : IPlatformCommandHelper ,
@@ -119,13 +112,13 @@ export class MigrateController
119112
120113 private migrationDependencies : IMigrationDependency [ ] = [
121114 {
122- packageName : constants . SCOPED_TNS_CORE_MODULES ,
115+ packageName : "@nativescript/core" ,
123116 minVersion : "6.5.0" ,
124117 desiredVersion : "~8.1.0" ,
125118 shouldAddIfMissing : true ,
126119 } ,
127120 {
128- packageName : constants . TNS_CORE_MODULES_NAME ,
121+ packageName : "tns-core-modules" ,
129122 shouldRemove : true ,
130123 } ,
131124 {
@@ -141,12 +134,12 @@ export class MigrateController
141134 isDev : true ,
142135 } ,
143136 {
144- packageName : constants . TNS_CORE_MODULES_WIDGETS_NAME ,
137+ packageName : "tns-core-modules-widgets" ,
145138 shouldRemove : true ,
146139 } ,
147140 {
148141 packageName : "nativescript-dev-webpack" ,
149- replaceWith : constants . WEBPACK_PLUGIN_NAME ,
142+ replaceWith : "@nativescript/webpack" ,
150143 shouldRemove : true ,
151144 isDev : true ,
152145 async shouldMigrateAction ( ) {
@@ -155,7 +148,7 @@ export class MigrateController
155148 migrateAction : this . migrateWebpack . bind ( this ) ,
156149 } ,
157150 {
158- packageName : constants . WEBPACK_PLUGIN_NAME ,
151+ packageName : "@nativescript/webpack" ,
159152 minVersion : "3.0.0" ,
160153 desiredVersion : "~5.0.0" ,
161154 shouldAddIfMissing : true ,
@@ -190,7 +183,7 @@ export class MigrateController
190183 {
191184 packageName : "@nativescript/angular" ,
192185 minVersion : "10.0.0" ,
193- desiredVersion : "~12.0.6" , // :::~12.1.0
186+ desiredVersion : "~12.2.0" ,
194187 async shouldMigrateAction (
195188 dependency : IMigrationDependency ,
196189 projectData : IProjectData ,
@@ -304,19 +297,6 @@ export class MigrateController
304297 } ,
305298 ] ;
306299
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-
320300 public async shouldMigrate ( {
321301 projectDir,
322302 platforms,
@@ -464,28 +444,9 @@ export class MigrateController
464444
465445 await this . migrateWebpack5 ( projectDir , projectData ) ;
466446
467- // npx -p @nativescript/webpack@alpha nativescript-webpack init
468-
469447 // run @nativescript /eslint over codebase
470- // this.spinner.start("Checking project code...");
471-
472448 await this . runESLint ( projectDir ) ;
473449
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-
489450 this . spinner . succeed ( "Migration complete." ) ;
490451
491452 this . $logger . info ( "" ) ;
@@ -503,75 +464,6 @@ export class MigrateController
503464 // restore all files - or perhaps let the user sort it out
504465 // or ns migrate restore - to restore from pre-migration backup
505466 // 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);
575467 }
576468
577469 private async _shouldMigrate ( {
@@ -649,50 +541,6 @@ export class MigrateController
649541 }
650542 }
651543
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-
696544 return false ;
697545 }
698546
@@ -1048,48 +896,6 @@ export class MigrateController
1048896
1049897 await this . migrateDependency ( dependency , projectData , loose ) ;
1050898 }
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- // }
1093899 }
1094900
1095901 private async migrateDependency (
@@ -1406,10 +1212,6 @@ export class MigrateController
14061212 const minVersion = "10.0.0" ;
14071213 const desiredVersion = "~12.2.5" ;
14081214
1409- /*
1410- "@angular/router": "~11.2.7",
1411- */
1412-
14131215 const dependencies : IMigrationDependency [ ] = [
14141216 {
14151217 packageName : "@angular/animations" ,
0 commit comments