@geekmidas/cli 0.10.0 → 0.13.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-B1qy9b-j.cjs +112 -0
- package/dist/bundler-B1qy9b-j.cjs.map +1 -0
- package/dist/bundler-DskIqW2t.mjs +111 -0
- package/dist/bundler-DskIqW2t.mjs.map +1 -0
- package/dist/{config-C9aXOHBe.cjs → config-AmInkU7k.cjs} +8 -8
- package/dist/config-AmInkU7k.cjs.map +1 -0
- package/dist/{config-BrkUalUh.mjs → config-DYULeEv8.mjs} +3 -3
- package/dist/config-DYULeEv8.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- 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 +2123 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2141 -192
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-CZLI4QTr.mjs → openapi-BfFlOBCG.mjs} +801 -38
- package/dist/openapi-BfFlOBCG.mjs.map +1 -0
- package/dist/{openapi-BeHLKcwP.cjs → openapi-Bt_1FDpT.cjs} +794 -31
- 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 -1
- package/dist/openapi-react-query.d.mts.map +1 -1
- 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 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +2 -2
- package/dist/storage-BOOpAF8N.cjs +5 -0
- package/dist/storage-Bj1E26lU.cjs +187 -0
- package/dist/storage-Bj1E26lU.cjs.map +1 -0
- package/dist/storage-kSxTjkNb.mjs +133 -0
- package/dist/storage-kSxTjkNb.mjs.map +1 -0
- package/dist/storage-tgZSUnKl.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 +76 -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__/bundler.spec.ts +444 -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 +210 -0
- package/src/build/endpoint-analyzer.ts +236 -0
- package/src/build/handler-templates.ts +1253 -0
- package/src/build/index.ts +260 -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 -39
- 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 -601
- 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 +577 -577
- 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 +623 -201
- 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 +611 -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 +192 -0
- package/src/secrets/types.ts +53 -0
- package/src/types.ts +295 -176
- package/tsdown.config.ts +11 -8
- package/dist/config-BrkUalUh.mjs.map +0 -1
- package/dist/config-C9aXOHBe.cjs.map +0 -1
- package/dist/openapi-BeHLKcwP.cjs.map +0 -1
- package/dist/openapi-CZLI4QTr.mjs.map +0 -1
- package/dist/openapi-react-query-CcciaVu5.mjs.map +0 -1
- package/dist/openapi-react-query-o5iMi8tz.cjs.map +0 -1
- package/dist/types-DXgiA1sF.d.mts.map +0 -1
- package/dist/types-b-vwGpqc.d.cts.map +0 -1
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
GeneratedFile,
|
|
3
|
+
TemplateConfig,
|
|
4
|
+
TemplateOptions,
|
|
5
5
|
} from './index.js';
|
|
6
6
|
|
|
7
7
|
export const minimalTemplate: 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
|
-
|
|
8
|
+
name: 'minimal',
|
|
9
|
+
description: 'Basic health endpoint',
|
|
10
|
+
|
|
11
|
+
dependencies: {
|
|
12
|
+
'@geekmidas/constructs': 'workspace:*',
|
|
13
|
+
'@geekmidas/envkit': 'workspace:*',
|
|
14
|
+
'@geekmidas/logger': 'workspace:*',
|
|
15
|
+
hono: '~4.8.2',
|
|
16
|
+
pino: '~9.6.0',
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
devDependencies: {
|
|
20
|
+
'@biomejs/biome': '~1.9.4',
|
|
21
|
+
'@geekmidas/cli': 'workspace:*',
|
|
22
|
+
'@types/node': '~22.0.0',
|
|
23
|
+
tsx: '~4.20.0',
|
|
24
|
+
turbo: '~2.3.0',
|
|
25
|
+
typescript: '~5.8.2',
|
|
26
|
+
vitest: '~4.0.0',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
scripts: {
|
|
30
|
+
dev: 'gkm dev',
|
|
31
|
+
build: 'gkm build',
|
|
32
|
+
test: 'vitest',
|
|
33
|
+
'test:once': 'vitest run',
|
|
34
|
+
typecheck: 'tsc --noEmit',
|
|
35
|
+
lint: 'biome lint .',
|
|
36
|
+
fmt: 'biome format . --write',
|
|
37
|
+
'fmt:check': 'biome format .',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
files: (options: TemplateOptions): GeneratedFile[] => {
|
|
41
|
+
const { loggerType, routesStructure } = options;
|
|
42
|
+
|
|
43
|
+
const loggerContent = `import { createLogger } from '@geekmidas/logger/${loggerType}';
|
|
44
44
|
|
|
45
45
|
export const logger = createLogger();
|
|
46
46
|
`;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
// Get route path based on structure
|
|
49
|
+
const getRoutePath = (file: string) => {
|
|
50
|
+
switch (routesStructure) {
|
|
51
|
+
case 'centralized-endpoints':
|
|
52
|
+
return `src/endpoints/${file}`;
|
|
53
|
+
case 'centralized-routes':
|
|
54
|
+
return `src/routes/${file}`;
|
|
55
|
+
case 'domain-based':
|
|
56
|
+
return `src/${file.replace('.ts', '')}/routes/index.ts`;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const files: GeneratedFile[] = [
|
|
61
|
+
// src/config/env.ts
|
|
62
|
+
{
|
|
63
|
+
path: 'src/config/env.ts',
|
|
64
|
+
content: `import { EnvironmentParser } from '@geekmidas/envkit';
|
|
65
65
|
|
|
66
66
|
export const envParser = new EnvironmentParser(process.env);
|
|
67
67
|
|
|
@@ -72,18 +72,18 @@ export const config = envParser
|
|
|
72
72
|
}))
|
|
73
73
|
.parse();
|
|
74
74
|
`,
|
|
75
|
-
|
|
75
|
+
},
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
// src/config/logger.ts
|
|
78
|
+
{
|
|
79
|
+
path: 'src/config/logger.ts',
|
|
80
|
+
content: loggerContent,
|
|
81
|
+
},
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
// health endpoint
|
|
84
|
+
{
|
|
85
|
+
path: getRoutePath('health.ts'),
|
|
86
|
+
content: `import { e } from '@geekmidas/constructs/endpoints';
|
|
87
87
|
|
|
88
88
|
export default e
|
|
89
89
|
.get('/health')
|
|
@@ -92,15 +92,15 @@ export default e
|
|
|
92
92
|
timestamp: new Date().toISOString(),
|
|
93
93
|
}));
|
|
94
94
|
`,
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
// Add database service if enabled
|
|
99
|
+
if (options.database) {
|
|
100
|
+
// Update env.ts to include database config
|
|
101
|
+
files[0] = {
|
|
102
|
+
path: 'src/config/env.ts',
|
|
103
|
+
content: `import { EnvironmentParser } from '@geekmidas/envkit';
|
|
104
104
|
|
|
105
105
|
export const envParser = new EnvironmentParser(process.env);
|
|
106
106
|
|
|
@@ -114,11 +114,11 @@ export const config = envParser
|
|
|
114
114
|
}))
|
|
115
115
|
.parse();
|
|
116
116
|
`,
|
|
117
|
-
|
|
117
|
+
};
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
files.push({
|
|
120
|
+
path: 'src/services/database.ts',
|
|
121
|
+
content: `import type { Service } from '@geekmidas/services';
|
|
122
122
|
import { Kysely, PostgresDialect } from 'kysely';
|
|
123
123
|
import pg from 'pg';
|
|
124
124
|
|
|
@@ -144,14 +144,14 @@ export const databaseService = {
|
|
|
144
144
|
},
|
|
145
145
|
} satisfies Service<'database', Kysely<Database>>;
|
|
146
146
|
`,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Add Telescope config if enabled
|
|
151
|
+
if (options.telescope) {
|
|
152
|
+
files.push({
|
|
153
|
+
path: 'src/config/telescope.ts',
|
|
154
|
+
content: `import { Telescope } from '@geekmidas/telescope';
|
|
155
155
|
import { InMemoryStorage } from '@geekmidas/telescope/storage/memory';
|
|
156
156
|
|
|
157
157
|
export const telescope = new Telescope({
|
|
@@ -159,14 +159,14 @@ export const telescope = new Telescope({
|
|
|
159
159
|
enabled: process.env.NODE_ENV === 'development',
|
|
160
160
|
});
|
|
161
161
|
`,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Add Studio config if enabled (requires database)
|
|
166
|
+
if (options.studio && options.database) {
|
|
167
|
+
files.push({
|
|
168
|
+
path: 'src/config/studio.ts',
|
|
169
|
+
content: `import { Direction, InMemoryMonitoringStorage, Studio } from '@geekmidas/studio';
|
|
170
170
|
import { Kysely, PostgresDialect } from 'kysely';
|
|
171
171
|
import pg from 'pg';
|
|
172
172
|
import type { Database } from '../services/database';
|
|
@@ -190,9 +190,9 @@ export const studio = new Studio<Database>({
|
|
|
190
190
|
enabled: process.env.NODE_ENV === 'development',
|
|
191
191
|
});
|
|
192
192
|
`,
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
return files;
|
|
197
|
+
},
|
|
198
198
|
};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
GeneratedFile,
|
|
3
|
+
TemplateConfig,
|
|
4
|
+
TemplateOptions,
|
|
5
5
|
} from './index.js';
|
|
6
6
|
|
|
7
7
|
export const serverlessTemplate: 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
|
-
|
|
8
|
+
name: 'serverless',
|
|
9
|
+
description: 'AWS Lambda handlers',
|
|
10
|
+
|
|
11
|
+
dependencies: {
|
|
12
|
+
'@geekmidas/constructs': 'workspace:*',
|
|
13
|
+
'@geekmidas/envkit': 'workspace:*',
|
|
14
|
+
'@geekmidas/logger': 'workspace:*',
|
|
15
|
+
'@geekmidas/cloud': 'workspace:*',
|
|
16
|
+
hono: '~4.8.2',
|
|
17
|
+
pino: '~9.6.0',
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
devDependencies: {
|
|
21
|
+
'@biomejs/biome': '~1.9.4',
|
|
22
|
+
'@geekmidas/cli': 'workspace:*',
|
|
23
|
+
'@types/aws-lambda': '~8.10.92',
|
|
24
|
+
'@types/node': '~22.0.0',
|
|
25
|
+
tsx: '~4.20.0',
|
|
26
|
+
turbo: '~2.3.0',
|
|
27
|
+
typescript: '~5.8.2',
|
|
28
|
+
vitest: '~4.0.0',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
scripts: {
|
|
32
|
+
dev: 'gkm dev',
|
|
33
|
+
build: 'gkm build --provider aws-apigatewayv2',
|
|
34
|
+
test: 'vitest',
|
|
35
|
+
'test:once': 'vitest run',
|
|
36
|
+
typecheck: 'tsc --noEmit',
|
|
37
|
+
lint: 'biome lint .',
|
|
38
|
+
fmt: 'biome format . --write',
|
|
39
|
+
'fmt:check': 'biome format .',
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
files: (options: TemplateOptions): GeneratedFile[] => {
|
|
43
|
+
const { loggerType, routesStructure } = options;
|
|
44
|
+
|
|
45
|
+
const loggerContent = `import { createLogger } from '@geekmidas/logger/${loggerType}';
|
|
46
46
|
|
|
47
47
|
export const logger = createLogger();
|
|
48
48
|
`;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
50
|
+
// Get route path based on structure
|
|
51
|
+
const getRoutePath = (file: string) => {
|
|
52
|
+
switch (routesStructure) {
|
|
53
|
+
case 'centralized-endpoints':
|
|
54
|
+
return `src/endpoints/${file}`;
|
|
55
|
+
case 'centralized-routes':
|
|
56
|
+
return `src/routes/${file}`;
|
|
57
|
+
case 'domain-based':
|
|
58
|
+
return `src/${file.replace('.ts', '')}/routes/index.ts`;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const files: GeneratedFile[] = [
|
|
63
|
+
// src/config/env.ts
|
|
64
|
+
{
|
|
65
|
+
path: 'src/config/env.ts',
|
|
66
|
+
content: `import { EnvironmentParser } from '@geekmidas/envkit';
|
|
67
67
|
|
|
68
68
|
export const envParser = new EnvironmentParser(process.env);
|
|
69
69
|
|
|
@@ -71,28 +71,28 @@ export const config = envParser
|
|
|
71
71
|
.create((get) => ({
|
|
72
72
|
stage: get('STAGE').string().default('dev'),
|
|
73
73
|
region: get('AWS_REGION').string().default('us-east-1'),${
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
options.database
|
|
75
|
+
? `
|
|
76
76
|
database: {
|
|
77
77
|
url: get('DATABASE_URL').string(),
|
|
78
78
|
},`
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
: ''
|
|
80
|
+
}
|
|
81
81
|
}))
|
|
82
82
|
.parse();
|
|
83
83
|
`,
|
|
84
|
-
|
|
84
|
+
},
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
// src/config/logger.ts
|
|
87
|
+
{
|
|
88
|
+
path: 'src/config/logger.ts',
|
|
89
|
+
content: loggerContent,
|
|
90
|
+
},
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
// health endpoint
|
|
93
|
+
{
|
|
94
|
+
path: getRoutePath('health.ts'),
|
|
95
|
+
content: `import { e } from '@geekmidas/constructs/endpoints';
|
|
96
96
|
|
|
97
97
|
export default e
|
|
98
98
|
.get('/health')
|
|
@@ -102,12 +102,12 @@ export default e
|
|
|
102
102
|
region: process.env.AWS_REGION || 'local',
|
|
103
103
|
}));
|
|
104
104
|
`,
|
|
105
|
-
|
|
105
|
+
},
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
// src/functions/hello.ts
|
|
108
|
+
{
|
|
109
|
+
path: 'src/functions/hello.ts',
|
|
110
|
+
content: `import { f } from '@geekmidas/constructs/functions';
|
|
111
111
|
import { z } from 'zod';
|
|
112
112
|
|
|
113
113
|
export default f
|
|
@@ -117,14 +117,14 @@ export default f
|
|
|
117
117
|
message: \`Hello, \${input.name}!\`,
|
|
118
118
|
}));
|
|
119
119
|
`,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
// Add Telescope config if enabled
|
|
124
|
+
if (options.telescope) {
|
|
125
|
+
files.push({
|
|
126
|
+
path: 'src/config/telescope.ts',
|
|
127
|
+
content: `import { Telescope } from '@geekmidas/telescope';
|
|
128
128
|
import { InMemoryStorage } from '@geekmidas/telescope/storage/memory';
|
|
129
129
|
|
|
130
130
|
// Note: For production Lambda, consider using a persistent storage
|
|
@@ -133,9 +133,9 @@ export const telescope = new Telescope({
|
|
|
133
133
|
enabled: process.env.STAGE === 'dev',
|
|
134
134
|
});
|
|
135
135
|
`,
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
return files;
|
|
140
|
+
},
|
|
141
141
|
};
|