create-wervt 0.2.6 → 0.2.7

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
@@ -12,6 +12,39 @@ import { installDependencies } from 'nypm'
12
12
  const BUNDLED_TEMPLATE = new URL('./template', import.meta.url).pathname
13
13
  const NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/
14
14
 
15
+ // Without a terminal (CI logs, agent shells), clack's spinner prints every frame as text.
16
+ const interactive = process.stdout.isTTY === true && !process.env.CI
17
+
18
+ function progress() {
19
+ if (interactive) return p.spinner()
20
+ return { start: (message) => p.log.step(message), stop: (message) => p.log.success(message) }
21
+ }
22
+
23
+ // `--empty`: the todo example's files, and what replaces the ones an app always has.
24
+ const EXAMPLE_FILES = [
25
+ 'server/api/todos.post.ts',
26
+ 'server/api/todos',
27
+ 'server/api/shapes/todos.get.ts',
28
+ 'drizzle',
29
+ ]
30
+ const EMPTY_SCHEMA = `// Tables are declared without a schema: on wervt the app's database role only sees
31
+ // its own schema. Run \`pnpm db:generate\` after changing this file.
32
+ //
33
+ // import { pgTable, serial, text } from 'drizzle-orm/pg-core'
34
+ //
35
+ // export const notes = pgTable('notes', {
36
+ // id: serial().primaryKey(),
37
+ // text: text().notNull(),
38
+ // })
39
+ export {}
40
+ `
41
+ const EMPTY_APP = `<template>
42
+ <main>
43
+ <h1>Hello from wervt</h1>
44
+ </main>
45
+ </template>
46
+ `
47
+
15
48
  /**
16
49
  * The newest version of a package on npm. Releases of @wervt/nuxt and @wervt/cli don't release
17
50
  * this package, so new apps ask the registry instead of keeping the versions bundled at pack
@@ -57,6 +90,11 @@ const main = defineCommand({
57
90
  },
58
91
  install: { type: 'boolean', default: true, description: 'Install dependencies' },
59
92
  force: { type: 'boolean', default: false, description: 'Overwrite an existing directory' },
93
+ empty: {
94
+ type: 'boolean',
95
+ default: false,
96
+ description: 'Without the todo example (no API routes, table or migration)',
97
+ },
60
98
  },
61
99
  async run({ args }) {
62
100
  p.intro('create-wervt')
@@ -78,7 +116,7 @@ const main = defineCommand({
78
116
  if (existsSync(dir) && !args.force)
79
117
  throw new Error(`${relative(process.cwd(), dir) || dir} already exists (use --force)`)
80
118
 
81
- const spinner = p.spinner()
119
+ const spinner = progress()
82
120
  spinner.start('Creating app')
83
121
  if (args.template) {
84
122
  await downloadTemplate(args.template, { dir, force: args.force })
@@ -89,6 +127,12 @@ const main = defineCommand({
89
127
  await rename(join(dir, '_gitignore'), join(dir, '.gitignore'))
90
128
  }
91
129
 
130
+ if (args.empty) {
131
+ for (const file of EXAMPLE_FILES) await rm(join(dir, file), { recursive: true, force: true })
132
+ await writeFile(join(dir, 'server/db/schema.ts'), EMPTY_SCHEMA)
133
+ await writeFile(join(dir, 'app.vue'), EMPTY_APP)
134
+ }
135
+
92
136
  const pkgPath = join(dir, 'package.json')
93
137
  const pkg = JSON.parse(await readFile(pkgPath, 'utf8'))
94
138
  pkg.name = name
@@ -100,6 +144,8 @@ const main = defineCommand({
100
144
  await rm(join(dir, 'vite.config.ts'), { force: true })
101
145
  // Apps in the repo are deployed from the repo, not by their own workflow.
102
146
  await rm(join(dir, '.github'), { recursive: true, force: true })
147
+ // The repo's own pnpm-workspace.yaml covers the app; its own would split it off.
148
+ await rm(join(dir, 'pnpm-workspace.yaml'), { force: true })
103
149
  } else {
104
150
  for (const [deps, name] of [
105
151
  ['dependencies', '@wervt/nuxt'],
@@ -134,7 +180,9 @@ const main = defineCommand({
134
180
  .join('\n'),
135
181
  'Next steps',
136
182
  )
137
- p.outro('Agents: read AGENTS.md before writing code.')
183
+ // clack's outro ends with blank lines; without a terminal the last line is the message.
184
+ if (interactive) p.outro('Agents: read AGENTS.md before writing code.')
185
+ else console.log('Agents: read AGENTS.md before writing code.')
138
186
  },
139
187
  })
140
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wervt",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
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",
@@ -204,6 +204,6 @@ Queries are LogsQL. Logs may contain user data: quote only what's needed.
204
204
  - `pnpm dev`: dev server against the local wervt stack (`docker compose up -d` in the wervt repo).
205
205
  - `pnpm db:generate`: generate a migration from the schema.
206
206
  - `pnpm exec vp check --fix`: format, lint and type check. Run it before finishing.
207
- - Deploys: pushing to `main` deploys through `.github/workflows/deploy.yml`. `pnpm exec wervt
208
- releases <app>` lists releases with their commits. Don't deploy, roll back or create tokens
209
- unless asked.
207
+ - Deploys: pushing to `main` deploys through `.github/workflows/deploy.yml`.
208
+ `pnpm exec wervt releases <app>` lists releases with their commits. Don't deploy, roll back or
209
+ create tokens unless asked.
@@ -3,3 +3,5 @@ node_modules
3
3
  .output
4
4
  .data
5
5
  .env
6
+ # Source maps a Nuxt 5 build leaves next to the app
7
+ dist
@@ -9,13 +9,13 @@
9
9
  "postinstall": "nuxt prepare"
10
10
  },
11
11
  "dependencies": {
12
- "@wervt/nuxt": "^0.2.7",
12
+ "@wervt/nuxt": "^0.2.8",
13
13
  "drizzle-orm": "1.0.0-rc.4",
14
14
  "nuxt": "npm:nuxt-nightly@5x",
15
15
  "valibot": "^1.5.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@wervt/cli": "^0.2.6",
18
+ "@wervt/cli": "^0.2.7",
19
19
  "drizzle-kit": "1.0.0-rc.4",
20
20
  "vite-plus": "^1.0.0"
21
21
  }
@@ -0,0 +1,6 @@
1
+ # pnpm only runs install scripts it has been told about; esbuild is the one this app needs.
2
+ allowBuilds:
3
+ esbuild: true
4
+ minimumReleaseAgeExclude:
5
+ # wervt's own packages, so a new app gets the release that was just published.
6
+ - '@wervt/*'
@@ -5,9 +5,11 @@ export default defineConfig({
5
5
  singleQuote: true,
6
6
  semi: false,
7
7
  printWidth: 100,
8
- ignorePatterns: ['drizzle/**'],
8
+ // Generated migrations, and the bundled Nuxt UI skills (kept as published).
9
+ ignorePatterns: ['drizzle/**', '.claude/skills/nuxt-ui*/**'],
9
10
  },
10
11
  lint: {
12
+ ignorePatterns: ['.claude/skills/nuxt-ui*/**'],
11
13
  options: { typeAware: true, typeCheck: true },
12
14
  },
13
15
  })