@geekmidas/cli 0.9.0 → 0.12.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.
- package/README.md +525 -0
- package/dist/bundler-DRXCw_YR.mjs +70 -0
- package/dist/bundler-DRXCw_YR.mjs.map +1 -0
- package/dist/bundler-WsEvH_b2.cjs +71 -0
- package/dist/bundler-WsEvH_b2.cjs.map +1 -0
- package/dist/{config-CFls09Ey.cjs → config-AmInkU7k.cjs} +10 -8
- package/dist/config-AmInkU7k.cjs.map +1 -0
- package/dist/{config-Bq72aj8e.mjs → config-DYULeEv8.mjs} +6 -4
- package/dist/config-DYULeEv8.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +2 -1
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +2 -1
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +1 -1
- package/dist/encryption-C8H-38Yy.mjs +42 -0
- package/dist/encryption-C8H-38Yy.mjs.map +1 -0
- package/dist/encryption-Dyf_r1h-.cjs +44 -0
- package/dist/encryption-Dyf_r1h-.cjs.map +1 -0
- package/dist/index.cjs +2125 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2143 -197
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi--vOy9mo4.mjs → openapi-BfFlOBCG.mjs} +812 -49
- package/dist/openapi-BfFlOBCG.mjs.map +1 -0
- package/dist/{openapi-CHhTPief.cjs → openapi-Bt_1FDpT.cjs} +805 -42
- package/dist/openapi-Bt_1FDpT.cjs.map +1 -0
- package/dist/{openapi-react-query-o5iMi8tz.cjs → openapi-react-query-B-sNWHFU.cjs} +5 -5
- package/dist/openapi-react-query-B-sNWHFU.cjs.map +1 -0
- package/dist/{openapi-react-query-CcciaVu5.mjs → openapi-react-query-B6XTeGqS.mjs} +5 -5
- package/dist/openapi-react-query-B6XTeGqS.mjs.map +1 -0
- package/dist/openapi-react-query.cjs +1 -1
- package/dist/openapi-react-query.d.cts.map +1 -0
- package/dist/openapi-react-query.d.mts.map +1 -0
- package/dist/openapi-react-query.mjs +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.cts.map +1 -0
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.d.mts.map +1 -0
- package/dist/openapi.mjs +2 -2
- package/dist/storage-BUYQJgz7.cjs +4 -0
- package/dist/storage-BXoJvmv2.cjs +149 -0
- package/dist/storage-BXoJvmv2.cjs.map +1 -0
- package/dist/storage-C9PU_30f.mjs +101 -0
- package/dist/storage-C9PU_30f.mjs.map +1 -0
- package/dist/storage-DLJAYxzJ.mjs +3 -0
- package/dist/{types-b-vwGpqc.d.cts → types-BR0M2v_c.d.mts} +100 -1
- package/dist/types-BR0M2v_c.d.mts.map +1 -0
- package/dist/{types-DXgiA1sF.d.mts → types-BhkZc-vm.d.cts} +100 -1
- package/dist/types-BhkZc-vm.d.cts.map +1 -0
- package/examples/cron-example.ts +27 -27
- package/examples/env.ts +27 -27
- package/examples/function-example.ts +31 -31
- package/examples/gkm.config.json +20 -20
- package/examples/gkm.config.ts +8 -8
- package/examples/gkm.minimal.config.json +5 -5
- package/examples/gkm.production.config.json +25 -25
- package/examples/logger.ts +2 -2
- package/package.json +6 -6
- package/src/__tests__/EndpointGenerator.hooks.spec.ts +191 -191
- package/src/__tests__/config.spec.ts +55 -55
- package/src/__tests__/loadEnvFiles.spec.ts +93 -93
- package/src/__tests__/normalizeHooksConfig.spec.ts +58 -58
- package/src/__tests__/openapi-react-query.spec.ts +497 -497
- package/src/__tests__/openapi.spec.ts +428 -428
- package/src/__tests__/test-helpers.ts +77 -76
- package/src/auth/__tests__/credentials.spec.ts +204 -0
- package/src/auth/__tests__/index.spec.ts +168 -0
- package/src/auth/credentials.ts +187 -0
- package/src/auth/index.ts +226 -0
- package/src/build/__tests__/index-new.spec.ts +474 -474
- package/src/build/__tests__/manifests.spec.ts +333 -333
- package/src/build/bundler.ts +141 -0
- package/src/build/endpoint-analyzer.ts +236 -0
- package/src/build/handler-templates.ts +1253 -0
- package/src/build/index.ts +250 -179
- package/src/build/manifests.ts +52 -52
- package/src/build/providerResolver.ts +145 -145
- package/src/build/types.ts +64 -43
- package/src/config.ts +39 -37
- package/src/deploy/__tests__/docker.spec.ts +111 -0
- package/src/deploy/__tests__/dokploy.spec.ts +245 -0
- package/src/deploy/__tests__/init.spec.ts +662 -0
- package/src/deploy/docker.ts +128 -0
- package/src/deploy/dokploy.ts +204 -0
- package/src/deploy/index.ts +136 -0
- package/src/deploy/init.ts +484 -0
- package/src/deploy/types.ts +48 -0
- package/src/dev/__tests__/index.spec.ts +266 -266
- package/src/dev/index.ts +647 -593
- package/src/docker/__tests__/compose.spec.ts +531 -0
- package/src/docker/__tests__/templates.spec.ts +280 -0
- package/src/docker/compose.ts +273 -0
- package/src/docker/index.ts +230 -0
- package/src/docker/templates.ts +446 -0
- package/src/generators/CronGenerator.ts +72 -72
- package/src/generators/EndpointGenerator.ts +699 -398
- package/src/generators/FunctionGenerator.ts +84 -84
- package/src/generators/Generator.ts +72 -72
- package/src/generators/OpenApiTsGenerator.ts +589 -589
- package/src/generators/SubscriberGenerator.ts +124 -124
- package/src/generators/__tests__/CronGenerator.spec.ts +433 -433
- package/src/generators/__tests__/EndpointGenerator.spec.ts +532 -382
- package/src/generators/__tests__/FunctionGenerator.spec.ts +244 -244
- package/src/generators/__tests__/SubscriberGenerator.spec.ts +397 -382
- package/src/generators/index.ts +4 -4
- package/src/index.ts +628 -206
- package/src/init/__tests__/generators.spec.ts +334 -334
- package/src/init/__tests__/init.spec.ts +332 -332
- package/src/init/__tests__/utils.spec.ts +89 -89
- package/src/init/generators/config.ts +175 -175
- package/src/init/generators/docker.ts +41 -41
- package/src/init/generators/env.ts +72 -72
- package/src/init/generators/index.ts +1 -1
- package/src/init/generators/models.ts +64 -64
- package/src/init/generators/monorepo.ts +161 -161
- package/src/init/generators/package.ts +71 -71
- package/src/init/generators/source.ts +6 -6
- package/src/init/index.ts +203 -208
- package/src/init/templates/api.ts +115 -115
- package/src/init/templates/index.ts +75 -75
- package/src/init/templates/minimal.ts +98 -98
- package/src/init/templates/serverless.ts +89 -89
- package/src/init/templates/worker.ts +98 -98
- package/src/init/utils.ts +54 -56
- package/src/openapi-react-query.ts +194 -194
- package/src/openapi.ts +63 -63
- package/src/secrets/__tests__/encryption.spec.ts +226 -0
- package/src/secrets/__tests__/generator.spec.ts +319 -0
- package/src/secrets/__tests__/index.spec.ts +91 -0
- package/src/secrets/__tests__/storage.spec.ts +403 -0
- package/src/secrets/encryption.ts +91 -0
- package/src/secrets/generator.ts +164 -0
- package/src/secrets/index.ts +383 -0
- package/src/secrets/storage.ts +134 -0
- package/src/secrets/types.ts +53 -0
- package/src/types.ts +295 -176
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +11 -8
- package/dist/config-Bq72aj8e.mjs.map +0 -1
- package/dist/config-CFls09Ey.cjs.map +0 -1
- package/dist/openapi--vOy9mo4.mjs.map +0 -1
- package/dist/openapi-CHhTPief.cjs.map +0 -1
- package/dist/openapi-react-query-CcciaVu5.mjs.map +0 -1
- package/dist/openapi-react-query-o5iMi8tz.cjs.map +0 -1
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
GeneratedFile,
|
|
3
|
+
TemplateConfig,
|
|
4
|
+
TemplateOptions,
|
|
5
5
|
} from './index.js';
|
|
6
6
|
|
|
7
7
|
export const apiTemplate: TemplateConfig = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
8
|
+
name: 'api',
|
|
9
|
+
description: 'Full API with auth, database, services',
|
|
10
|
+
|
|
11
|
+
dependencies: {
|
|
12
|
+
'@geekmidas/constructs': 'workspace:*',
|
|
13
|
+
'@geekmidas/envkit': 'workspace:*',
|
|
14
|
+
'@geekmidas/logger': 'workspace:*',
|
|
15
|
+
'@geekmidas/services': 'workspace:*',
|
|
16
|
+
'@geekmidas/errors': 'workspace:*',
|
|
17
|
+
'@geekmidas/auth': 'workspace:*',
|
|
18
|
+
hono: '~4.8.2',
|
|
19
|
+
pino: '~9.6.0',
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
devDependencies: {
|
|
23
|
+
'@biomejs/biome': '~1.9.4',
|
|
24
|
+
'@geekmidas/cli': 'workspace:*',
|
|
25
|
+
'@types/node': '~22.0.0',
|
|
26
|
+
tsx: '~4.20.0',
|
|
27
|
+
turbo: '~2.3.0',
|
|
28
|
+
typescript: '~5.8.2',
|
|
29
|
+
vitest: '~4.0.0',
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
scripts: {
|
|
33
|
+
dev: 'gkm dev',
|
|
34
|
+
build: 'gkm build',
|
|
35
|
+
test: 'vitest',
|
|
36
|
+
'test:once': 'vitest run',
|
|
37
|
+
typecheck: 'tsc --noEmit',
|
|
38
|
+
lint: 'biome lint .',
|
|
39
|
+
fmt: 'biome format . --write',
|
|
40
|
+
'fmt:check': 'biome format .',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
files: (options: TemplateOptions): GeneratedFile[] => {
|
|
44
|
+
const { loggerType, routesStructure } = options;
|
|
45
|
+
|
|
46
|
+
const loggerContent = `import { createLogger } from '@geekmidas/logger/${loggerType}';
|
|
47
47
|
|
|
48
48
|
export const logger = createLogger();
|
|
49
49
|
`;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
// Get route path based on structure
|
|
52
|
+
const getRoutePath = (file: string) => {
|
|
53
|
+
switch (routesStructure) {
|
|
54
|
+
case 'centralized-endpoints':
|
|
55
|
+
return `src/endpoints/${file}`;
|
|
56
|
+
case 'centralized-routes':
|
|
57
|
+
return `src/routes/${file}`;
|
|
58
|
+
case 'domain-based': {
|
|
59
|
+
const parts = file.split('/');
|
|
60
|
+
if (parts.length === 1) {
|
|
61
|
+
return `src/${file.replace('.ts', '')}/routes/index.ts`;
|
|
62
|
+
}
|
|
63
|
+
return `src/${parts[0]}/routes/${parts.slice(1).join('/')}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const files: GeneratedFile[] = [
|
|
69
|
+
// src/config/env.ts
|
|
70
|
+
{
|
|
71
|
+
path: 'src/config/env.ts',
|
|
72
|
+
content: `import { EnvironmentParser } from '@geekmidas/envkit';
|
|
73
73
|
|
|
74
74
|
export const envParser = new EnvironmentParser(process.env);
|
|
75
75
|
|
|
@@ -78,28 +78,28 @@ export const config = envParser
|
|
|
78
78
|
port: get('PORT').string().transform(Number).default(3000),
|
|
79
79
|
nodeEnv: get('NODE_ENV').string().default('development'),
|
|
80
80
|
jwtSecret: get('JWT_SECRET').string().default('change-me-in-production'),${
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
options.database
|
|
82
|
+
? `
|
|
83
83
|
database: {
|
|
84
84
|
url: get('DATABASE_URL').string().default('postgresql://localhost:5432/mydb'),
|
|
85
85
|
},`
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
: ''
|
|
87
|
+
}
|
|
88
88
|
}))
|
|
89
89
|
.parse();
|
|
90
90
|
`,
|
|
91
|
-
|
|
91
|
+
},
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
// src/config/logger.ts
|
|
94
|
+
{
|
|
95
|
+
path: 'src/config/logger.ts',
|
|
96
|
+
content: loggerContent,
|
|
97
|
+
},
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
// health endpoint
|
|
100
|
+
{
|
|
101
|
+
path: getRoutePath('health.ts'),
|
|
102
|
+
content: `import { e } from '@geekmidas/constructs/endpoints';
|
|
103
103
|
|
|
104
104
|
export default e
|
|
105
105
|
.get('/health')
|
|
@@ -108,12 +108,12 @@ export default e
|
|
|
108
108
|
timestamp: new Date().toISOString(),
|
|
109
109
|
}));
|
|
110
110
|
`,
|
|
111
|
-
|
|
111
|
+
},
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
// users endpoints
|
|
114
|
+
{
|
|
115
|
+
path: getRoutePath('users/list.ts'),
|
|
116
|
+
content: `import { e } from '@geekmidas/constructs/endpoints';
|
|
117
117
|
|
|
118
118
|
export default e
|
|
119
119
|
.get('/users')
|
|
@@ -124,10 +124,10 @@ export default e
|
|
|
124
124
|
],
|
|
125
125
|
}));
|
|
126
126
|
`,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
path: getRoutePath('users/get.ts'),
|
|
130
|
+
content: `import { e } from '@geekmidas/constructs/endpoints';
|
|
131
131
|
import { z } from 'zod';
|
|
132
132
|
|
|
133
133
|
export default e
|
|
@@ -139,14 +139,14 @@ export default e
|
|
|
139
139
|
email: 'alice@example.com',
|
|
140
140
|
}));
|
|
141
141
|
`,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
// Add database service if enabled
|
|
146
|
+
if (options.database) {
|
|
147
|
+
files.push({
|
|
148
|
+
path: 'src/services/database.ts',
|
|
149
|
+
content: `import type { Service } from '@geekmidas/services';
|
|
150
150
|
import { Kysely, PostgresDialect } from 'kysely';
|
|
151
151
|
import pg from 'pg';
|
|
152
152
|
|
|
@@ -177,14 +177,14 @@ export const databaseService = {
|
|
|
177
177
|
},
|
|
178
178
|
} satisfies Service<'database', Kysely<Database>>;
|
|
179
179
|
`,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Add Telescope config if enabled
|
|
184
|
+
if (options.telescope) {
|
|
185
|
+
files.push({
|
|
186
|
+
path: 'src/config/telescope.ts',
|
|
187
|
+
content: `import { Telescope } from '@geekmidas/telescope';
|
|
188
188
|
import { InMemoryStorage } from '@geekmidas/telescope/storage/memory';
|
|
189
189
|
|
|
190
190
|
export const telescope = new Telescope({
|
|
@@ -192,14 +192,14 @@ export const telescope = new Telescope({
|
|
|
192
192
|
enabled: process.env.NODE_ENV === 'development',
|
|
193
193
|
});
|
|
194
194
|
`,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Add Studio config if enabled (requires database)
|
|
199
|
+
if (options.studio && options.database) {
|
|
200
|
+
files.push({
|
|
201
|
+
path: 'src/config/studio.ts',
|
|
202
|
+
content: `import { Direction, InMemoryMonitoringStorage, Studio } from '@geekmidas/studio';
|
|
203
203
|
import { Kysely, PostgresDialect } from 'kysely';
|
|
204
204
|
import pg from 'pg';
|
|
205
205
|
import type { Database } from '../services/database';
|
|
@@ -223,9 +223,9 @@ export const studio = new Studio<Database>({
|
|
|
223
223
|
enabled: process.env.NODE_ENV === 'development',
|
|
224
224
|
});
|
|
225
225
|
`,
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
return files;
|
|
230
|
+
},
|
|
231
231
|
};
|
|
@@ -17,44 +17,44 @@ export type LoggerType = 'pino' | 'console';
|
|
|
17
17
|
* Routes structure pattern
|
|
18
18
|
*/
|
|
19
19
|
export type RoutesStructure =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
| 'centralized-endpoints'
|
|
21
|
+
| 'centralized-routes'
|
|
22
|
+
| 'domain-based';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Options collected from user prompts
|
|
26
26
|
*/
|
|
27
27
|
export interface TemplateOptions {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
name: string;
|
|
29
|
+
template: TemplateName;
|
|
30
|
+
telescope: boolean;
|
|
31
|
+
database: boolean;
|
|
32
|
+
studio: boolean;
|
|
33
|
+
loggerType: LoggerType;
|
|
34
|
+
routesStructure: RoutesStructure;
|
|
35
|
+
monorepo: boolean;
|
|
36
|
+
/** Path for the API app in monorepo (e.g., 'apps/api') */
|
|
37
|
+
apiPath: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* A file to be generated
|
|
42
42
|
*/
|
|
43
43
|
export interface GeneratedFile {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
path: string;
|
|
45
|
+
content: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Template configuration
|
|
50
50
|
*/
|
|
51
51
|
export interface TemplateConfig {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
name: TemplateName;
|
|
53
|
+
description: string;
|
|
54
|
+
dependencies: Record<string, string>;
|
|
55
|
+
devDependencies: Record<string, string>;
|
|
56
|
+
scripts: Record<string, string>;
|
|
57
|
+
files: (options: TemplateOptions) => GeneratedFile[];
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export type TemplateName = 'minimal' | 'api' | 'serverless' | 'worker';
|
|
@@ -63,82 +63,82 @@ export type TemplateName = 'minimal' | 'api' | 'serverless' | 'worker';
|
|
|
63
63
|
* All available templates
|
|
64
64
|
*/
|
|
65
65
|
export const templates: Record<TemplateName, TemplateConfig> = {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
minimal: minimalTemplate,
|
|
67
|
+
api: apiTemplate,
|
|
68
|
+
serverless: serverlessTemplate,
|
|
69
|
+
worker: workerTemplate,
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Template choices for prompts
|
|
74
74
|
*/
|
|
75
75
|
export const templateChoices = [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
76
|
+
{
|
|
77
|
+
title: 'Minimal',
|
|
78
|
+
value: 'minimal' as TemplateName,
|
|
79
|
+
description: 'Basic health endpoint',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: 'API',
|
|
83
|
+
value: 'api' as TemplateName,
|
|
84
|
+
description: 'Full API with auth, database, services',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: 'Serverless',
|
|
88
|
+
value: 'serverless' as TemplateName,
|
|
89
|
+
description: 'AWS Lambda handlers',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: 'Worker',
|
|
93
|
+
value: 'worker' as TemplateName,
|
|
94
|
+
description: 'Background job processing',
|
|
95
|
+
},
|
|
96
96
|
];
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Logger type choices for prompts
|
|
100
100
|
*/
|
|
101
101
|
export const loggerTypeChoices = [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
{
|
|
103
|
+
title: 'Pino',
|
|
104
|
+
value: 'pino' as LoggerType,
|
|
105
|
+
description: 'Fast JSON logger for production (recommended)',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: 'Console',
|
|
109
|
+
value: 'console' as LoggerType,
|
|
110
|
+
description: 'Simple console logger for development',
|
|
111
|
+
},
|
|
112
112
|
];
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Routes structure choices for prompts
|
|
116
116
|
*/
|
|
117
117
|
export const routesStructureChoices = [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
118
|
+
{
|
|
119
|
+
title: 'Centralized (endpoints)',
|
|
120
|
+
value: 'centralized-endpoints' as RoutesStructure,
|
|
121
|
+
description: 'src/endpoints/**/*.ts',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: 'Centralized (routes)',
|
|
125
|
+
value: 'centralized-routes' as RoutesStructure,
|
|
126
|
+
description: 'src/routes/**/*.ts',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
title: 'Domain-based',
|
|
130
|
+
value: 'domain-based' as RoutesStructure,
|
|
131
|
+
description: 'src/**/routes/*.ts (e.g., src/users/routes/list.ts)',
|
|
132
|
+
},
|
|
133
133
|
];
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* Get a template by name
|
|
137
137
|
*/
|
|
138
138
|
export function getTemplate(name: TemplateName): TemplateConfig {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
const template = templates[name];
|
|
140
|
+
if (!template) {
|
|
141
|
+
throw new Error(`Unknown template: ${name}`);
|
|
142
|
+
}
|
|
143
|
+
return template;
|
|
144
144
|
}
|