create-taserjs 0.0.2 → 0.0.4

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 (111) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/addons/arktype/index.cjs.map +1 -1
  3. package/dist/cjs/addons/drizzle/index.cjs.map +1 -1
  4. package/dist/cjs/addons/kysely/index.cjs.map +1 -1
  5. package/dist/cjs/addons/pino/index.cjs.map +1 -1
  6. package/dist/cjs/addons/prisma/index.cjs +84 -24
  7. package/dist/cjs/addons/prisma/index.cjs.map +1 -1
  8. package/dist/cjs/addons/registry.cjs +1 -1
  9. package/dist/cjs/addons/registry.cjs.map +1 -1
  10. package/dist/cjs/addons/types.d.cts +1 -1
  11. package/dist/cjs/addons/valibot/index.cjs.map +1 -1
  12. package/dist/cjs/addons/validators.cjs.map +1 -1
  13. package/dist/cjs/addons/winston/index.cjs.map +1 -1
  14. package/dist/cjs/addons/zod/index.cjs.map +1 -1
  15. package/dist/cjs/cli.cjs +5 -0
  16. package/dist/cjs/cli.cjs.map +1 -1
  17. package/dist/cjs/commands/create.cjs +44 -11
  18. package/dist/cjs/commands/create.cjs.map +1 -1
  19. package/dist/cjs/commands/create.d.cts +1 -0
  20. package/dist/cjs/core/json-output.cjs.map +1 -1
  21. package/dist/cjs/core/package-manager.cjs.map +1 -1
  22. package/dist/cjs/core/package-manager.d.cts +1 -1
  23. package/dist/cjs/core/parse-options.cjs +7 -7
  24. package/dist/cjs/core/parse-options.cjs.map +1 -1
  25. package/dist/cjs/core/parse-options.d.cts +3 -3
  26. package/dist/cjs/core/project-config.cjs +1 -1
  27. package/dist/cjs/core/project-config.cjs.map +1 -1
  28. package/dist/cjs/core/resolve-packages.cjs +41 -7
  29. package/dist/cjs/core/resolve-packages.cjs.map +1 -1
  30. package/dist/cjs/core/resolve-packages.d.cts +2 -2
  31. package/dist/cjs/core/scaffold-engine.cjs +33 -6
  32. package/dist/cjs/core/scaffold-engine.cjs.map +1 -1
  33. package/dist/cjs/core/types.cjs +11 -3
  34. package/dist/cjs/core/types.cjs.map +1 -1
  35. package/dist/cjs/core/types.d.cts +8 -8
  36. package/dist/cjs/core/validate-project-name.cjs.map +1 -1
  37. package/dist/cjs/frameworks/index.cjs +138 -17
  38. package/dist/cjs/frameworks/index.cjs.map +1 -1
  39. package/dist/cjs/frameworks/index.d.cts +3 -3
  40. package/dist/cjs/scaffold.d.cts +1 -1
  41. package/dist/cjs/templates/base.cjs +6 -6
  42. package/dist/cjs/templates/base.cjs.map +1 -1
  43. package/dist/cjs/types.d.cts +1 -1
  44. package/dist/esm/addons/arktype/index.js.map +1 -1
  45. package/dist/esm/addons/drizzle/index.js.map +1 -1
  46. package/dist/esm/addons/kysely/index.js.map +1 -1
  47. package/dist/esm/addons/pino/index.js.map +1 -1
  48. package/dist/esm/addons/prisma/index.js +84 -24
  49. package/dist/esm/addons/prisma/index.js.map +1 -1
  50. package/dist/esm/addons/registry.js +2 -2
  51. package/dist/esm/addons/registry.js.map +1 -1
  52. package/dist/esm/addons/types.d.ts +1 -1
  53. package/dist/esm/addons/valibot/index.js.map +1 -1
  54. package/dist/esm/addons/validators.js.map +1 -1
  55. package/dist/esm/addons/winston/index.js.map +1 -1
  56. package/dist/esm/addons/zod/index.js.map +1 -1
  57. package/dist/esm/cli.js +5 -0
  58. package/dist/esm/cli.js.map +1 -1
  59. package/dist/esm/commands/create.d.ts +1 -0
  60. package/dist/esm/commands/create.js +46 -13
  61. package/dist/esm/commands/create.js.map +1 -1
  62. package/dist/esm/core/json-output.js.map +1 -1
  63. package/dist/esm/core/package-manager.d.ts +1 -1
  64. package/dist/esm/core/package-manager.js.map +1 -1
  65. package/dist/esm/core/parse-options.d.ts +3 -3
  66. package/dist/esm/core/parse-options.js +8 -8
  67. package/dist/esm/core/parse-options.js.map +1 -1
  68. package/dist/esm/core/project-config.js +1 -1
  69. package/dist/esm/core/project-config.js.map +1 -1
  70. package/dist/esm/core/resolve-packages.d.ts +2 -2
  71. package/dist/esm/core/resolve-packages.js +41 -7
  72. package/dist/esm/core/resolve-packages.js.map +1 -1
  73. package/dist/esm/core/scaffold-engine.js +34 -7
  74. package/dist/esm/core/scaffold-engine.js.map +1 -1
  75. package/dist/esm/core/types.d.ts +8 -8
  76. package/dist/esm/core/types.js +11 -3
  77. package/dist/esm/core/types.js.map +1 -1
  78. package/dist/esm/core/validate-project-name.js.map +1 -1
  79. package/dist/esm/frameworks/index.d.ts +3 -3
  80. package/dist/esm/frameworks/index.js +138 -17
  81. package/dist/esm/frameworks/index.js.map +1 -1
  82. package/dist/esm/scaffold.d.ts +1 -1
  83. package/dist/esm/templates/base.js +6 -6
  84. package/dist/esm/templates/base.js.map +1 -1
  85. package/dist/esm/types.d.ts +1 -1
  86. package/package.json +13 -13
  87. package/src/addons/arktype/index.ts +2 -2
  88. package/src/addons/drizzle/index.ts +53 -53
  89. package/src/addons/kysely/index.ts +42 -42
  90. package/src/addons/pino/index.ts +12 -12
  91. package/src/addons/prisma/index.ts +128 -55
  92. package/src/addons/registry.ts +37 -37
  93. package/src/addons/types.ts +14 -14
  94. package/src/addons/valibot/index.ts +2 -2
  95. package/src/addons/validators.ts +9 -9
  96. package/src/addons/winston/index.ts +12 -12
  97. package/src/addons/zod/index.ts +2 -2
  98. package/src/cli.ts +27 -26
  99. package/src/commands/create.ts +181 -152
  100. package/src/core/json-output.ts +4 -4
  101. package/src/core/package-manager.ts +38 -31
  102. package/src/core/parse-options.ts +50 -48
  103. package/src/core/project-config.ts +10 -14
  104. package/src/core/resolve-packages.ts +79 -41
  105. package/src/core/scaffold-engine.ts +106 -36
  106. package/src/core/types.ts +61 -36
  107. package/src/core/validate-project-name.ts +40 -40
  108. package/src/frameworks/index.ts +164 -29
  109. package/src/scaffold.ts +3 -3
  110. package/src/templates/base.ts +57 -51
  111. package/src/types.ts +5 -4
@@ -1,59 +1,59 @@
1
- import path from 'node:path'
1
+ import path from "node:path";
2
2
 
3
3
  const RESERVED_WINDOWS_NAMES = new Set([
4
- 'CON',
5
- 'PRN',
6
- 'AUX',
7
- 'NVR',
8
- 'NULL',
9
- 'COM1',
10
- 'COM2',
11
- 'COM3',
12
- 'COM4',
13
- 'COM5',
14
- 'COM6',
15
- 'COM7',
16
- 'COM8',
17
- 'COM9',
18
- 'LPT1',
19
- 'LPT2',
20
- 'LPT3',
21
- 'LPT4',
22
- 'LPT5',
23
- 'LPT6',
24
- 'LPT7',
25
- 'LPT8',
26
- 'LPT9',
27
- ])
4
+ "CON",
5
+ "PRN",
6
+ "AUX",
7
+ "NVR",
8
+ "NULL",
9
+ "COM1",
10
+ "COM2",
11
+ "COM3",
12
+ "COM4",
13
+ "COM5",
14
+ "COM6",
15
+ "COM7",
16
+ "COM8",
17
+ "COM9",
18
+ "LPT1",
19
+ "LPT2",
20
+ "LPT3",
21
+ "LPT4",
22
+ "LPT5",
23
+ "LPT6",
24
+ "LPT7",
25
+ "LPT8",
26
+ "LPT9",
27
+ ]);
28
28
 
29
29
  export function validateProjectName(name: string, cwd = process.cwd()): string | undefined {
30
- const trimmed = name.trim()
30
+ const trimmed = name.trim();
31
31
  if (!trimmed) {
32
- return 'Project name is required'
32
+ return "Project name is required";
33
33
  }
34
34
 
35
- if (trimmed.includes('..')) {
36
- return 'Project name cannot contain ".."'
35
+ if (trimmed.includes("..")) {
36
+ return 'Project name cannot contain ".."';
37
37
  }
38
38
 
39
- if (trimmed.includes('/') || trimmed.includes('\\')) {
40
- return 'Project name cannot contain path separators'
39
+ if (trimmed.includes("/") || trimmed.includes("\\")) {
40
+ return "Project name cannot contain path separators";
41
41
  }
42
42
 
43
- if (trimmed.startsWith('.') || trimmed.endsWith('.')) {
44
- return 'Project name cannot start or end with a dot'
43
+ if (trimmed.startsWith(".") || trimmed.endsWith(".")) {
44
+ return "Project name cannot start or end with a dot";
45
45
  }
46
46
 
47
- const baseName = trimmed.split('.')[0]?.toUpperCase()
47
+ const baseName = trimmed.split(".")[0]?.toUpperCase();
48
48
  if (baseName && RESERVED_WINDOWS_NAMES.has(baseName)) {
49
- return `Project name "${trimmed}" is reserved on Windows`
49
+ return `Project name "${trimmed}" is reserved on Windows`;
50
50
  }
51
51
 
52
- const targetDir = path.resolve(cwd, trimmed)
53
- const relative = path.relative(cwd, targetDir)
54
- if (relative.startsWith('..') || path.isAbsolute(relative)) {
55
- return 'Project name resolves outside the current directory'
52
+ const targetDir = path.resolve(cwd, trimmed);
53
+ const relative = path.relative(cwd, targetDir);
54
+ if (relative.startsWith("..") || path.isAbsolute(relative)) {
55
+ return "Project name resolves outside the current directory";
56
56
  }
57
57
 
58
- return undefined
58
+ return undefined;
59
59
  }
@@ -1,9 +1,11 @@
1
- import type { Framework } from '../core/types.js'
1
+ import type { ProjectType } from "../core/types.js";
2
2
 
3
- export function indexTemplate(framework: Framework): string {
4
- switch (framework) {
5
- case 'express':
6
- return `import express from 'express'
3
+ export function indexTemplate(type: ProjectType): string {
4
+ switch (type) {
5
+ case "express":
6
+ return `import 'dotenv/config'
7
+
8
+ import express from 'express'
7
9
  import { createExpressHandler } from '@taserjs/adapter-express'
8
10
 
9
11
  import { routeManifest } from '#src/routeManifest.gen.js'
@@ -13,15 +15,17 @@ const router = t.create(routeManifest)
13
15
 
14
16
  const taser = createExpressHandler(router)
15
17
  const app = express()
16
- taser.mount('/api{/*splat}', app)
18
+ taser.mount('/{*splat}', app)
17
19
 
18
20
  const port = Number(process.env.PORT ?? 3000)
19
21
  app.listen(port, () => {
20
22
  console.log(\`Express listening on http://localhost:\${port}\`)
21
23
  })
22
- `
23
- case 'hono':
24
- return `import { serve } from '@hono/node-server'
24
+ `;
25
+ case "hono":
26
+ return `import 'dotenv/config'
27
+
28
+ import { serve } from '@hono/node-server'
25
29
  import { Hono } from 'hono'
26
30
 
27
31
  import { routeManifest } from '#src/routeManifest.gen.js'
@@ -30,16 +34,17 @@ import { t } from '#src/taser.js'
30
34
  const router = t.create(routeManifest)
31
35
 
32
36
  const app = new Hono()
33
- const api = router.base('/api')
34
- app.all('/api/*', c => api.native(c).fetch(c.req.raw))
37
+ app.all('/*', c => router.native(c).fetch(c.req.raw))
35
38
 
36
39
  const port = Number(process.env.PORT ?? 3000)
37
40
  serve({ fetch: app.fetch, port }, () => {
38
41
  console.log(\`Hono listening on http://localhost:\${port}\`)
39
42
  })
40
- `
41
- case 'fastify':
42
- return `import Fastify from 'fastify'
43
+ `;
44
+ case "fastify":
45
+ return `import 'dotenv/config'
46
+
47
+ import Fastify from 'fastify'
43
48
  import { createFastifyHandler } from '@taserjs/adapter-fastify'
44
49
 
45
50
  import { routeManifest } from '#src/routeManifest.gen.js'
@@ -49,36 +54,166 @@ const router = t.create(routeManifest)
49
54
 
50
55
  const taser = createFastifyHandler(router)
51
56
  const app = Fastify()
52
- taser.mount('/api/*', app)
57
+ taser.mount('/*', app)
53
58
 
54
59
  const port = Number(process.env.PORT ?? 3000)
55
60
  await app.listen({ port })
56
61
  console.log(\`Fastify listening on http://localhost:\${port}\`)
57
- `
58
- case 'node':
59
- default:
60
- return `import { createServer } from 'node:http'
61
- import { createNodeHandler } from '@taserjs/adapter-node'
62
+ `;
63
+ case "bun":
64
+ return `import 'dotenv/config'
65
+
66
+ import { routeManifest } from '#src/routeManifest.gen.js'
67
+ import { t } from '#src/taser.js'
68
+
69
+ const router = t.create(routeManifest)
70
+
71
+ const port = Number(process.env.PORT ?? 3000)
72
+
73
+ export default {
74
+ port,
75
+ fetch(request: Request) {
76
+ return router.fetch(request)
77
+ },
78
+ }
79
+ `;
80
+ case "deno":
81
+ return `import 'dotenv/config'
82
+
83
+ import { routeManifest } from '#src/routeManifest.gen.js'
84
+ import { t } from '#src/taser.js'
85
+
86
+ const router = t.create(routeManifest)
87
+
88
+ const port = Number(process.env.PORT ?? 8000)
89
+ Deno.serve({ port }, (request: Request) => router.fetch(request))
90
+ `;
91
+ case "aws-lambda":
92
+ return `import 'dotenv/config'
93
+
94
+ import { Hono } from 'hono'
95
+ import { handle } from 'hono/aws-lambda'
96
+
97
+ import { routeManifest } from '#src/routeManifest.gen.js'
98
+ import { t } from '#src/taser.js'
99
+
100
+ const router = t.create(routeManifest)
101
+
102
+ const app = new Hono()
103
+ app.all('/*', c => router.native(c).fetch(c.req.raw))
104
+
105
+ export const handler = handle(app)
106
+ `;
107
+ case "cloudflare-workers":
108
+ return `import 'dotenv/config'
109
+
110
+ import { routeManifest } from '#src/routeManifest.gen.js'
111
+ import { t } from '#src/taser.js'
112
+
113
+ const router = t.create(routeManifest)
114
+
115
+ export default {
116
+ fetch(request: Request, env: unknown, ctx: unknown) {
117
+ return router.fetch(request, env, ctx)
118
+ },
119
+ }
120
+ `;
121
+ case "netlify":
122
+ return `import 'dotenv/config'
123
+
124
+ import { Hono } from 'hono'
125
+ import { handle } from 'hono/netlify'
62
126
 
63
127
  import { routeManifest } from '#src/routeManifest.gen.js'
64
128
  import { t } from '#src/taser.js'
65
129
 
66
130
  const router = t.create(routeManifest)
67
131
 
68
- const taser = createNodeHandler(router)
69
- const app = createServer()
70
- taser.mount('/api/*', app)
132
+ const app = new Hono()
133
+ app.all('/*', c => router.native(c).fetch(c.req.raw))
134
+
135
+ export default handle(app)
136
+ `;
137
+ case "vercel":
138
+ return `import 'dotenv/config'
139
+
140
+ import { Hono } from 'hono'
141
+ import { handle } from 'hono/vercel'
142
+
143
+ import { routeManifest } from '#src/routeManifest.gen.js'
144
+ import { t } from '#src/taser.js'
145
+
146
+ const router = t.create(routeManifest)
147
+
148
+ const app = new Hono()
149
+ app.all('/*', c => router.native(c).fetch(c.req.raw))
150
+
151
+ export default handle(app)
152
+ `;
153
+ case "azure-functions":
154
+ return `import 'dotenv/config'
155
+
156
+ import { app } from '@azure/functions'
157
+ import { Hono } from 'hono'
158
+ import { azureHonoHandler } from '@marplex/hono-azurefunc-adapter'
159
+
160
+ import { routeManifest } from '#src/routeManifest.gen.js'
161
+ import { t } from '#src/taser.js'
162
+
163
+ const router = t.create(routeManifest)
164
+
165
+ const honoApp = new Hono()
166
+ honoApp.all('/*', c => router.native(c).fetch(c.req.raw))
167
+
168
+ app.http('httpTrigger', {
169
+ methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'],
170
+ authLevel: 'anonymous',
171
+ route: '{*proxy}',
172
+ handler: azureHonoHandler(honoApp.fetch),
173
+ })
174
+ `;
175
+ case "google-cloud-run":
176
+ return `import 'dotenv/config'
177
+
178
+ import { serve } from '@hono/node-server'
179
+
180
+ import { routeManifest } from '#src/routeManifest.gen.js'
181
+ import { t } from '#src/taser.js'
182
+
183
+ const router = t.create(routeManifest)
184
+
185
+ const port = Number(process.env.PORT ?? 8080)
186
+ serve({ fetch: router.fetch, port }, () => {
187
+ console.log(\`Cloud Run listening on http://localhost:\${port}\`)
188
+ })
189
+ `;
190
+ case "node":
191
+ default:
192
+ return `import 'dotenv/config'
193
+
194
+ import { serve } from '@hono/node-server'
195
+
196
+ import { routeManifest } from '#src/routeManifest.gen.js'
197
+ import { t } from '#src/taser.js'
198
+
199
+ const router = t.create(routeManifest)
71
200
 
72
201
  const port = Number(process.env.PORT ?? 3000)
73
- app.listen(port, () => {
202
+ serve({ fetch: router.fetch, port }, () => {
74
203
  console.log(\`Node listening on http://localhost:\${port}\`)
75
204
  })
76
- `
205
+ `;
77
206
  }
78
207
  }
79
208
 
80
- export function taserTsTemplate(framework: Framework = 'node'): string {
81
- if (framework === 'hono') {
209
+ export function taserTsTemplate(type: ProjectType = "node"): string {
210
+ if (
211
+ type === "hono" ||
212
+ type === "aws-lambda" ||
213
+ type === "netlify" ||
214
+ type === "vercel" ||
215
+ type === "azure-functions"
216
+ ) {
82
217
  return `import type { Context } from 'hono'
83
218
  import { createTaserApp, type InferAppContext } from '@taserjs/router'
84
219
 
@@ -95,7 +230,7 @@ export const t = createTaserApp({
95
230
  }).context(context)
96
231
 
97
232
  export type AppContext = InferAppContext<typeof context>
98
- `
233
+ `;
99
234
  }
100
235
 
101
236
  return `import { createTaserApp, type InferAppContext } from '@taserjs/router'
@@ -107,5 +242,5 @@ export const t = createTaserApp({
107
242
  }).context(context)
108
243
 
109
244
  export type AppContext = InferAppContext<typeof context>
110
- `
245
+ `;
111
246
  }
package/src/scaffold.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { scaffoldProject } from './core/scaffold-engine.js'
2
- export { getPackageGroups, resolvePackages } from './core/resolve-packages.js'
3
- export type { Framework, ScaffoldOptions, ScaffoldResult, PackageGroups } from './core/types.js'
1
+ export { scaffoldProject } from "./core/scaffold-engine.js";
2
+ export { getPackageGroups, resolvePackages } from "./core/resolve-packages.js";
3
+ export type { PackageGroups, ProjectType, ScaffoldOptions, ScaffoldResult } from "./core/types.js";
@@ -1,29 +1,32 @@
1
- import type { BootBinding } from '../addons/types.js'
2
- import type { ScaffoldContext } from '../core/types.js'
1
+ import type { BootBinding } from "../addons/types.js";
2
+ import type { ScaffoldContext } from "../core/types.js";
3
3
 
4
- export function packageJsonTemplate(projectName: string, scripts: Record<string, string> = {}): string {
4
+ export function packageJsonTemplate(
5
+ projectName: string,
6
+ scripts: Record<string, string> = {},
7
+ ): string {
5
8
  const pkg = {
6
9
  name: projectName,
7
- version: '1.0.0',
10
+ version: "1.0.0",
8
11
  private: true,
9
- type: 'module',
12
+ type: "module",
10
13
  imports: {
11
- '#src/*': './src/*',
14
+ "#src/*": "./src/*",
12
15
  },
13
16
  scripts: {
14
- 'dev': 'run-p dev:server dev:taser',
15
- 'dev:server': 'tsx watch src/index.ts',
16
- 'dev:taser': 'taser watch',
17
- 'start': 'tsx src/index.ts',
18
- 'generate': 'taser generate',
19
- 'build': 'taser generate && tsdown',
20
- 'serve': 'node dist/index.mjs',
21
- 'typecheck': 'tsc --noEmit -p tsconfig.json',
17
+ dev: "run-p dev:server dev:taser",
18
+ "dev:server": "tsx watch src/index.ts",
19
+ "dev:taser": "taser watch",
20
+ start: "tsx src/index.ts",
21
+ generate: "taser generate",
22
+ build: "taser generate && tsdown",
23
+ serve: "node dist/index.mjs",
24
+ typecheck: "tsc --noEmit -p tsconfig.json",
22
25
  ...scripts,
23
26
  },
24
- }
27
+ };
25
28
 
26
- return `${JSON.stringify(pkg, null, 2)}\n`
29
+ return `${JSON.stringify(pkg, null, 2)}\n`;
27
30
  }
28
31
 
29
32
  export function tsdownConfigTemplate(): string {
@@ -36,26 +39,30 @@ export default defineConfig({
36
39
  clean: true,
37
40
  sourcemap: true,
38
41
  })
39
- `
42
+ `;
40
43
  }
41
44
 
42
45
  export function tsconfigTemplate(): string {
43
- return `${JSON.stringify({
44
- compilerOptions: {
45
- target: 'ES2022',
46
- module: 'NodeNext',
47
- paths: {
48
- '#src/*': ['./src/*'],
46
+ return `${JSON.stringify(
47
+ {
48
+ compilerOptions: {
49
+ target: "ES2022",
50
+ module: "NodeNext",
51
+ paths: {
52
+ "#src/*": ["./src/*"],
53
+ },
54
+ strict: true,
55
+ skipLibCheck: true,
56
+ verbatimModuleSyntax: true,
57
+ isolatedModules: true,
58
+ noEmit: true,
59
+ types: ["node"],
49
60
  },
50
- strict: true,
51
- skipLibCheck: true,
52
- verbatimModuleSyntax: true,
53
- isolatedModules: true,
54
- noEmit: true,
55
- types: ['node'],
61
+ include: ["src"],
56
62
  },
57
- include: ['src'],
58
- }, null, 2)}\n`
63
+ null,
64
+ 2,
65
+ )}\n`;
59
66
  }
60
67
 
61
68
  export function gitignoreTemplate(): string {
@@ -66,23 +73,22 @@ dist
66
73
  .env
67
74
  local.db
68
75
  drizzle
69
- `
76
+ `;
70
77
  }
71
78
 
72
79
  export function contextTemplate(bindings: BootBinding[]): string {
73
80
  const imports = bindings.map(
74
- binding => `import { ${binding.factoryName} } from '${binding.importPath}'`,
75
- )
81
+ (binding) => `import { ${binding.factoryName} } from '${binding.importPath}'`,
82
+ );
76
83
 
77
- const bootBody = bindings.length > 0
78
- ? bindings.map(binding => ` ${binding.key}: ${binding.factoryName}(),`).join('\n')
79
- : ''
84
+ const bootBody =
85
+ bindings.length > 0
86
+ ? bindings.map((binding) => ` ${binding.key}: ${binding.factoryName}(),`).join("\n")
87
+ : "";
80
88
 
81
- const bootBlock = bindings.length > 0
82
- ? ` boot: () => ({\n${bootBody}\n }),`
83
- : ''
89
+ const bootBlock = bindings.length > 0 ? ` boot: () => ({\n${bootBody}\n }),` : "";
84
90
 
85
- const importBlock = imports.length > 0 ? `${imports.join('\n')}\n\n` : ''
91
+ const importBlock = imports.length > 0 ? `${imports.join("\n")}\n\n` : "";
86
92
 
87
93
  return `${importBlock}import { createContext } from '@taserjs/router'
88
94
 
@@ -92,7 +98,7 @@ ${bootBlock}
92
98
  requestId: crypto.randomUUID(),
93
99
  }),
94
100
  })
95
- `
101
+ `;
96
102
  }
97
103
 
98
104
  export function rootLayoutTemplate(): string {
@@ -104,7 +110,7 @@ import { t } from '#src/taser.js'
104
110
  export const Middleware = t.middleware('/$')
105
111
  .use(secureHeaders())
106
112
  .use(bodyLimit({ maxSize: 1_000_000 }))
107
- `
113
+ `;
108
114
  }
109
115
 
110
116
  export function indexRouteTemplate(): string {
@@ -114,22 +120,22 @@ import { t } from '#src/taser.js'
114
120
  export const Route = t.get('/').handler(() => {
115
121
  return reply.json({ message: 'Welcome to Taser' })
116
122
  })
117
- `
123
+ `;
118
124
  }
119
125
 
120
126
  export function healthRouteTemplate(ctx: ScaffoldContext): string {
121
- const lines: string[] = []
127
+ const lines: string[] = [];
122
128
 
123
129
  if (ctx.logger) {
124
- lines.push(' ctx.logger.info(\'health check\')')
130
+ lines.push(" ctx.logger.info('health check')");
125
131
  }
126
132
 
127
133
  if (ctx.db) {
128
- lines.push(' // ctx.db is available from context boot')
134
+ lines.push(" // ctx.db is available from context boot");
129
135
  }
130
136
 
131
- const body = lines.length > 0 ? `${lines.join('\n')}\n` : ''
132
- const ctxArg = lines.length > 0 ? '(ctx)' : '()'
137
+ const body = lines.length > 0 ? `${lines.join("\n")}\n` : "";
138
+ const ctxArg = lines.length > 0 ? "(ctx)" : "()";
133
139
 
134
140
  return `import { reply } from '@taserjs/router'
135
141
  import { t } from '#src/taser.js'
@@ -137,7 +143,7 @@ import { t } from '#src/taser.js'
137
143
  export const Route = t.get('/health').handler(${ctxArg} => {
138
144
  ${body} return reply.json({ ok: true })
139
145
  })
140
- `
146
+ `;
141
147
  }
142
148
 
143
149
  /** Minimal placeholder until `taser generate` runs. */
@@ -204,5 +210,5 @@ declare module '@taserjs/router' {
204
210
  RouteByPathMethod: RouteByPathMethodGen
205
211
  }
206
212
  }
207
- `
213
+ `;
208
214
  }
package/src/types.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export type {
2
- Framework,
3
- DbOdm,
4
2
  DbDriver,
3
+ DbOdm,
5
4
  LoggerId,
5
+ PackageGroups,
6
+ ProjectType,
6
7
  ScaffoldOptions,
7
8
  ScaffoldResult,
8
- PackageGroups,
9
- } from './core/types.js'
9
+ ValidatorId,
10
+ } from "./core/types.js";