@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,26 +1,26 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
GeneratedFile,
|
|
3
|
+
TemplateConfig,
|
|
4
|
+
TemplateOptions,
|
|
5
5
|
} from '../templates/index.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Generate docker-compose.yml based on template and options
|
|
9
9
|
*/
|
|
10
10
|
export function generateDockerFiles(
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
options: TemplateOptions,
|
|
12
|
+
template: TemplateConfig,
|
|
13
13
|
): GeneratedFile[] {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const { database } = options;
|
|
15
|
+
const isServerless = template.name === 'serverless';
|
|
16
|
+
const hasWorker = template.name === 'worker';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const services: string[] = [];
|
|
19
|
+
const volumes: string[] = [];
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// PostgreSQL database
|
|
22
|
+
if (database) {
|
|
23
|
+
services.push(` postgres:
|
|
24
24
|
image: postgres:16-alpine
|
|
25
25
|
container_name: ${options.name}-postgres
|
|
26
26
|
restart: unless-stopped
|
|
@@ -37,13 +37,13 @@ export function generateDockerFiles(
|
|
|
37
37
|
interval: 5s
|
|
38
38
|
timeout: 5s
|
|
39
39
|
retries: 5`);
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
volumes.push(' postgres_data:');
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
// Redis - different setup for serverless vs standard
|
|
44
|
+
if (isServerless) {
|
|
45
|
+
// Use serverless-redis-http for Lambda compatibility
|
|
46
|
+
services.push(` redis:
|
|
47
47
|
image: redis:7-alpine
|
|
48
48
|
container_name: ${options.name}-redis
|
|
49
49
|
restart: unless-stopped
|
|
@@ -70,10 +70,10 @@ export function generateDockerFiles(
|
|
|
70
70
|
depends_on:
|
|
71
71
|
redis:
|
|
72
72
|
condition: service_healthy`);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
volumes.push(' redis_data:');
|
|
74
|
+
} else {
|
|
75
|
+
// Standard Redis for non-serverless templates
|
|
76
|
+
services.push(` redis:
|
|
77
77
|
image: redis:7-alpine
|
|
78
78
|
container_name: ${options.name}-redis
|
|
79
79
|
restart: unless-stopped
|
|
@@ -86,12 +86,12 @@ export function generateDockerFiles(
|
|
|
86
86
|
interval: 5s
|
|
87
87
|
timeout: 5s
|
|
88
88
|
retries: 5`);
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
volumes.push(' redis_data:');
|
|
90
|
+
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
// RabbitMQ for worker template
|
|
93
|
+
if (hasWorker) {
|
|
94
|
+
services.push(` rabbitmq:
|
|
95
95
|
image: rabbitmq:3-management-alpine
|
|
96
96
|
container_name: ${options.name}-rabbitmq
|
|
97
97
|
restart: unless-stopped
|
|
@@ -108,27 +108,27 @@ export function generateDockerFiles(
|
|
|
108
108
|
interval: 10s
|
|
109
109
|
timeout: 5s
|
|
110
110
|
retries: 5`);
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
volumes.push(' rabbitmq_data:');
|
|
112
|
+
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
// Build docker-compose.yml
|
|
115
|
+
let dockerCompose = `version: '3.8'
|
|
116
116
|
|
|
117
117
|
services:
|
|
118
118
|
${services.join('\n\n')}
|
|
119
119
|
`;
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (volumes.length > 0) {
|
|
122
|
+
dockerCompose += `
|
|
123
123
|
volumes:
|
|
124
124
|
${volumes.join('\n')}
|
|
125
125
|
`;
|
|
126
|
-
|
|
126
|
+
}
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
return [
|
|
129
|
+
{
|
|
130
|
+
path: 'docker-compose.yml',
|
|
131
|
+
content: dockerCompose,
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
134
|
}
|
|
@@ -1,144 +1,144 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
GeneratedFile,
|
|
3
|
+
TemplateConfig,
|
|
4
|
+
TemplateOptions,
|
|
5
5
|
} from '../templates/index.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Generate environment files (.env, .env.example, .env.development, .env.test, .gitignore)
|
|
9
9
|
*/
|
|
10
10
|
export function generateEnvFiles(
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
options: TemplateOptions,
|
|
12
|
+
template: TemplateConfig,
|
|
13
13
|
): GeneratedFile[] {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const { database } = options;
|
|
15
|
+
const isServerless = template.name === 'serverless';
|
|
16
|
+
const hasWorker = template.name === 'worker';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// Build base env content
|
|
19
|
+
let baseEnv = `# Application
|
|
20
20
|
NODE_ENV=development
|
|
21
21
|
PORT=3000
|
|
22
22
|
LOG_LEVEL=info
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if (isServerless) {
|
|
26
|
+
baseEnv = `# AWS
|
|
27
27
|
STAGE=dev
|
|
28
28
|
AWS_REGION=us-east-1
|
|
29
29
|
LOG_LEVEL=info
|
|
30
30
|
`;
|
|
31
|
-
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (database) {
|
|
34
|
+
baseEnv += `
|
|
35
35
|
# Database
|
|
36
36
|
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
|
|
37
37
|
`;
|
|
38
|
-
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if (hasWorker) {
|
|
41
|
+
baseEnv += `
|
|
42
42
|
# Message Queue
|
|
43
43
|
RABBITMQ_URL=amqp://localhost:5672
|
|
44
44
|
`;
|
|
45
|
-
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
baseEnv += `
|
|
48
48
|
# Authentication
|
|
49
49
|
JWT_SECRET=your-secret-key-change-in-production
|
|
50
50
|
`;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
// Development env
|
|
53
|
+
let devEnv = `# Development Environment
|
|
54
54
|
NODE_ENV=development
|
|
55
55
|
PORT=3000
|
|
56
56
|
LOG_LEVEL=debug
|
|
57
57
|
`;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (isServerless) {
|
|
60
|
+
devEnv = `# Development Environment
|
|
61
61
|
STAGE=dev
|
|
62
62
|
AWS_REGION=us-east-1
|
|
63
63
|
LOG_LEVEL=debug
|
|
64
64
|
`;
|
|
65
|
-
|
|
65
|
+
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
if (database) {
|
|
68
|
+
devEnv += `
|
|
69
69
|
# Database
|
|
70
70
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mydb_dev
|
|
71
71
|
`;
|
|
72
|
-
|
|
72
|
+
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
if (hasWorker) {
|
|
75
|
+
devEnv += `
|
|
76
76
|
# Message Queue
|
|
77
77
|
RABBITMQ_URL=amqp://localhost:5672
|
|
78
78
|
`;
|
|
79
|
-
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
devEnv += `
|
|
82
82
|
# Authentication
|
|
83
83
|
JWT_SECRET=dev-secret-not-for-production
|
|
84
84
|
`;
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// Test env
|
|
87
|
+
let testEnv = `# Test Environment
|
|
88
88
|
NODE_ENV=test
|
|
89
89
|
PORT=3001
|
|
90
90
|
LOG_LEVEL=error
|
|
91
91
|
`;
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
if (isServerless) {
|
|
94
|
+
testEnv = `# Test Environment
|
|
95
95
|
STAGE=test
|
|
96
96
|
AWS_REGION=us-east-1
|
|
97
97
|
LOG_LEVEL=error
|
|
98
98
|
`;
|
|
99
|
-
|
|
99
|
+
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
if (database) {
|
|
102
|
+
testEnv += `
|
|
103
103
|
# Database
|
|
104
104
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mydb_test
|
|
105
105
|
`;
|
|
106
|
-
|
|
106
|
+
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
if (hasWorker) {
|
|
109
|
+
testEnv += `
|
|
110
110
|
# Message Queue
|
|
111
111
|
RABBITMQ_URL=amqp://localhost:5672
|
|
112
112
|
`;
|
|
113
|
-
|
|
113
|
+
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
testEnv += `
|
|
116
116
|
# Authentication
|
|
117
117
|
JWT_SECRET=test-secret-not-for-production
|
|
118
118
|
`;
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
120
|
+
const files: GeneratedFile[] = [
|
|
121
|
+
{
|
|
122
|
+
path: '.env.example',
|
|
123
|
+
content: baseEnv,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
path: '.env',
|
|
127
|
+
content: baseEnv,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
path: '.env.development',
|
|
131
|
+
content: devEnv,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
path: '.env.test',
|
|
135
|
+
content: testEnv,
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
// Only add .gitignore for non-monorepo (monorepo has it at root)
|
|
140
|
+
if (!options.monorepo) {
|
|
141
|
+
const gitignore = `# Dependencies
|
|
142
142
|
node_modules/
|
|
143
143
|
|
|
144
144
|
# Build output
|
|
@@ -172,11 +172,11 @@ coverage/
|
|
|
172
172
|
# TypeScript cache
|
|
173
173
|
*.tsbuildinfo
|
|
174
174
|
`;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
files.push({
|
|
176
|
+
path: '.gitignore',
|
|
177
|
+
content: gitignore,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
return files;
|
|
182
182
|
}
|
|
@@ -4,57 +4,57 @@ import type { GeneratedFile, TemplateOptions } from '../templates/index.js';
|
|
|
4
4
|
* Generate packages/models for shared Zod schemas (monorepo only)
|
|
5
5
|
*/
|
|
6
6
|
export function generateModelsPackage(
|
|
7
|
-
|
|
7
|
+
options: TemplateOptions,
|
|
8
8
|
): GeneratedFile[] {
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
9
|
+
if (!options.monorepo) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Package name based on project name
|
|
14
|
+
const packageName = `@${options.name}/models`;
|
|
15
|
+
|
|
16
|
+
// package.json for models
|
|
17
|
+
const packageJson = {
|
|
18
|
+
name: packageName,
|
|
19
|
+
version: '0.0.1',
|
|
20
|
+
private: true,
|
|
21
|
+
type: 'module',
|
|
22
|
+
exports: {
|
|
23
|
+
'.': {
|
|
24
|
+
types: './dist/index.d.ts',
|
|
25
|
+
import: './dist/index.js',
|
|
26
|
+
},
|
|
27
|
+
'./*': {
|
|
28
|
+
types: './dist/*.d.ts',
|
|
29
|
+
import: './dist/*.js',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
scripts: {
|
|
33
|
+
build: 'tsc',
|
|
34
|
+
'build:watch': 'tsc --watch',
|
|
35
|
+
typecheck: 'tsc --noEmit',
|
|
36
|
+
},
|
|
37
|
+
dependencies: {
|
|
38
|
+
zod: '~4.1.0',
|
|
39
|
+
},
|
|
40
|
+
devDependencies: {
|
|
41
|
+
typescript: '~5.8.2',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// tsconfig.json for models - extends root
|
|
46
|
+
const tsConfig = {
|
|
47
|
+
extends: '../../tsconfig.json',
|
|
48
|
+
compilerOptions: {
|
|
49
|
+
outDir: './dist',
|
|
50
|
+
rootDir: './src',
|
|
51
|
+
},
|
|
52
|
+
include: ['src/**/*.ts'],
|
|
53
|
+
exclude: ['node_modules', 'dist'],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Main index.ts with example schemas
|
|
57
|
+
const indexTs = `import { z } from 'zod';
|
|
58
58
|
|
|
59
59
|
// ============================================
|
|
60
60
|
// Common Schemas
|
|
@@ -112,18 +112,18 @@ export type CreateUser = z.infer<typeof createUserSchema>;
|
|
|
112
112
|
export type UpdateUser = z.infer<typeof updateUserSchema>;
|
|
113
113
|
`;
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
return [
|
|
116
|
+
{
|
|
117
|
+
path: 'packages/models/package.json',
|
|
118
|
+
content: `${JSON.stringify(packageJson, null, 2)}\n`,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
path: 'packages/models/tsconfig.json',
|
|
122
|
+
content: `${JSON.stringify(tsConfig, null, 2)}\n`,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
path: 'packages/models/src/index.ts',
|
|
126
|
+
content: indexTs,
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
129
|
}
|