Skip to content

Commit 773e6e8

Browse files
authored
chore: tidy up playground (#14290)
* tidy up playground * more * gitignore * update README
1 parent c44ddbc commit 773e6e8

File tree

15 files changed

+10
-154
lines changed

15 files changed

+10
-154
lines changed

playgrounds/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
You may use these playgrounds to experiment with your changes to SvelteKit. Make sure you don't check in any changes to this folder.
1+
You may use these playgrounds to experiment with your changes to SvelteKit. Make sure you don't check in any changes to the files in `src` that aren't already gitignored. The easiest way to do this is to run the following from the root of the project:
2+
3+
```bash
4+
git update-index --skip-worktree playgrounds/basic/src/routes/+layout.svelte
5+
git update-index --skip-worktree playgrounds/basic/src/routes/+page.svelte
6+
```
27

38
Alternatively, clone the [kit-sandbox](https://github.com/sveltejs/kit-sandbox) repo next to the `kit` repo, and use `pnpm link` to link your dependencies. This way you can have multiple different sandbox projects in different branches, and you never need to worry about accidentally committing throwaway code.

playgrounds/basic/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
# repeating them here as a faux .prettierignore
33
/.svelte-kit/
44
/dist/
5-
/build
5+
/build
6+
/src/lib
7+
/src/routes

playgrounds/basic/src/lib/todos.remote.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
<script>
2-
import { page, navigating } from '$app/state';
3-
42
let { children } = $props();
53
</script>
64

7-
<nav>
8-
<a href="/">/</a>
9-
<a href="/a">/a</a>
10-
<a href="/b">/b</a>
11-
<a href="/c">/c</a>
12-
<a href="/d">/d</a>
13-
<a href="/e">/e</a>
14-
</nav>
15-
165
{@render children()}
Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,4 @@
11
<script lang="ts">
2-
import { add_todo, add_todo_form, get_todos } from '$lib/todos.remote';
3-
4-
const todos = $derived(get_todos());
52
</script>
63

7-
<h1>Welcome to SvelteKit</h1>
8-
9-
<p><a href="images">images</a></p>
10-
<p><a href="force-error">force error</a></p>
11-
12-
<h2>Todos</h2>
13-
14-
<h3>todo via JS</h3>
15-
<input
16-
placeholder="Add Todo"
17-
onkeyup={async (e) => {
18-
if (e.key === 'Enter') {
19-
const value = (e.target as HTMLInputElement).value;
20-
await add_todo(value).updates(
21-
todos.withOverride((todos) => {
22-
return [...todos, { text: value }];
23-
})
24-
);
25-
}
26-
}}
27-
/>
28-
29-
<h3>todo via form</h3>
30-
<form {...add_todo_form}>
31-
<input name="text" placeholder="Add Todo" />
32-
<button type="submit">add</button>
33-
</form>
34-
35-
<ul>
36-
{#await todos then todos}
37-
{#each todos as todo}
38-
<li>{todo.text}</li>
39-
{/each}
40-
{/await}
41-
</ul>
42-
43-
<!-- with the await feature you could also do
44-
<ul>
45-
{#each await todos as todo}
46-
<li>{todo.text}</li>
47-
{/each}
48-
</ul>
49-
and it would be reactive
50-
-->
4+
<h1>hello!</h1>

playgrounds/basic/src/routes/+server.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

playgrounds/basic/src/routes/[slug]/+page.svelte

Lines changed: 0 additions & 5 deletions
This file was deleted.

playgrounds/basic/src/routes/app-state/+page.svelte

Lines changed: 0 additions & 5 deletions
This file was deleted.

playgrounds/basic/src/routes/force-error/+page.server.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

playgrounds/basic/src/routes/force-error/+page.svelte

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)