Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): use vite-plugin-svelte 4 in svelte5 template of create-svelte #12586

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thick-spies-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

fix: use `vite-plugin-svelte` v4 pre-release when Svelte 5 is chosen
1 change: 1 addition & 0 deletions packages/create-svelte/shared/+svelte5/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
"svelte": "^5.0.0-next.1"
}
}
63 changes: 33 additions & 30 deletions packages/create-svelte/test/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down
Loading