bosia 0.1.6 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/src/cli/add.ts +29 -75
  3. package/src/cli/create.ts +32 -5
  4. package/src/cli/feat.ts +55 -93
  5. package/src/cli/registry.ts +168 -0
  6. package/src/core/cookies.ts +38 -15
  7. package/src/core/hooks.ts +2 -0
  8. package/src/core/html.ts +19 -8
  9. package/src/core/renderer.ts +2 -2
  10. package/src/core/server.ts +11 -3
  11. package/templates/drizzle/package.json +3 -9
  12. package/templates/drizzle/template.json +3 -0
  13. package/templates/drizzle/drizzle.config.ts +0 -10
  14. package/templates/drizzle/src/features/drizzle/index.ts +0 -15
  15. package/templates/drizzle/src/features/drizzle/migrations/.gitkeep +0 -0
  16. package/templates/drizzle/src/features/drizzle/schemas.ts +0 -1
  17. package/templates/drizzle/src/features/drizzle/seeds/001_initial_todos.ts +0 -11
  18. package/templates/drizzle/src/features/drizzle/seeds/runner.ts +0 -80
  19. package/templates/drizzle/src/features/todo/index.ts +0 -3
  20. package/templates/drizzle/src/features/todo/queries.ts +0 -36
  21. package/templates/drizzle/src/features/todo/schemas/todo.table.ts +0 -9
  22. package/templates/drizzle/src/features/todo/types.ts +0 -5
  23. package/templates/drizzle/src/lib/components/todo/index.ts +0 -3
  24. package/templates/drizzle/src/lib/components/todo/todo-form.svelte +0 -23
  25. package/templates/drizzle/src/lib/components/todo/todo-item.svelte +0 -63
  26. package/templates/drizzle/src/lib/components/todo/todo-list.svelte +0 -21
  27. package/templates/drizzle/src/routes/api/todos/+server.ts +0 -18
  28. package/templates/drizzle/src/routes/api/todos/[id]/+server.ts +0 -42
  29. package/templates/drizzle/src/routes/todos/+page.server.ts +0 -52
  30. package/templates/drizzle/src/routes/todos/+page.svelte +0 -39
@@ -1,52 +0,0 @@
1
- import { fail } from "bosia";
2
- import type { RequestEvent } from "bosia";
3
- import { todoQueries } from "../../features/todo";
4
-
5
- export async function load() {
6
- const todos = await todoQueries.getAll();
7
- return { todos };
8
- }
9
-
10
- export const actions = {
11
- create: async ({ request }: RequestEvent) => {
12
- const data = await request.formData();
13
- const title = (data.get("title") as string)?.trim();
14
-
15
- if (!title) {
16
- return fail(400, { error: "Title is required" });
17
- }
18
-
19
- await todoQueries.create({ title });
20
- return { success: true };
21
- },
22
-
23
- toggle: async ({ request }: RequestEvent) => {
24
- const data = await request.formData();
25
- const id = data.get("id") as string;
26
- const completed = data.get("completed") === "true";
27
-
28
- await todoQueries.toggle(id, completed);
29
- return { success: true };
30
- },
31
-
32
- update: async ({ request }: RequestEvent) => {
33
- const data = await request.formData();
34
- const id = data.get("id") as string;
35
- const title = (data.get("title") as string)?.trim();
36
-
37
- if (!title) {
38
- return fail(400, { error: "Title is required" });
39
- }
40
-
41
- await todoQueries.update(id, { title });
42
- return { success: true };
43
- },
44
-
45
- delete: async ({ request }: RequestEvent) => {
46
- const data = await request.formData();
47
- const id = data.get("id") as string;
48
-
49
- await todoQueries.remove(id);
50
- return { success: true };
51
- },
52
- };
@@ -1,39 +0,0 @@
1
- <script lang="ts">
2
- import type { PageData, ActionData } from './$types';
3
- import { TodoForm, TodoList } from "$lib/components/todo";
4
-
5
- let { data, form }: { data: PageData; form: ActionData } = $props();
6
- </script>
7
-
8
- <svelte:head>
9
- <title>Todos</title>
10
- </svelte:head>
11
-
12
- <div class="flex min-h-screen flex-col bg-background text-foreground">
13
- <header class="sticky top-0 z-10 border-b bg-background/80 backdrop-blur">
14
- <nav class="mx-auto flex max-w-2xl items-center gap-6 px-4 py-3">
15
- <a href="/" class="font-bold tracking-tight flex items-center gap-2">
16
- <img src="/favicon.svg" alt="" class="size-5" />
17
- Todos
18
- </a>
19
- <a href="/" class="text-sm text-muted-foreground hover:text-foreground transition-colors">Home</a>
20
- <a href="/api/todos" target="_blank" class="text-sm text-muted-foreground hover:text-foreground transition-colors">API</a>
21
- </nav>
22
- </header>
23
-
24
- <main class="mx-auto w-full max-w-2xl flex-1 px-4 py-8">
25
- <div class="space-y-6">
26
- <div>
27
- <h1 class="text-2xl font-bold tracking-tight">Todos</h1>
28
- <p class="mt-1 text-sm text-muted-foreground">A full-stack CRUD demo with Drizzle ORM</p>
29
- </div>
30
-
31
- <TodoForm error={form?.error} />
32
- <TodoList todos={data.todos} />
33
- </div>
34
- </main>
35
-
36
- <footer class="border-t py-4 text-center text-sm text-muted-foreground">
37
- Powered by Bosia
38
- </footer>
39
- </div>