create-wervt 0.2.19 → 0.2.20

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.
package/index.js CHANGED
@@ -42,7 +42,7 @@ const EMPTY_SCHEMA = `// Tables are declared without a schema: on wervt the app'
42
42
  // })
43
43
  export {}
44
44
  `
45
- const EMPTY_APP = `<template>
45
+ const EMPTY_PAGE = `<template>
46
46
  <main>
47
47
  <h1>Hello from wervt</h1>
48
48
  </main>
@@ -134,7 +134,7 @@ const main = defineCommand({
134
134
  if (args.empty) {
135
135
  for (const file of EXAMPLE_FILES) await rm(join(dir, file), { recursive: true, force: true })
136
136
  await writeFile(join(dir, 'server/db/schema.ts'), EMPTY_SCHEMA)
137
- await writeFile(join(dir, 'app.vue'), EMPTY_APP)
137
+ await writeFile(join(dir, 'pages/index.vue'), EMPTY_PAGE)
138
138
  }
139
139
 
140
140
  const pkgPath = join(dir, 'package.json')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wervt",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Create a new wervt app: Nuxt 5, Postgres with Drizzle, live data with Electric.",
5
5
  "homepage": "https://wervt.app",
6
6
  "license": "MIT",
@@ -6,7 +6,8 @@ Supabase Edge Runtime) with its own Postgres schema and live data through Electr
6
6
 
7
7
  ## Layout
8
8
 
9
- - `app.vue`, `pages/`, `components/`: the Vue app.
9
+ - `pages/`: one route per file, `pages/index.vue` is `/`. `app.vue` is the shell around every page
10
+ (`<NuxtPage />`, wrapped in `<UApp>` with Nuxt UI). `components/`: the Vue components.
10
11
  - `server/api/`: API routes. `server/api/shapes/`: live data routes.
11
12
  - `server/tools/`: tools that AI agents can call: in the browser (WebMCP) and at `/mcp` (MCP).
12
13
  API routes become tools with `defineToolRoute`.
package/template/app.vue CHANGED
@@ -1,37 +1,3 @@
1
- <script setup lang="ts">
2
- import type { Todo } from './server/db/schema'
3
-
4
- // Rows arrive with SSR and then stay live: every write below shows up here (and in every
5
- // other open tab) through Electric, so there is nothing to refetch.
6
- const { data, isLive } = await useShape('/api/shapes/todos')
7
- const todos = computed(() => data.value.toSorted((a, b) => a.id - b.id))
8
- const title = ref('')
9
-
10
- async function add() {
11
- await $fetch('/api/todos', { method: 'POST', body: { title: title.value } })
12
- title.value = ''
13
- }
14
- const toggle = (todo: Todo) =>
15
- $fetch(`/api/todos/${todo.id}`, { method: 'PATCH', body: { done: !todo.done } })
16
- const remove = (todo: Todo) => $fetch(`/api/todos/${todo.id}`, { method: 'DELETE' })
17
- </script>
18
-
19
1
  <template>
20
- <main>
21
- <h1>Todos</h1>
22
- <p>{{ isLive ? 'Live' : 'Connecting…' }}</p>
23
- <form @submit.prevent="add">
24
- <input v-model="title" placeholder="What needs doing?" required />
25
- <button>Add</button>
26
- </form>
27
- <ul>
28
- <li v-for="todo in todos" :key="todo.id">
29
- <label>
30
- <input type="checkbox" :checked="todo.done" @change="toggle(todo)" />
31
- {{ todo.title }}
32
- </label>
33
- <button @click="remove(todo)">Delete</button>
34
- </li>
35
- </ul>
36
- </main>
2
+ <NuxtPage />
37
3
  </template>
@@ -10,15 +10,16 @@
10
10
  "postinstall": "nuxt prepare"
11
11
  },
12
12
  "dependencies": {
13
- "@wervt/nuxt": "^0.3.20",
13
+ "@wervt/nuxt": "^0.3.21",
14
14
  "drizzle-orm": "1.0.0-rc.5",
15
15
  "nuxt": "npm:nuxt-nightly@5x",
16
16
  "valibot": "^1.5.0",
17
- "vue": "^3.5.44"
17
+ "vue": "^3.5.45",
18
+ "vue-router": "^5.5.1"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@golar/vue": "^0.1.11",
21
- "@wervt/cli": "^0.2.27",
22
+ "@wervt/cli": "^0.2.28",
22
23
  "drizzle-kit": "1.0.0-rc.5",
23
24
  "golar": "^0.1.11",
24
25
  "vite-plus": "^1.3.0"
@@ -0,0 +1,37 @@
1
+ <script setup lang="ts">
2
+ import type { Todo } from '../server/db/schema'
3
+
4
+ // Rows arrive with SSR and then stay live: every write below shows up here (and in every
5
+ // other open tab) through Electric, so there is nothing to refetch.
6
+ const { data, isLive } = await useShape('/api/shapes/todos')
7
+ const todos = computed(() => data.value.toSorted((a, b) => a.id - b.id))
8
+ const title = ref('')
9
+
10
+ async function add() {
11
+ await $fetch('/api/todos', { method: 'POST', body: { title: title.value } })
12
+ title.value = ''
13
+ }
14
+ const toggle = (todo: Todo) =>
15
+ $fetch(`/api/todos/${todo.id}`, { method: 'PATCH', body: { done: !todo.done } })
16
+ const remove = (todo: Todo) => $fetch(`/api/todos/${todo.id}`, { method: 'DELETE' })
17
+ </script>
18
+
19
+ <template>
20
+ <main>
21
+ <h1>Todos</h1>
22
+ <p>{{ isLive ? 'Live' : 'Connecting…' }}</p>
23
+ <form @submit.prevent="add">
24
+ <input v-model="title" placeholder="What needs doing?" required />
25
+ <button>Add</button>
26
+ </form>
27
+ <ul>
28
+ <li v-for="todo in todos" :key="todo.id">
29
+ <label>
30
+ <input type="checkbox" :checked="todo.done" @change="toggle(todo)" />
31
+ {{ todo.title }}
32
+ </label>
33
+ <button @click="remove(todo)">Delete</button>
34
+ </li>
35
+ </ul>
36
+ </main>
37
+ </template>