create-taserjs 0.0.6 → 0.1.0

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 (82) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/addons/registry.cjs +3 -1
  3. package/dist/cjs/addons/registry.cjs.map +1 -1
  4. package/dist/cjs/addons/validators.cjs +10 -13
  5. package/dist/cjs/addons/validators.cjs.map +1 -1
  6. package/dist/cjs/cli.cjs +7 -5
  7. package/dist/cjs/cli.cjs.map +1 -1
  8. package/dist/cjs/commands/create.cjs +68 -48
  9. package/dist/cjs/commands/create.cjs.map +1 -1
  10. package/dist/cjs/commands/create.d.cts +2 -1
  11. package/dist/cjs/core/parse-options.cjs +48 -22
  12. package/dist/cjs/core/parse-options.cjs.map +1 -1
  13. package/dist/cjs/core/parse-options.d.cts +19 -4
  14. package/dist/cjs/core/project-config.cjs +5 -1
  15. package/dist/cjs/core/project-config.cjs.map +1 -1
  16. package/dist/cjs/core/resolve-packages.cjs +28 -66
  17. package/dist/cjs/core/resolve-packages.cjs.map +1 -1
  18. package/dist/cjs/core/resolve-packages.d.cts +1 -4
  19. package/dist/cjs/core/scaffold-engine.cjs +16 -27
  20. package/dist/cjs/core/scaffold-engine.cjs.map +1 -1
  21. package/dist/cjs/core/targets.cjs +162 -0
  22. package/dist/cjs/core/targets.cjs.map +1 -0
  23. package/dist/cjs/core/targets.d.cts +49 -0
  24. package/dist/cjs/core/types.cjs +21 -11
  25. package/dist/cjs/core/types.cjs.map +1 -1
  26. package/dist/cjs/core/types.d.cts +20 -4
  27. package/dist/cjs/frameworks/index.cjs +75 -174
  28. package/dist/cjs/frameworks/index.cjs.map +1 -1
  29. package/dist/cjs/frameworks/index.d.cts +18 -3
  30. package/dist/cjs/scaffold.d.cts +2 -2
  31. package/dist/cjs/templates/base.cjs +15 -99
  32. package/dist/cjs/templates/base.cjs.map +1 -1
  33. package/dist/cjs/templates/base.d.cts +0 -3
  34. package/dist/cjs/types.d.cts +1 -1
  35. package/dist/esm/addons/registry.js +4 -2
  36. package/dist/esm/addons/registry.js.map +1 -1
  37. package/dist/esm/addons/validators.js +10 -13
  38. package/dist/esm/addons/validators.js.map +1 -1
  39. package/dist/esm/cli.js +7 -5
  40. package/dist/esm/cli.js.map +1 -1
  41. package/dist/esm/commands/create.d.ts +2 -1
  42. package/dist/esm/commands/create.js +70 -50
  43. package/dist/esm/commands/create.js.map +1 -1
  44. package/dist/esm/core/parse-options.d.ts +19 -4
  45. package/dist/esm/core/parse-options.js +47 -23
  46. package/dist/esm/core/parse-options.js.map +1 -1
  47. package/dist/esm/core/project-config.js +5 -1
  48. package/dist/esm/core/project-config.js.map +1 -1
  49. package/dist/esm/core/resolve-packages.d.ts +1 -4
  50. package/dist/esm/core/resolve-packages.js +28 -66
  51. package/dist/esm/core/resolve-packages.js.map +1 -1
  52. package/dist/esm/core/scaffold-engine.js +18 -29
  53. package/dist/esm/core/scaffold-engine.js.map +1 -1
  54. package/dist/esm/core/targets.d.ts +49 -0
  55. package/dist/esm/core/targets.js +157 -0
  56. package/dist/esm/core/targets.js.map +1 -0
  57. package/dist/esm/core/types.d.ts +20 -4
  58. package/dist/esm/core/types.js +19 -11
  59. package/dist/esm/core/types.js.map +1 -1
  60. package/dist/esm/frameworks/index.d.ts +18 -3
  61. package/dist/esm/frameworks/index.js +72 -174
  62. package/dist/esm/frameworks/index.js.map +1 -1
  63. package/dist/esm/scaffold.d.ts +2 -2
  64. package/dist/esm/templates/base.d.ts +0 -3
  65. package/dist/esm/templates/base.js +16 -98
  66. package/dist/esm/templates/base.js.map +1 -1
  67. package/dist/esm/types.d.ts +1 -1
  68. package/package.json +3 -2
  69. package/src/addons/registry.ts +6 -2
  70. package/src/addons/validators.ts +10 -13
  71. package/src/cli.ts +6 -4
  72. package/src/commands/create.ts +82 -26
  73. package/src/core/parse-options.ts +84 -35
  74. package/src/core/project-config.ts +6 -1
  75. package/src/core/resolve-packages.ts +38 -76
  76. package/src/core/scaffold-engine.ts +41 -65
  77. package/src/core/targets.ts +202 -0
  78. package/src/core/types.ts +38 -24
  79. package/src/frameworks/index.ts +74 -182
  80. package/src/scaffold.ts +2 -2
  81. package/src/templates/base.ts +14 -98
  82. package/src/types.ts +3 -1
@@ -1,200 +1,98 @@
1
1
  //#region src/frameworks/index.ts
2
- function indexTemplate(type) {
3
- switch (type) {
4
- case "express": return `import 'dotenv/config'
2
+ function serverEntryTemplate(framework) {
3
+ switch (framework) {
4
+ case "hono": return {
5
+ fileName: "src/server.ts",
6
+ content: `import { Hono } from 'hono'
5
7
 
6
- import express from 'express'
7
- import { createExpressHandler } from '@taserjs/adapter-express'
8
-
9
- import { routeManifest } from '#src/routeManifest.gen.js'
10
- import { t } from '#src/taser.js'
11
-
12
- const router = t.create(routeManifest)
13
-
14
- const taser = createExpressHandler(router)
15
- const app = express()
16
- taser.mount('/{*splat}', app)
8
+ const app = new Hono()
17
9
 
18
- const port = Number(process.env.PORT ?? 3000)
19
- app.listen(port, () => {
20
- console.log(\`Express listening on http://localhost:\${port}\`)
10
+ app.get('/host', (c) => {
11
+ return c.text('Hello from Hono host!')
21
12
  })
22
- `;
23
- case "hono": return `import 'dotenv/config'
24
-
25
- import { serve } from '@hono/node-server'
26
- import { Hono } from 'hono'
27
13
 
28
- import { routeManifest } from '#src/routeManifest.gen.js'
29
- import { t } from '#src/taser.js'
14
+ export default app
15
+ `
16
+ };
17
+ case "express": return {
18
+ fileName: "src/server.node.ts",
19
+ content: `import express from 'express'
30
20
 
31
- const router = t.create(routeManifest)
32
-
33
- const app = new Hono()
34
- app.all('/*', c => router.fetch(c.req.raw))
21
+ const app = express()
35
22
 
36
- const port = Number(process.env.PORT ?? 3000)
37
- serve({ fetch: app.fetch, port }, () => {
38
- console.log(\`Hono listening on http://localhost:\${port}\`)
23
+ app.get('/host', (_req, res) => {
24
+ res.json({ message: 'Hello from Express host!' })
39
25
  })
40
- `;
41
- case "fastify": return `import 'dotenv/config'
42
-
43
- import Fastify from 'fastify'
44
- import { createFastifyHandler } from '@taserjs/adapter-fastify'
45
-
46
- import { routeManifest } from '#src/routeManifest.gen.js'
47
- import { t } from '#src/taser.js'
48
26
 
49
- const router = t.create(routeManifest)
27
+ export default app
28
+ `
29
+ };
30
+ case "fastify": return {
31
+ fileName: "src/server.node.ts",
32
+ content: `import Fastify from 'fastify'
50
33
 
51
- const taser = createFastifyHandler(router)
52
34
  const app = Fastify()
53
- taser.mount('/*', app)
54
-
55
- const port = Number(process.env.PORT ?? 3000)
56
- await app.listen({ port })
57
- console.log(\`Fastify listening on http://localhost:\${port}\`)
58
- `;
59
- case "bun": return `import 'dotenv/config'
60
-
61
- import { routeManifest } from '#src/routeManifest.gen.js'
62
- import { t } from '#src/taser.js'
63
-
64
- const router = t.create(routeManifest)
65
-
66
- const port = Number(process.env.PORT ?? 3000)
67
-
68
- export default {
69
- port,
70
- fetch(request: Request) {
71
- return router.fetch(request)
72
- },
73
- }
74
- `;
75
- case "deno": return `import 'dotenv/config'
76
-
77
- import { routeManifest } from '#src/routeManifest.gen.js'
78
- import { t } from '#src/taser.js'
79
-
80
- const router = t.create(routeManifest)
81
-
82
- const port = Number(process.env.PORT ?? 8000)
83
- Deno.serve({ port }, (request: Request) => router.fetch(request))
84
- `;
85
- case "aws-lambda": return `import 'dotenv/config'
86
-
87
- import { Hono } from 'hono'
88
- import { handle } from 'hono/aws-lambda'
89
-
90
- import { routeManifest } from '#src/routeManifest.gen.js'
91
- import { t } from '#src/taser.js'
92
-
93
- const router = t.create(routeManifest)
94
-
95
- const app = new Hono()
96
- app.all('/*', c => router.fetch(c.req.raw))
97
-
98
- export const handler = handle(app)
99
- `;
100
- case "cloudflare-workers": return `import 'dotenv/config'
101
-
102
- import { routeManifest } from '#src/routeManifest.gen.js'
103
- import { t } from '#src/taser.js'
104
35
 
105
- const router = t.create(routeManifest)
106
-
107
- export default {
108
- fetch(request: Request, env: unknown, ctx: unknown) {
109
- return router.fetch(request, env, ctx)
110
- },
111
- }
112
- `;
113
- case "netlify": return `import 'dotenv/config'
114
-
115
- import { Hono } from 'hono'
116
- import { handle } from 'hono/netlify'
117
-
118
- import { routeManifest } from '#src/routeManifest.gen.js'
119
- import { t } from '#src/taser.js'
120
-
121
- const router = t.create(routeManifest)
122
-
123
- const app = new Hono()
124
- app.all('/*', c => router.fetch(c.req.raw))
125
-
126
- export default handle(app)
127
- `;
128
- case "vercel": return `import 'dotenv/config'
129
-
130
- import { Hono } from 'hono'
131
- import { handle } from 'hono/vercel'
132
-
133
- import { routeManifest } from '#src/routeManifest.gen.js'
134
- import { t } from '#src/taser.js'
135
-
136
- const router = t.create(routeManifest)
137
-
138
- const app = new Hono()
139
- app.all('/*', c => router.fetch(c.req.raw))
140
-
141
- export default handle(app)
142
- `;
143
- case "azure-functions": return `import 'dotenv/config'
144
-
145
- import { app } from '@azure/functions'
146
- import { Hono } from 'hono'
147
- import { azureHonoHandler } from '@marplex/hono-azurefunc-adapter'
148
-
149
- import { routeManifest } from '#src/routeManifest.gen.js'
150
- import { t } from '#src/taser.js'
151
-
152
- const router = t.create(routeManifest)
153
-
154
- const honoApp = new Hono()
155
- honoApp.all('/*', c => router.fetch(c.req.raw))
156
-
157
- app.http('httpTrigger', {
158
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'],
159
- authLevel: 'anonymous',
160
- route: '{*proxy}',
161
- handler: azureHonoHandler(honoApp.fetch),
36
+ app.get('/host', async () => {
37
+ return { message: 'Hello from Fastify host!' }
162
38
  })
163
- `;
164
- case "google-cloud-run": return `import 'dotenv/config'
165
-
166
- import { serve } from '@hono/node-server'
167
39
 
168
- import { routeManifest } from '#src/routeManifest.gen.js'
169
- import { t } from '#src/taser.js'
40
+ await app.ready()
170
41
 
171
- const router = t.create(routeManifest)
42
+ export default app.routing
43
+ `
44
+ };
45
+ default: return null;
46
+ }
47
+ }
48
+ var FRAMEWORK_ENTRIES = {
49
+ none: {
50
+ id: "none",
51
+ serverEntry: null,
52
+ deps: [],
53
+ devDeps: []
54
+ },
55
+ hono: {
56
+ id: "hono",
57
+ serverEntry: serverEntryTemplate("hono"),
58
+ deps: ["hono"],
59
+ devDeps: []
60
+ },
61
+ express: {
62
+ id: "express",
63
+ serverEntry: serverEntryTemplate("express"),
64
+ deps: ["express", "srvx"],
65
+ devDeps: ["@types/express"]
66
+ },
67
+ fastify: {
68
+ id: "fastify",
69
+ serverEntry: serverEntryTemplate("fastify"),
70
+ deps: ["fastify", "srvx"],
71
+ devDeps: []
72
+ }
73
+ };
74
+ function nitroConfigTemplate(nitroPreset) {
75
+ return `import { defineConfig } from 'nitro/config'
172
76
 
173
- const port = Number(process.env.PORT ?? 8080)
174
- serve({ fetch: router.fetch, port }, () => {
175
- console.log(\`Cloud Run listening on http://localhost:\${port}\`)
77
+ export default defineConfig({
78
+ preset: '${nitroPreset}',
176
79
  })
177
80
  `;
178
- default: return `import 'dotenv/config'
179
-
180
- import { serve } from '@hono/node-server'
181
-
182
- import { routeManifest } from '#src/routeManifest.gen.js'
183
- import { t } from '#src/taser.js'
184
-
185
- const router = t.create(routeManifest)
81
+ }
82
+ function viteConfigTemplate() {
83
+ return `import { defineConfig } from 'vite'
84
+ import { nitro } from 'nitro/vite'
85
+ import { taser } from '@taserjs/router-plugin/vite'
186
86
 
187
- const port = Number(process.env.PORT ?? 3000)
188
- serve({ fetch: router.fetch, port }, () => {
189
- console.log(\`Node listening on http://localhost:\${port}\`)
87
+ export default defineConfig({
88
+ plugins: [taser(), nitro()],
190
89
  })
191
90
  `;
192
- }
193
91
  }
194
- function taserTsTemplate(_type = "node") {
92
+ function taserTsTemplate() {
195
93
  return `import { createTaserApp } from '@taserjs/router'
196
94
 
197
- import { context } from '#src/context.js'
95
+ import { context } from './context.js'
198
96
 
199
97
  export const t = createTaserApp({
200
98
  response: { validate: true },
@@ -202,6 +100,6 @@ export const t = createTaserApp({
202
100
  `;
203
101
  }
204
102
  //#endregion
205
- export { indexTemplate, taserTsTemplate };
103
+ export { FRAMEWORK_ENTRIES, nitroConfigTemplate, serverEntryTemplate, taserTsTemplate, viteConfigTemplate };
206
104
 
207
105
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/frameworks/index.ts"],"sourcesContent":["import type { ProjectType } from \"../core/types.js\";\n\nexport function indexTemplate(type: ProjectType): string {\n switch (type) {\n case \"express\":\n return `import 'dotenv/config'\n\nimport express from 'express'\nimport { createExpressHandler } from '@taserjs/adapter-express'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst taser = createExpressHandler(router)\nconst app = express()\ntaser.mount('/{*splat}', app)\n\nconst port = Number(process.env.PORT ?? 3000)\napp.listen(port, () => {\n console.log(\\`Express listening on http://localhost:\\${port}\\`)\n})\n`;\n case \"hono\":\n return `import 'dotenv/config'\n\nimport { serve } from '@hono/node-server'\nimport { Hono } from 'hono'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst app = new Hono()\napp.all('/*', c => router.fetch(c.req.raw))\n\nconst port = Number(process.env.PORT ?? 3000)\nserve({ fetch: app.fetch, port }, () => {\n console.log(\\`Hono listening on http://localhost:\\${port}\\`)\n})\n`;\n case \"fastify\":\n return `import 'dotenv/config'\n\nimport Fastify from 'fastify'\nimport { createFastifyHandler } from '@taserjs/adapter-fastify'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst taser = createFastifyHandler(router)\nconst app = Fastify()\ntaser.mount('/*', app)\n\nconst port = Number(process.env.PORT ?? 3000)\nawait app.listen({ port })\nconsole.log(\\`Fastify listening on http://localhost:\\${port}\\`)\n`;\n case \"bun\":\n return `import 'dotenv/config'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst port = Number(process.env.PORT ?? 3000)\n\nexport default {\n port,\n fetch(request: Request) {\n return router.fetch(request)\n },\n}\n`;\n case \"deno\":\n return `import 'dotenv/config'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst port = Number(process.env.PORT ?? 8000)\nDeno.serve({ port }, (request: Request) => router.fetch(request))\n`;\n case \"aws-lambda\":\n return `import 'dotenv/config'\n\nimport { Hono } from 'hono'\nimport { handle } from 'hono/aws-lambda'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst app = new Hono()\napp.all('/*', c => router.fetch(c.req.raw))\n\nexport const handler = handle(app)\n`;\n case \"cloudflare-workers\":\n return `import 'dotenv/config'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nexport default {\n fetch(request: Request, env: unknown, ctx: unknown) {\n return router.fetch(request, env, ctx)\n },\n}\n`;\n case \"netlify\":\n return `import 'dotenv/config'\n\nimport { Hono } from 'hono'\nimport { handle } from 'hono/netlify'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst app = new Hono()\napp.all('/*', c => router.fetch(c.req.raw))\n\nexport default handle(app)\n`;\n case \"vercel\":\n return `import 'dotenv/config'\n\nimport { Hono } from 'hono'\nimport { handle } from 'hono/vercel'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst app = new Hono()\napp.all('/*', c => router.fetch(c.req.raw))\n\nexport default handle(app)\n`;\n case \"azure-functions\":\n return `import 'dotenv/config'\n\nimport { app } from '@azure/functions'\nimport { Hono } from 'hono'\nimport { azureHonoHandler } from '@marplex/hono-azurefunc-adapter'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst honoApp = new Hono()\nhonoApp.all('/*', c => router.fetch(c.req.raw))\n\napp.http('httpTrigger', {\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'],\n authLevel: 'anonymous',\n route: '{*proxy}',\n handler: azureHonoHandler(honoApp.fetch),\n})\n`;\n case \"google-cloud-run\":\n return `import 'dotenv/config'\n\nimport { serve } from '@hono/node-server'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst port = Number(process.env.PORT ?? 8080)\nserve({ fetch: router.fetch, port }, () => {\n console.log(\\`Cloud Run listening on http://localhost:\\${port}\\`)\n})\n`;\n case \"node\":\n default:\n return `import 'dotenv/config'\n\nimport { serve } from '@hono/node-server'\n\nimport { routeManifest } from '#src/routeManifest.gen.js'\nimport { t } from '#src/taser.js'\n\nconst router = t.create(routeManifest)\n\nconst port = Number(process.env.PORT ?? 3000)\nserve({ fetch: router.fetch, port }, () => {\n console.log(\\`Node listening on http://localhost:\\${port}\\`)\n})\n`;\n }\n}\n\nexport function taserTsTemplate(_type: ProjectType = \"node\"): string {\n return `import { createTaserApp } from '@taserjs/router'\n\nimport { context } from '#src/context.js'\n\nexport const t = createTaserApp({\n response: { validate: true },\n}).context(context)\n`;\n}\n"],"mappings":";AAEA,SAAgB,cAAc,MAA2B;CACvD,QAAQ,MAAR;EACE,KAAK,WACH,OAAO;;;;;;;;;;;;;;;;;;;EAmBT,KAAK,QACH,OAAO;;;;;;;;;;;;;;;;;;EAkBT,KAAK,WACH,OAAO;;;;;;;;;;;;;;;;;;EAkBT,KAAK,OACH,OAAO;;;;;;;;;;;;;;;;EAgBT,KAAK,QACH,OAAO;;;;;;;;;;EAUT,KAAK,cACH,OAAO;;;;;;;;;;;;;;;EAeT,KAAK,sBACH,OAAO;;;;;;;;;;;;;EAaT,KAAK,WACH,OAAO;;;;;;;;;;;;;;;EAeT,KAAK,UACH,OAAO;;;;;;;;;;;;;;;EAeT,KAAK,mBACH,OAAO;;;;;;;;;;;;;;;;;;;;;EAqBT,KAAK,oBACH,OAAO;;;;;;;;;;;;;;EAeT,SACE,OAAO;;;;;;;;;;;;;;CAcX;AACF;AAEA,SAAgB,gBAAgB,QAAqB,QAAgB;CACnE,OAAO;;;;;;;;AAQT"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/frameworks/index.ts"],"sourcesContent":["import type { Framework } from \"../core/types.js\";\n\nexport function serverEntryTemplate(\n framework: Framework,\n): { fileName: string; content: string } | null {\n switch (framework) {\n case \"hono\":\n return {\n fileName: \"src/server.ts\",\n content: `import { Hono } from 'hono'\n\nconst app = new Hono()\n\napp.get('/host', (c) => {\n return c.text('Hello from Hono host!')\n})\n\nexport default app\n`,\n };\n case \"express\":\n return {\n fileName: \"src/server.node.ts\",\n content: `import express from 'express'\n\nconst app = express()\n\napp.get('/host', (_req, res) => {\n res.json({ message: 'Hello from Express host!' })\n})\n\nexport default app\n`,\n };\n case \"fastify\":\n return {\n fileName: \"src/server.node.ts\",\n content: `import Fastify from 'fastify'\n\nconst app = Fastify()\n\napp.get('/host', async () => {\n return { message: 'Hello from Fastify host!' }\n})\n\nawait app.ready()\n\nexport default app.routing\n`,\n };\n default:\n return null;\n }\n}\n\nexport type FrameworkEntry = {\n id: Framework;\n serverEntry: { fileName: string; content: string } | null;\n deps: string[];\n devDeps: string[];\n};\n\nexport const FRAMEWORK_ENTRIES: Record<Framework, FrameworkEntry> = {\n none: { id: \"none\", serverEntry: null, deps: [], devDeps: [] },\n hono: { id: \"hono\", serverEntry: serverEntryTemplate(\"hono\"), deps: [\"hono\"], devDeps: [] },\n express: {\n id: \"express\",\n serverEntry: serverEntryTemplate(\"express\"),\n deps: [\"express\", \"srvx\"],\n devDeps: [\"@types/express\"],\n },\n fastify: {\n id: \"fastify\",\n // srvx bridges the Fastify Node handler to fetch (see compose codegen).\n serverEntry: serverEntryTemplate(\"fastify\"),\n deps: [\"fastify\", \"srvx\"],\n devDeps: [],\n },\n};\n\nexport function nitroConfigTemplate(nitroPreset: string): string {\n return `import { defineConfig } from 'nitro/config'\n\nexport default defineConfig({\n preset: '${nitroPreset}',\n})\n`;\n}\n\nexport function viteConfigTemplate(): string {\n return `import { defineConfig } from 'vite'\nimport { nitro } from 'nitro/vite'\nimport { taser } from '@taserjs/router-plugin/vite'\n\nexport default defineConfig({\n plugins: [taser(), nitro()],\n})\n`;\n}\n\nexport function taserTsTemplate(): string {\n return `import { createTaserApp } from '@taserjs/router'\n\nimport { context } from './context.js'\n\nexport const t = createTaserApp({\n response: { validate: true },\n}).context(context)\n`;\n}\n"],"mappings":";AAEA,SAAgB,oBACd,WAC8C;CAC9C,QAAQ,WAAR;EACE,KAAK,QACH,OAAO;GACL,UAAU;GACV,SAAS;;;;;;;;;;EAUX;EACF,KAAK,WACH,OAAO;GACL,UAAU;GACV,SAAS;;;;;;;;;;EAUX;EACF,KAAK,WACH,OAAO;GACL,UAAU;GACV,SAAS;;;;;;;;;;;;EAYX;EACF,SACE,OAAO;CACX;AACF;AASA,IAAa,oBAAuD;CAClE,MAAM;EAAE,IAAI;EAAQ,aAAa;EAAM,MAAM,CAAC;EAAG,SAAS,CAAC;CAAE;CAC7D,MAAM;EAAE,IAAI;EAAQ,aAAa,oBAAoB,MAAM;EAAG,MAAM,CAAC,MAAM;EAAG,SAAS,CAAC;CAAE;CAC1F,SAAS;EACP,IAAI;EACJ,aAAa,oBAAoB,SAAS;EAC1C,MAAM,CAAC,WAAW,MAAM;EACxB,SAAS,CAAC,gBAAgB;CAC5B;CACA,SAAS;EACP,IAAI;EAEJ,aAAa,oBAAoB,SAAS;EAC1C,MAAM,CAAC,WAAW,MAAM;EACxB,SAAS,CAAC;CACZ;AACF;AAEA,SAAgB,oBAAoB,aAA6B;CAC/D,OAAO;;;aAGI,YAAY;;;AAGzB;AAEA,SAAgB,qBAA6B;CAC3C,OAAO;;;;;;;;AAQT;AAEA,SAAgB,kBAA0B;CACxC,OAAO;;;;;;;;AAQT"}
@@ -1,3 +1,3 @@
1
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';
2
+ export { resolvePackages } from './core/resolve-packages.js';
3
+ export type { PackageGroups, ScaffoldOptions, ScaffoldResult } from './core/types.js';
@@ -1,12 +1,9 @@
1
1
  import { BootBinding } from '../addons/types.js';
2
2
  import { ScaffoldContext } from '../core/types.js';
3
3
  export declare function packageJsonTemplate(projectName: string, scripts?: Record<string, string>): string;
4
- export declare function tsdownConfigTemplate(): string;
5
4
  export declare function tsconfigTemplate(): string;
6
5
  export declare function gitignoreTemplate(): string;
7
6
  export declare function contextTemplate(bindings: BootBinding[]): string;
8
7
  export declare function rootLayoutTemplate(): string;
9
8
  export declare function indexRouteTemplate(): string;
10
9
  export declare function healthRouteTemplate(ctx: ScaffoldContext): string;
11
- /** Minimal placeholder until `taser generate` runs. */
12
- export declare function starterManifestTemplate(): string;
@@ -5,52 +5,36 @@ function packageJsonTemplate(projectName, scripts = {}) {
5
5
  version: "1.0.0",
6
6
  private: true,
7
7
  type: "module",
8
- imports: { "#src/*": "./src/*" },
8
+ imports: { "#taserjs/router": "./src/taser.ts" },
9
9
  scripts: {
10
- dev: "run-p dev:server dev:taser",
11
- "dev:server": "tsx watch src/index.ts",
12
- "dev:taser": "taser watch",
13
- start: "tsx src/index.ts",
14
- generate: "taser generate",
15
- build: "taser generate && tsdown",
16
- serve: "node dist/index.mjs",
10
+ dev: "vite",
11
+ build: "vite build",
17
12
  typecheck: "tsc --noEmit -p tsconfig.json",
18
13
  ...scripts
19
14
  }
20
15
  };
21
16
  return `${JSON.stringify(pkg, null, 2)}\n`;
22
17
  }
23
- function tsdownConfigTemplate() {
24
- return `import { defineConfig } from 'tsdown'
25
-
26
- export default defineConfig({
27
- entry: ['./src/index.ts'],
28
- platform: 'node',
29
- outDir: 'dist',
30
- clean: true,
31
- sourcemap: true,
32
- })
33
- `;
34
- }
35
18
  function tsconfigTemplate() {
36
19
  return `${JSON.stringify({
37
20
  compilerOptions: {
38
21
  target: "ES2022",
39
22
  module: "NodeNext",
40
- paths: { "#src/*": ["./src/*"] },
23
+ paths: { "#taserjs/router": ["./src/taser.ts"] },
41
24
  strict: true,
42
25
  skipLibCheck: true,
43
26
  verbatimModuleSyntax: true,
44
27
  isolatedModules: true,
45
- noEmit: true,
46
- types: ["node"]
28
+ noEmit: true
47
29
  },
48
- include: ["src"]
30
+ include: ["src", ".taser/types/**/*.d.ts"]
49
31
  }, null, 2)}\n`;
50
32
  }
51
33
  function gitignoreTemplate() {
52
34
  return `node_modules
53
35
  dist
36
+ .output
37
+ .taser
54
38
  .DS_Store
55
39
  *.log
56
40
  .env
@@ -75,21 +59,21 @@ ${bootBlock}
75
59
  function rootLayoutTemplate() {
76
60
  return `import { cors } from '@taserjs/router/cors'
77
61
 
78
- import { t } from '#src/taser.js'
62
+ import { t } from '#taserjs/router'
79
63
 
80
64
  export const Middleware = t.middleware('/$')
81
65
  .use(cors())
82
66
  `;
83
67
  }
84
68
  function indexRouteTemplate() {
85
- return `import { reply } from '@taserjs/router'
86
- import { t } from '#src/taser.js'
69
+ return `import { json } from '@taserjs/router/reply'
70
+ import { t } from '#taserjs/router'
87
71
 
88
72
  const GET = t.get('/')
89
73
 
90
74
  export type RouteContext = typeof GET.$Infer.Context
91
75
  export const Route = GET.handler((_ctx) => {
92
- return reply.json({ message: 'Welcome to Taser' })
76
+ return json({ message: 'Welcome to Taser' })
93
77
  })
94
78
  `;
95
79
  }
@@ -98,84 +82,18 @@ function healthRouteTemplate(ctx) {
98
82
  if (ctx.logger) lines.push(" ctx.logger.info('health check')");
99
83
  if (ctx.db) lines.push(" // ctx.db is available from context boot");
100
84
  const body = lines.length > 0 ? `${lines.join("\n")}\n` : "";
101
- return `import { reply } from '@taserjs/router'
102
- import { t } from '#src/taser.js'
85
+ return `import { json } from '@taserjs/router/reply'
86
+ import { t } from '#taserjs/router'
103
87
 
104
88
  const GET = t.get('/health')
105
89
 
106
90
  export type RouteContext = typeof GET.$Infer.Context
107
91
  export const Route = GET.handler(${lines.length > 0 ? "(ctx)" : "(_ctx)"} => {
108
- ${body} return reply.json({ ok: true })
92
+ ${body} return json({ ok: true })
109
93
  })
110
94
  `;
111
95
  }
112
- /** Minimal placeholder until `taser generate` runs. */
113
- function starterManifestTemplate() {
114
- return `/* eslint-disable */
115
- // Run \`pnpm generate\` (taser generate) to replace this file.
116
- import { Middleware as RootSplatLayoutImport } from './routes/$.js'
117
- import { Route as RootIndexGetRouteImport } from './routes/index.get.js'
118
- import { Route as HealthGetRouteImport } from './routes/health.get.js'
119
-
120
- export const routeManifest = {
121
- layouts: {
122
- '/$': {
123
- middlewares: RootSplatLayoutImport,
124
- },
125
- },
126
- routes: {
127
- '/': {
128
- GET: {
129
- layoutChain: ['/$'],
130
- route: RootIndexGetRouteImport,
131
- },
132
- },
133
- '/health': {
134
- GET: {
135
- layoutChain: ['/$'],
136
- route: HealthGetRouteImport,
137
- },
138
- },
139
- },
140
- } as const
141
-
142
- export type RoutePathGen = '/' | '/health'
143
- export type LayoutIdGen = '/$'
144
- export type LayoutTreeGen = {
145
- '/$': {
146
- parent: null
147
- middlewares: typeof RootSplatLayoutImport
148
- }
149
- }
150
- export type RouteByPathMethodGen = {
151
- '/': {
152
- GET: {
153
- parent: '/$'
154
- layoutChain: ['/$']
155
- route: typeof RootIndexGetRouteImport
156
- }
157
- }
158
- '/health': {
159
- GET: {
160
- parent: '/$'
161
- layoutChain: ['/$']
162
- route: typeof HealthGetRouteImport
163
- }
164
- }
165
- }
166
- export type RouteManifest = typeof routeManifest
167
-
168
- declare module '@taserjs/router' {
169
- interface RouterRegister {
170
- RoutePath: RoutePathGen
171
- LayoutId: LayoutIdGen
172
- LayoutTree: LayoutTreeGen
173
- RouteByPathMethod: RouteByPathMethodGen
174
- }
175
- }
176
- `;
177
- }
178
96
  //#endregion
179
- export { contextTemplate, gitignoreTemplate, healthRouteTemplate, indexRouteTemplate, packageJsonTemplate, rootLayoutTemplate, starterManifestTemplate, tsconfigTemplate, tsdownConfigTemplate };
97
+ export { contextTemplate, gitignoreTemplate, healthRouteTemplate, indexRouteTemplate, packageJsonTemplate, rootLayoutTemplate, tsconfigTemplate };
180
98
 
181
99
  //# sourceMappingURL=base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","names":[],"sources":["../../../src/templates/base.ts"],"sourcesContent":["import type { BootBinding } from \"../addons/types.js\";\nimport type { ScaffoldContext } from \"../core/types.js\";\n\nexport function packageJsonTemplate(\n projectName: string,\n scripts: Record<string, string> = {},\n): string {\n const pkg = {\n name: projectName,\n version: \"1.0.0\",\n private: true,\n type: \"module\",\n imports: {\n \"#src/*\": \"./src/*\",\n },\n scripts: {\n dev: \"run-p dev:server dev:taser\",\n \"dev:server\": \"tsx watch src/index.ts\",\n \"dev:taser\": \"taser watch\",\n start: \"tsx src/index.ts\",\n generate: \"taser generate\",\n build: \"taser generate && tsdown\",\n serve: \"node dist/index.mjs\",\n typecheck: \"tsc --noEmit -p tsconfig.json\",\n ...scripts,\n },\n };\n\n return `${JSON.stringify(pkg, null, 2)}\\n`;\n}\n\nexport function tsdownConfigTemplate(): string {\n return `import { defineConfig } from 'tsdown'\n\nexport default defineConfig({\n entry: ['./src/index.ts'],\n platform: 'node',\n outDir: 'dist',\n clean: true,\n sourcemap: true,\n})\n`;\n}\n\nexport function tsconfigTemplate(): string {\n return `${JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2022\",\n module: \"NodeNext\",\n paths: {\n \"#src/*\": [\"./src/*\"],\n },\n strict: true,\n skipLibCheck: true,\n verbatimModuleSyntax: true,\n isolatedModules: true,\n noEmit: true,\n types: [\"node\"],\n },\n include: [\"src\"],\n },\n null,\n 2,\n )}\\n`;\n}\n\nexport function gitignoreTemplate(): string {\n return `node_modules\ndist\n.DS_Store\n*.log\n.env\nlocal.db\ndrizzle\n`;\n}\n\nexport function contextTemplate(bindings: BootBinding[]): string {\n const imports = bindings.map(\n (binding) => `import { ${binding.factoryName} } from '${binding.importPath}'`,\n );\n\n const bootBody =\n bindings.length > 0\n ? bindings.map((binding) => ` ${binding.key}: ${binding.factoryName}(),`).join(\"\\n\")\n : \"\";\n\n const bootBlock = bindings.length > 0 ? ` boot: () => ({\\n${bootBody}\\n }),` : \"\";\n\n const importBlock = imports.length > 0 ? `${imports.join(\"\\n\")}\\n\\n` : \"\";\n\n return `${importBlock}import { createContext } from '@taserjs/router'\n\nexport const context = createContext({\n${bootBlock}\n request: () => ({\n requestId: crypto.randomUUID(),\n }),\n})\n`;\n}\n\nexport function rootLayoutTemplate(): string {\n return `import { cors } from '@taserjs/router/cors'\n\nimport { t } from '#src/taser.js'\n\nexport const Middleware = t.middleware('/$')\n .use(cors())\n`;\n}\n\nexport function indexRouteTemplate(): string {\n return `import { reply } from '@taserjs/router'\nimport { t } from '#src/taser.js'\n\nconst GET = t.get('/')\n\nexport type RouteContext = typeof GET.$Infer.Context\nexport const Route = GET.handler((_ctx) => {\n return reply.json({ message: 'Welcome to Taser' })\n})\n`;\n}\n\nexport function healthRouteTemplate(ctx: ScaffoldContext): string {\n const lines: string[] = [];\n\n if (ctx.logger) {\n lines.push(\" ctx.logger.info('health check')\");\n }\n\n if (ctx.db) {\n lines.push(\" // ctx.db is available from context boot\");\n }\n\n const body = lines.length > 0 ? `${lines.join(\"\\n\")}\\n` : \"\";\n const ctxArg = lines.length > 0 ? \"(ctx)\" : \"(_ctx)\";\n\n return `import { reply } from '@taserjs/router'\nimport { t } from '#src/taser.js'\n\nconst GET = t.get('/health')\n\nexport type RouteContext = typeof GET.$Infer.Context\nexport const Route = GET.handler(${ctxArg} => {\n${body} return reply.json({ ok: true })\n})\n`;\n}\n\n/** Minimal placeholder until `taser generate` runs. */\nexport function starterManifestTemplate(): string {\n return `/* eslint-disable */\n// Run \\`pnpm generate\\` (taser generate) to replace this file.\nimport { Middleware as RootSplatLayoutImport } from './routes/$.js'\nimport { Route as RootIndexGetRouteImport } from './routes/index.get.js'\nimport { Route as HealthGetRouteImport } from './routes/health.get.js'\n\nexport const routeManifest = {\n layouts: {\n '/$': {\n middlewares: RootSplatLayoutImport,\n },\n },\n routes: {\n '/': {\n GET: {\n layoutChain: ['/$'],\n route: RootIndexGetRouteImport,\n },\n },\n '/health': {\n GET: {\n layoutChain: ['/$'],\n route: HealthGetRouteImport,\n },\n },\n },\n} as const\n\nexport type RoutePathGen = '/' | '/health'\nexport type LayoutIdGen = '/$'\nexport type LayoutTreeGen = {\n '/$': {\n parent: null\n middlewares: typeof RootSplatLayoutImport\n }\n}\nexport type RouteByPathMethodGen = {\n '/': {\n GET: {\n parent: '/$'\n layoutChain: ['/$']\n route: typeof RootIndexGetRouteImport\n }\n }\n '/health': {\n GET: {\n parent: '/$'\n layoutChain: ['/$']\n route: typeof HealthGetRouteImport\n }\n }\n}\nexport type RouteManifest = typeof routeManifest\n\ndeclare module '@taserjs/router' {\n interface RouterRegister {\n RoutePath: RoutePathGen\n LayoutId: LayoutIdGen\n LayoutTree: LayoutTreeGen\n RouteByPathMethod: RouteByPathMethodGen\n }\n}\n`;\n}\n"],"mappings":";AAGA,SAAgB,oBACd,aACA,UAAkC,CAAC,GAC3B;CACR,MAAM,MAAM;EACV,MAAM;EACN,SAAS;EACT,SAAS;EACT,MAAM;EACN,SAAS,EACP,UAAU,UACZ;EACA,SAAS;GACP,KAAK;GACL,cAAc;GACd,aAAa;GACb,OAAO;GACP,UAAU;GACV,OAAO;GACP,OAAO;GACP,WAAW;GACX,GAAG;EACL;CACF;CAEA,OAAO,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,EAAE;AACzC;AAEA,SAAgB,uBAA+B;CAC7C,OAAO;;;;;;;;;;AAUT;AAEA,SAAgB,mBAA2B;CACzC,OAAO,GAAG,KAAK,UACb;EACE,iBAAiB;GACf,QAAQ;GACR,QAAQ;GACR,OAAO,EACL,UAAU,CAAC,SAAS,EACtB;GACA,QAAQ;GACR,cAAc;GACd,sBAAsB;GACtB,iBAAiB;GACjB,QAAQ;GACR,OAAO,CAAC,MAAM;EAChB;EACA,SAAS,CAAC,KAAK;CACjB,GACA,MACA,CACF,EAAE;AACJ;AAEA,SAAgB,oBAA4B;CAC1C,OAAO;;;;;;;;AAQT;AAEA,SAAgB,gBAAgB,UAAiC;CAC/D,MAAM,UAAU,SAAS,KACtB,YAAY,YAAY,QAAQ,YAAY,WAAW,QAAQ,WAAW,EAC7E;CAEA,MAAM,WACJ,SAAS,SAAS,IACd,SAAS,KAAK,YAAY,OAAO,QAAQ,IAAI,IAAI,QAAQ,YAAY,IAAI,CAAC,CAAC,KAAK,IAAI,IACpF;CAEN,MAAM,YAAY,SAAS,SAAS,IAAI,qBAAqB,SAAS,WAAW;CAIjF,OAAO,GAFa,QAAQ,SAAS,IAAI,GAAG,QAAQ,KAAK,IAAI,EAAE,QAAQ,GAEjD;;;EAGtB,UAAU;;;;;;AAMZ;AAEA,SAAgB,qBAA6B;CAC3C,OAAO;;;;;;;AAOT;AAEA,SAAgB,qBAA6B;CAC3C,OAAO;;;;;;;;;;AAUT;AAEA,SAAgB,oBAAoB,KAA8B;CAChE,MAAM,QAAkB,CAAC;CAEzB,IAAI,IAAI,QACN,MAAM,KAAK,mCAAmC;CAGhD,IAAI,IAAI,IACN,MAAM,KAAK,4CAA4C;CAGzD,MAAM,OAAO,MAAM,SAAS,IAAI,GAAG,MAAM,KAAK,IAAI,EAAE,MAAM;CAG1D,OAAO;;;;;;mCAFQ,MAAM,SAAS,IAAI,UAAU,SAQJ;EACxC,KAAK;;;AAGP;;AAGA,SAAgB,0BAAkC;CAChD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DT"}
1
+ {"version":3,"file":"base.js","names":[],"sources":["../../../src/templates/base.ts"],"sourcesContent":["import type { BootBinding } from \"../addons/types.js\";\nimport type { ScaffoldContext } from \"../core/types.js\";\n\nexport function packageJsonTemplate(\n projectName: string,\n scripts: Record<string, string> = {},\n): string {\n const pkg = {\n name: projectName,\n version: \"1.0.0\",\n private: true,\n type: \"module\",\n imports: {\n \"#taserjs/router\": \"./src/taser.ts\",\n },\n scripts: {\n dev: \"vite\",\n build: \"vite build\",\n typecheck: \"tsc --noEmit -p tsconfig.json\",\n ...scripts,\n },\n };\n\n return `${JSON.stringify(pkg, null, 2)}\\n`;\n}\n\nexport function tsconfigTemplate(): string {\n return `${JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2022\",\n module: \"NodeNext\",\n paths: {\n \"#taserjs/router\": [\"./src/taser.ts\"],\n },\n strict: true,\n skipLibCheck: true,\n verbatimModuleSyntax: true,\n isolatedModules: true,\n noEmit: true,\n },\n include: [\"src\", \".taser/types/**/*.d.ts\"],\n },\n null,\n 2,\n )}\\n`;\n}\n\nexport function gitignoreTemplate(): string {\n return `node_modules\ndist\n.output\n.taser\n.DS_Store\n*.log\n.env\nlocal.db\ndrizzle\n`;\n}\n\nexport function contextTemplate(bindings: BootBinding[]): string {\n const imports = bindings.map(\n (binding) => `import { ${binding.factoryName} } from '${binding.importPath}'`,\n );\n\n const bootBody =\n bindings.length > 0\n ? bindings.map((binding) => ` ${binding.key}: ${binding.factoryName}(),`).join(\"\\n\")\n : \"\";\n\n const bootBlock = bindings.length > 0 ? ` boot: () => ({\\n${bootBody}\\n }),` : \"\";\n\n const importBlock = imports.length > 0 ? `${imports.join(\"\\n\")}\\n\\n` : \"\";\n\n return `${importBlock}import { createContext } from '@taserjs/router'\n\nexport const context = createContext({\n${bootBlock}\n request: () => ({\n requestId: crypto.randomUUID(),\n }),\n})\n`;\n}\n\nexport function rootLayoutTemplate(): string {\n return `import { cors } from '@taserjs/router/cors'\n\nimport { t } from '#taserjs/router'\n\nexport const Middleware = t.middleware('/$')\n .use(cors())\n`;\n}\n\nexport function indexRouteTemplate(): string {\n return `import { json } from '@taserjs/router/reply'\nimport { t } from '#taserjs/router'\n\nconst GET = t.get('/')\n\nexport type RouteContext = typeof GET.$Infer.Context\nexport const Route = GET.handler((_ctx) => {\n return json({ message: 'Welcome to Taser' })\n})\n`;\n}\n\nexport function healthRouteTemplate(ctx: ScaffoldContext): string {\n const lines: string[] = [];\n\n if (ctx.logger) {\n lines.push(\" ctx.logger.info('health check')\");\n }\n\n if (ctx.db) {\n lines.push(\" // ctx.db is available from context boot\");\n }\n\n const body = lines.length > 0 ? `${lines.join(\"\\n\")}\\n` : \"\";\n const ctxArg = lines.length > 0 ? \"(ctx)\" : \"(_ctx)\";\n\n return `import { json } from '@taserjs/router/reply'\nimport { t } from '#taserjs/router'\n\nconst GET = t.get('/health')\n\nexport type RouteContext = typeof GET.$Infer.Context\nexport const Route = GET.handler(${ctxArg} => {\n${body} return json({ ok: true })\n})\n`;\n}\n"],"mappings":";AAGA,SAAgB,oBACd,aACA,UAAkC,CAAC,GAC3B;CACR,MAAM,MAAM;EACV,MAAM;EACN,SAAS;EACT,SAAS;EACT,MAAM;EACN,SAAS,EACP,mBAAmB,iBACrB;EACA,SAAS;GACP,KAAK;GACL,OAAO;GACP,WAAW;GACX,GAAG;EACL;CACF;CAEA,OAAO,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,EAAE;AACzC;AAEA,SAAgB,mBAA2B;CACzC,OAAO,GAAG,KAAK,UACb;EACE,iBAAiB;GACf,QAAQ;GACR,QAAQ;GACR,OAAO,EACL,mBAAmB,CAAC,gBAAgB,EACtC;GACA,QAAQ;GACR,cAAc;GACd,sBAAsB;GACtB,iBAAiB;GACjB,QAAQ;EACV;EACA,SAAS,CAAC,OAAO,wBAAwB;CAC3C,GACA,MACA,CACF,EAAE;AACJ;AAEA,SAAgB,oBAA4B;CAC1C,OAAO;;;;;;;;;;AAUT;AAEA,SAAgB,gBAAgB,UAAiC;CAC/D,MAAM,UAAU,SAAS,KACtB,YAAY,YAAY,QAAQ,YAAY,WAAW,QAAQ,WAAW,EAC7E;CAEA,MAAM,WACJ,SAAS,SAAS,IACd,SAAS,KAAK,YAAY,OAAO,QAAQ,IAAI,IAAI,QAAQ,YAAY,IAAI,CAAC,CAAC,KAAK,IAAI,IACpF;CAEN,MAAM,YAAY,SAAS,SAAS,IAAI,qBAAqB,SAAS,WAAW;CAIjF,OAAO,GAFa,QAAQ,SAAS,IAAI,GAAG,QAAQ,KAAK,IAAI,EAAE,QAAQ,GAEjD;;;EAGtB,UAAU;;;;;;AAMZ;AAEA,SAAgB,qBAA6B;CAC3C,OAAO;;;;;;;AAOT;AAEA,SAAgB,qBAA6B;CAC3C,OAAO;;;;;;;;;;AAUT;AAEA,SAAgB,oBAAoB,KAA8B;CAChE,MAAM,QAAkB,CAAC;CAEzB,IAAI,IAAI,QACN,MAAM,KAAK,mCAAmC;CAGhD,IAAI,IAAI,IACN,MAAM,KAAK,4CAA4C;CAGzD,MAAM,OAAO,MAAM,SAAS,IAAI,GAAG,MAAM,KAAK,IAAI,EAAE,MAAM;CAG1D,OAAO;;;;;;mCAFQ,MAAM,SAAS,IAAI,UAAU,SAQJ;EACxC,KAAK;;;AAGP"}
@@ -1 +1 @@
1
- export type { DbDriver, DbOdm, LoggerId, PackageGroups, ProjectType, ScaffoldOptions, ScaffoldResult, ValidatorId, } from './core/types.js';
1
+ export type { DbDriver, DbOdm, DeployTarget, Framework, LoggerId, PackageGroups, Runtime, ScaffoldOptions, ScaffoldResult, ValidatorId, } from './core/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-taserjs",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "Scaffold a new Taser application",
5
5
  "license": "ISC",
6
6
  "repository": {
@@ -31,7 +31,8 @@
31
31
  "publint": "^0.3.22",
32
32
  "typescript": "^5.9.3",
33
33
  "vite": "^8.1.5",
34
- "vitest": "^4.1.10"
34
+ "vitest": "^4.1.10",
35
+ "@taserjs/router-generator": "0.1.0"
35
36
  },
36
37
  "engines": {
37
38
  "node": ">=20.19"
@@ -12,8 +12,10 @@ import {
12
12
  DB_DRIVERS,
13
13
  DB_ODMS,
14
14
  DEFAULT_DB_DRIVER,
15
+ DEPLOY_TARGETS,
16
+ FRAMEWORKS,
15
17
  LOGGERS,
16
- PROJECT_TYPES,
18
+ RUNTIMES,
17
19
  VALIDATORS,
18
20
  } from "../core/types.js";
19
21
 
@@ -34,7 +36,9 @@ const VALIDATOR_ADDONS = ALL_ADDONS.filter((addon) => addon.category === "valida
34
36
 
35
37
  export function getCapabilitiesCatalog(): CapabilitiesCatalog {
36
38
  return {
37
- types: [...PROJECT_TYPES],
39
+ frameworks: [...FRAMEWORKS],
40
+ deployTargets: [...DEPLOY_TARGETS],
41
+ runtimes: [...RUNTIMES],
38
42
  db: {
39
43
  odms: [...DB_ODMS],
40
44
  drivers: [...DB_DRIVERS],
@@ -8,26 +8,23 @@ export const IMPORT_LINES: Record<ValidatorId, string> = {
8
8
  };
9
9
 
10
10
  export const VALIDATION_BLOCK_TEMPLATE: Record<ValidatorId, string> = {
11
- zod: `, {
12
- query: z.object({ name: z.string().default('Taser') }),
13
- }`,
14
- arktype: `, {
15
- query: type({ 'name?': 'string = "Taser"' }),
16
- }`,
17
- valibot: `, {
18
- query: v.object({ name: v.optional(v.string(), 'Taser') }),
19
- }`,
11
+ zod: `
12
+ .query(z.object({ name: z.string().default('Taser') }))`,
13
+ arktype: `
14
+ .query(type({ 'name?': 'string = "Taser"' }))`,
15
+ valibot: `
16
+ .query(v.object({ name: v.optional(v.string(), 'Taser') }))`,
20
17
  };
21
18
 
22
- const ROUTE_TEMPLATE = (validator: ValidatorId) => `import { reply } from '@taserjs/router'
23
- import { t } from '#src/taser.js'
19
+ const ROUTE_TEMPLATE = (validator: ValidatorId) => `import { json } from '@taserjs/router/reply'
20
+ import { t } from '#taserjs/router'
24
21
  ${IMPORT_LINES[validator]}
25
22
 
26
- const GET = t.get('/'${VALIDATION_BLOCK_TEMPLATE[validator]})
23
+ const GET = t.get('/')${VALIDATION_BLOCK_TEMPLATE[validator]}
27
24
 
28
25
  export type RouteContext = typeof GET.$Infer.Context
29
26
  export const Route = GET.handler((ctx) => {
30
- return reply.json({ message: \`Hello, \${ctx.query.name}!\` })
27
+ return json({ message: \`Hello, \${ctx.query.name}!\` })
31
28
  })
32
29
  `;
33
30
 
package/src/cli.ts CHANGED
@@ -11,11 +11,12 @@ async function main(): Promise<void> {
11
11
  const { values, positionals } = parseArgs({
12
12
  args: process.argv.slice(2),
13
13
  options: {
14
- type: { type: "string", short: "t" },
15
- framework: { type: "string" },
14
+ preset: { type: "string", short: "p" },
16
15
  db: { type: "string" },
17
16
  logger: { type: "string" },
18
17
  validator: { type: "string" },
18
+ framework: { type: "string" },
19
+ runtime: { type: "string" },
19
20
  y: { type: "boolean", short: "y" },
20
21
  noInstall: { type: "boolean" },
21
22
  json: { type: "boolean" },
@@ -25,11 +26,12 @@ async function main(): Promise<void> {
25
26
 
26
27
  const parsed = buildParsedArgsFromCli(
27
28
  {
28
- ...(values.type !== undefined ? { type: values.type } : {}),
29
- ...(values.framework !== undefined ? { framework: values.framework } : {}),
29
+ ...(values.preset !== undefined ? { preset: values.preset } : {}),
30
30
  ...(values.db !== undefined ? { db: values.db } : {}),
31
31
  ...(values.logger !== undefined ? { logger: values.logger } : {}),
32
32
  ...(values.validator !== undefined ? { validator: values.validator } : {}),
33
+ ...(values.framework !== undefined ? { framework: values.framework } : {}),
34
+ ...(values.runtime !== undefined ? { runtime: values.runtime } : {}),
33
35
  ...(values.y !== undefined ? { y: values.y } : {}),
34
36
  ...(values.noInstall !== undefined ? { noInstall: values.noInstall } : {}),
35
37
  ...(values.json !== undefined ? { json: values.json } : {}),