diff --git a/lib/controllers/migrate-controller.ts b/lib/controllers/migrate-controller.ts index 899afff4c8..e321412724 100644 --- a/lib/controllers/migrate-controller.ts +++ b/lib/controllers/migrate-controller.ts @@ -211,6 +211,30 @@ export class MigrateController }, migrateAction: this.migrateNativeScriptAngular.bind(this), }, + { + packageName: "svelte-native", + verifiedVersion: "0.9.4", + shouldMigrateAction: async ( + projectData: IProjectData, + allowInvalidVersions: boolean + ) => { + const dependency = { + packageName: "svelte-native", + verifiedVersion: "0.9.0", // minimum version required - anything less will need a migration + isDev: false, + }; + const result = + this.hasDependency(dependency, projectData) && + (await this.shouldMigrateDependencyVersion( + dependency, + projectData, + allowInvalidVersions + )); + + return result; + }, + migrateAction: this.migrateNativeScriptSvelte.bind(this), + }, { packageName: "@nativescript/unit-test-runner", verifiedVersion: "1.0.0", @@ -1285,6 +1309,48 @@ export class MigrateController return dependencies; } + private async migrateNativeScriptSvelte(): Promise { + const dependencies: IMigrationDependency[] = [ + { + packageName: "svelte-native-nativescript-ui", + verifiedVersion: "0.9.0", + shouldUseExactVersion: true, + isDev: true, + shouldAddIfMissing: true, + }, + { + packageName: "svelte-native-preprocessor", + verifiedVersion: "0.2.0", + shouldUseExactVersion: true, + isDev: true, + shouldAddIfMissing: true, + }, + { + packageName: "svelte-loader", + shouldRemove: true, + }, + { + packageName: "svelte-loader-hot", + verifiedVersion: "0.3.1", + shouldUseExactVersion: true, + isDev: true, + shouldAddIfMissing: true, + }, + { + packageName: "svelte", + shouldRemove: true, + }, + { + packageName: "svelte", + verifiedVersion: "3.24.1", + shouldUseExactVersion: true, + isDev: true, + }, + ]; + + return dependencies; + } + private async migrateWebpack(): Promise { const scopedWebpackDeps = [ "@angular-devkit/core",