Skip to content

Commit 9fcee7f

Browse files
dominikgbenmccann
andauthored
chore(deps): use vite-plugin-svelte 4 in svelte5 template of create-svelte (#12586)
* chore(deps): use vite-plugin-svelte 4 in svelte5 template of create-svelte * test(create-svelte): add svelte5 to options tested with create-svelte * Update .changeset/thick-spies-hope.md --------- Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
1 parent 726b89f commit 9fcee7f

3 files changed

Lines changed: 39 additions & 30 deletions

File tree

.changeset/thick-spies-hope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-svelte': patch
3+
---
4+
5+
fix: use `vite-plugin-svelte` v4 pre-release when Svelte 5 is chosen
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"devDependencies": {
3+
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
34
"svelte": "^5.0.0-next.1"
45
}
56
}

packages/create-svelte/test/check.js

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -106,36 +106,39 @@ for (const template of templates) {
106106
if (template[0] === '.') continue;
107107

108108
for (const types of /** @type {const} */ (['checkjs', 'typescript'])) {
109-
const cwd = path.join(test_workspace_dir, `${template}-${types}`);
110-
fs.rmSync(cwd, { recursive: true, force: true });
111-
112-
create(cwd, {
113-
name: `create-svelte-test-${template}-${types}`,
114-
template,
115-
types,
116-
prettier: true,
117-
eslint: true,
118-
playwright: false,
119-
vitest: false,
120-
svelte5: false
121-
});
122-
123-
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf-8'));
124-
patch_package_json(pkg);
125-
126-
fs.writeFileSync(path.join(cwd, 'package.json'), JSON.stringify(pkg, null, '\t') + '\n');
127-
128-
// run provided scripts that are non-blocking. All of them should exit with 0
129-
// package script requires lib dir
130-
// TODO: lint should run before format
131-
const scripts_to_test = ['format', 'lint', 'check', 'build', 'package'].filter(
132-
(s) => s in pkg.scripts
133-
);
134-
135-
for (const script of scripts_to_test) {
136-
const tests = script_test_map.get(script) ?? [];
137-
tests.push([`${template}-${types}`, () => exec_async(`pnpm ${script}`, { cwd })]);
138-
script_test_map.set(script, tests);
109+
for (const svelteVersion of /** @type {const} */ (['svelte4', 'svelte5'])) {
110+
const test_id = `${template}-${types}-${svelteVersion}`;
111+
const cwd = path.join(test_workspace_dir, test_id);
112+
fs.rmSync(cwd, { recursive: true, force: true });
113+
114+
create(cwd, {
115+
name: `create-svelte-test-${test_id}`,
116+
template,
117+
types,
118+
prettier: true,
119+
eslint: true,
120+
playwright: false,
121+
vitest: false,
122+
svelte5: svelteVersion === 'svelte5'
123+
});
124+
125+
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf-8'));
126+
patch_package_json(pkg);
127+
128+
fs.writeFileSync(path.join(cwd, 'package.json'), JSON.stringify(pkg, null, '\t') + '\n');
129+
130+
// run provided scripts that are non-blocking. All of them should exit with 0
131+
// package script requires lib dir
132+
// TODO: lint should run before format
133+
const scripts_to_test = ['format', 'lint', 'check', 'build', 'package'].filter(
134+
(s) => s in pkg.scripts
135+
);
136+
137+
for (const script of scripts_to_test) {
138+
const tests = script_test_map.get(script) ?? [];
139+
tests.push([test_id, () => exec_async(`pnpm ${script}`, { cwd })]);
140+
script_test_map.set(script, tests);
141+
}
139142
}
140143
}
141144
}

0 commit comments

Comments
 (0)