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

feat: add option to try out Svelte 5 beta #11026

Merged
merged 5 commits into from
Nov 13, 2023
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/shy-islands-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': minor
---

feat: add option to try out Svelte 5 beta
7 changes: 6 additions & 1 deletion packages/create-svelte/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ const options = await p.group(
{
value: 'vitest',
label: 'Add Vitest for unit testing'
},
{
value: 'svelte5',
label: 'Try out Svelte 5 beta'
}
]
})
Expand All @@ -111,7 +115,8 @@ await create(cwd, {
prettier: options.features.includes('prettier'),
eslint: options.features.includes('eslint'),
playwright: options.features.includes('playwright'),
vitest: options.features.includes('vitest')
vitest: options.features.includes('vitest'),
svelte5: options.features.includes('svelte5')
});

p.outro('Your project is ready!');
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function matches_condition(condition, options) {
if (condition === 'typescript' || condition === 'checkjs') {
return options.types === condition;
}
return options[condition];
return !!options[condition];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/scripts/build-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async function generate_shared() {
if (file.startsWith('+') || file.startsWith('-')) {
const [conditions, ...rest] = file.split(path.sep);

const pattern = /([+-])([a-z]+)/g;
const pattern = /([+-])([a-z0-9]+)/g;
let match;
while ((match = pattern.exec(conditions))) {
const set = match[1] === '+' ? include : exclude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ await create(repo, {
types: 'checkjs',
prettier: true,
playwright: false,
vitest: false
vitest: false,
svelte5: false
});

// Remove the Sverdle from the template because it doesn't work within Stackblitz (cookies not set)
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/shared/+checkjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
},
"devDependencies": {
"typescript": "^5.0.0",
"svelte-check": "^3.4.3"
"svelte-check": "^3.6.0"
}
}
5 changes: 5 additions & 0 deletions packages/create-svelte/shared/+svelte5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"svelte": "^5.0.0-next.1"
}
}
2 changes: 1 addition & 1 deletion packages/create-svelte/shared/+typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"devDependencies": {
"typescript": "^5.0.0",
"tslib": "^2.4.1",
"svelte-check": "^3.4.3"
"svelte-check": "^3.6.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@fontsource/fira-mono": "^4.5.10",
"@neoconfetti/svelte": "^1.0.0",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/kit": "^1.27.4",
"svelte": "^4.0.5",
"vite": "^4.4.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/kit": "^1.27.4",
"svelte": "^4.0.5",
"vite": "^4.4.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/kit": "^1.27.4",
"@sveltejs/package": "^2.0.0",
"publint": "^0.1.9",
"svelte": "^4.0.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/create-svelte/test/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ for (const template of templates) {
prettier: true,
eslint: true,
playwright: false,
vitest: false
vitest: false,
svelte5: false
});

const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf-8'));
Expand Down
4 changes: 3 additions & 1 deletion packages/create-svelte/types/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type Options = {
eslint: boolean;
playwright: boolean;
vitest: boolean;
svelte5?: boolean; // optional to not introduce a breaking change to the `create` API
};

export type File = {
Expand All @@ -22,7 +23,8 @@ export type Condition =
| 'vitest'
| 'skeleton'
| 'default'
| 'skeletonlib';
| 'skeletonlib'
| 'svelte5';

export type Common = {
files: Array<{
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- fix: generate `__data.json` for prerendered pages when SSR is turned off ([#10988](https://github.com/sveltejs/kit/pull/10988))

- chore: cleanup ([#11002](https://github.com/sveltejs/kit/pull/11002))
- chore: add experimental compatibility for Svelte 5 ([#11002](https://github.com/sveltejs/kit/pull/11002))

## 1.27.3

Expand Down
Loading