From 92d85a82d9b1e095a25f49159df6bc84238282b9 Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Sun, 20 Oct 2024 00:12:25 +0200 Subject: [PATCH] fix: migrate `svelte` and `vite-plugin-svelte` to latest (#12838) --- .changeset/eighty-starfishes-rule.md | 5 +++++ packages/migrate/migrations/svelte-5/index.js | 3 +-- packages/migrate/migrations/svelte-5/migrate.js | 4 ++-- packages/migrate/migrations/svelte-5/migrate.spec.js | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 .changeset/eighty-starfishes-rule.md diff --git a/.changeset/eighty-starfishes-rule.md b/.changeset/eighty-starfishes-rule.md new file mode 100644 index 000000000000..fbe2fe9284d9 --- /dev/null +++ b/.changeset/eighty-starfishes-rule.md @@ -0,0 +1,5 @@ +--- +'svelte-migrate': patch +--- + +fix: migrate `svelte` and `vite-plugin-svelte` to latest diff --git a/packages/migrate/migrations/svelte-5/index.js b/packages/migrate/migrations/svelte-5/index.js index c3625e151548..6da406359d4c 100644 --- a/packages/migrate/migrations/svelte-5/index.js +++ b/packages/migrate/migrations/svelte-5/index.js @@ -90,8 +90,7 @@ export async function migrate() { ({ migrate } = await import_from_cwd('svelte/compiler')); if (!migrate) throw new Error('found Svelte 4'); } catch { - // TODO replace with svelte@5 once it's released - execSync('npm install svelte@next --no-save', { + execSync('npm install svelte@^5.0.0 --no-save', { stdio: 'inherit', cwd: dirname(fileURLToPath(import.meta.url)) }); diff --git a/packages/migrate/migrations/svelte-5/migrate.js b/packages/migrate/migrations/svelte-5/migrate.js index dd7766d3e8c5..f9f510b5b89e 100644 --- a/packages/migrate/migrations/svelte-5/migrate.js +++ b/packages/migrate/migrations/svelte-5/migrate.js @@ -14,12 +14,12 @@ export function update_pkg_json() { */ export function update_pkg_json_content(content) { return update_pkg(content, [ - ['svelte', '^5.0.0-next.0'], + ['svelte', '^5.0.0'], ['svelte-check', '^4.0.0'], ['svelte-preprocess', '^6.0.0'], ['@sveltejs/enhanced-img', '^0.3.6'], ['@sveltejs/kit', '^2.5.27'], - ['@sveltejs/vite-plugin-svelte', '^4.0.0-next.0'], + ['@sveltejs/vite-plugin-svelte', '^4.0.0'], [ 'svelte-loader', '^3.2.3', diff --git a/packages/migrate/migrations/svelte-5/migrate.spec.js b/packages/migrate/migrations/svelte-5/migrate.spec.js index 128b8f654626..a623230d7eae 100644 --- a/packages/migrate/migrations/svelte-5/migrate.spec.js +++ b/packages/migrate/migrations/svelte-5/migrate.spec.js @@ -93,7 +93,7 @@ test('Update package.json', () => { "name": "svelte-app", "version": "1.0.0", "devDependencies": { - "svelte": "^5.0.0-next.0", + "svelte": "^5.0.0", "svelte-check": "^4.0.0", "svelte-preprocess": "^6.0.0", "svelte-eslint-parser": "^0.42.0"