From 826f91a5cc32a5e65b717634df47f7c65b537098 Mon Sep 17 00:00:00 2001 From: dominikg Date: Sun, 18 Aug 2024 10:44:43 +0200 Subject: [PATCH 1/3] chore(deps): use vite-plugin-svelte 4 in svelte5 template of create-svelte --- .changeset/thick-spies-hope.md | 5 +++++ packages/create-svelte/shared/+svelte5/package.json | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/thick-spies-hope.md diff --git a/.changeset/thick-spies-hope.md b/.changeset/thick-spies-hope.md new file mode 100644 index 000000000000..7c04a5fbdf60 --- /dev/null +++ b/.changeset/thick-spies-hope.md @@ -0,0 +1,5 @@ +--- +'create-svelte': patch +--- + +fix(svelte5): use vite-plugin-svelte prerelease with improved svelte5 support diff --git a/packages/create-svelte/shared/+svelte5/package.json b/packages/create-svelte/shared/+svelte5/package.json index 5d2d0a1e9157..1fee312f2cca 100644 --- a/packages/create-svelte/shared/+svelte5/package.json +++ b/packages/create-svelte/shared/+svelte5/package.json @@ -1,5 +1,6 @@ { "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^4.0.0-next.6", "svelte": "^5.0.0-next.1" } } From 131f45f4b74e30df30450c4d2e1e4a87f44b7ff0 Mon Sep 17 00:00:00 2001 From: dominikg Date: Sun, 18 Aug 2024 11:02:12 +0200 Subject: [PATCH 2/3] test(create-svelte): add svelte5 to options tested with create-svelte --- packages/create-svelte/test/check.js | 63 +++++++++++++++------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/packages/create-svelte/test/check.js b/packages/create-svelte/test/check.js index 65b5eeaa1a32..3c30ff6db08f 100644 --- a/packages/create-svelte/test/check.js +++ b/packages/create-svelte/test/check.js @@ -106,36 +106,39 @@ for (const template of templates) { if (template[0] === '.') continue; for (const types of /** @type {const} */ (['checkjs', 'typescript'])) { - const cwd = path.join(test_workspace_dir, `${template}-${types}`); - fs.rmSync(cwd, { recursive: true, force: true }); - - create(cwd, { - name: `create-svelte-test-${template}-${types}`, - template, - types, - prettier: true, - eslint: true, - playwright: false, - vitest: false, - svelte5: false - }); - - const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf-8')); - patch_package_json(pkg); - - fs.writeFileSync(path.join(cwd, 'package.json'), JSON.stringify(pkg, null, '\t') + '\n'); - - // run provided scripts that are non-blocking. All of them should exit with 0 - // package script requires lib dir - // TODO: lint should run before format - const scripts_to_test = ['format', 'lint', 'check', 'build', 'package'].filter( - (s) => s in pkg.scripts - ); - - for (const script of scripts_to_test) { - const tests = script_test_map.get(script) ?? []; - tests.push([`${template}-${types}`, () => exec_async(`pnpm ${script}`, { cwd })]); - script_test_map.set(script, tests); + for (const svelteVersion of /** @type {const} */ (['svelte4', 'svelte5'])) { + const test_id = `${template}-${types}-${svelteVersion}`; + const cwd = path.join(test_workspace_dir, test_id); + fs.rmSync(cwd, { recursive: true, force: true }); + + create(cwd, { + name: `create-svelte-test-${test_id}`, + template, + types, + prettier: true, + eslint: true, + playwright: false, + vitest: false, + svelte5: svelteVersion === 'svelte5' + }); + + const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf-8')); + patch_package_json(pkg); + + fs.writeFileSync(path.join(cwd, 'package.json'), JSON.stringify(pkg, null, '\t') + '\n'); + + // run provided scripts that are non-blocking. All of them should exit with 0 + // package script requires lib dir + // TODO: lint should run before format + const scripts_to_test = ['format', 'lint', 'check', 'build', 'package'].filter( + (s) => s in pkg.scripts + ); + + for (const script of scripts_to_test) { + const tests = script_test_map.get(script) ?? []; + tests.push([test_id, () => exec_async(`pnpm ${script}`, { cwd })]); + script_test_map.set(script, tests); + } } } } From c7d3ea7ccbdcbc244fde342866bd8853866696ba Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sun, 18 Aug 2024 07:50:02 -0700 Subject: [PATCH 3/3] Update .changeset/thick-spies-hope.md --- .changeset/thick-spies-hope.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/thick-spies-hope.md b/.changeset/thick-spies-hope.md index 7c04a5fbdf60..17c879350ea0 100644 --- a/.changeset/thick-spies-hope.md +++ b/.changeset/thick-spies-hope.md @@ -2,4 +2,4 @@ 'create-svelte': patch --- -fix(svelte5): use vite-plugin-svelte prerelease with improved svelte5 support +fix: use `vite-plugin-svelte` v4 pre-release when Svelte 5 is chosen