elysia-openapi-codegen 0.1.0 → 0.1.1
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 +15 -3
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/{index.ts → dist/index.js} +216 -330
- package/dist/index.js.map +1 -0
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -318,14 +318,26 @@ your-project/
|
|
|
318
318
|
```bash
|
|
319
319
|
# Install dependencies
|
|
320
320
|
bun install
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Local Development
|
|
321
324
|
|
|
322
|
-
|
|
325
|
+
```bash
|
|
326
|
+
# Run directly with Bun during development
|
|
323
327
|
bun index.ts -i ./example/openapi.json -o ./output
|
|
324
328
|
```
|
|
325
329
|
|
|
326
|
-
### Building
|
|
330
|
+
### Building for Production
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
# Compile TypeScript to JavaScript
|
|
334
|
+
npm run build
|
|
335
|
+
|
|
336
|
+
# Test the compiled version
|
|
337
|
+
node dist/index.js --help
|
|
338
|
+
```
|
|
327
339
|
|
|
328
|
-
|
|
340
|
+
The build outputs JavaScript files to the `dist/` folder, which is what gets published to npm.
|
|
329
341
|
|
|
330
342
|
## How It Works
|
|
331
343
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
|
@@ -1,227 +1,125 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (!schema.properties) return 'Record<string, any>';
|
|
124
|
-
|
|
125
|
-
const props = Object.entries(schema.properties).map(([key, prop]) => {
|
|
126
|
-
const isRequired = schema.required?.includes(key);
|
|
127
|
-
const optional = isRequired ? '' : '?';
|
|
128
|
-
return ` ${key}${optional}: ${resolveType(prop)};`;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
return `{\n${props.join('\n')}\n}`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (schema.anyOf || schema.oneOf) {
|
|
135
|
-
return (schema.anyOf || schema.oneOf || []).map(resolveType).join(' | ');
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (schema.allOf) {
|
|
139
|
-
return schema.allOf.map(resolveType).join(' & ');
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (schema.nullable) {
|
|
143
|
-
return `${resolveType({ ...schema, nullable: false })} | null`;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const typeMap: Record<string, string> = {
|
|
147
|
-
string: 'string',
|
|
148
|
-
number: 'number',
|
|
149
|
-
integer: 'number',
|
|
150
|
-
boolean: 'boolean',
|
|
151
|
-
null: 'null',
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return (schema.type && typeMap[schema.type]) || 'any';
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function generateTypes(spec: OpenAPISpec): string {
|
|
158
|
-
const definitions: string[] = [];
|
|
159
|
-
|
|
160
|
-
if (spec.components?.schemas) {
|
|
161
|
-
for (const [name, schema] of Object.entries(spec.components.schemas)) {
|
|
162
|
-
definitions.push(`export type ${name} = ${resolveType(schema)};`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
|
|
167
|
-
for (const [method, operation] of Object.entries(pathItem)) {
|
|
168
|
-
if (!['get', 'post', 'put', 'patch', 'delete'].includes(method)) continue;
|
|
169
|
-
|
|
170
|
-
const op = operation as OpenAPIOperation;
|
|
171
|
-
const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, '')}`;
|
|
172
|
-
const response = op.responses?.['200'];
|
|
173
|
-
|
|
174
|
-
if (response?.content?.['application/json']?.schema) {
|
|
175
|
-
const responseType = resolveType(response.content['application/json'].schema);
|
|
176
|
-
definitions.push(`export type ${capitalize(opId)}Response = ${responseType};`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const params = op.parameters || [];
|
|
180
|
-
if (params.length > 0) {
|
|
181
|
-
const paramProps = params.map(param => {
|
|
182
|
-
const required = param.required ? '' : '?';
|
|
183
|
-
return ` ${param.name}${required}: ${resolveType(param.schema)};`;
|
|
184
|
-
});
|
|
185
|
-
definitions.push(`export type ${capitalize(opId)}Params = {\n${paramProps.join('\n')}\n};`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (op.requestBody?.content?.['application/json']?.schema) {
|
|
189
|
-
const bodyType = resolveType(op.requestBody.content['application/json'].schema);
|
|
190
|
-
definitions.push(`export type ${capitalize(opId)}Body = ${bodyType};`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return definitions.join('\n\n');
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function generateHooks(spec: OpenAPISpec): string {
|
|
199
|
-
const hooks: string[] = [];
|
|
200
|
-
const baseUrl = spec.servers?.[0]?.url || '';
|
|
201
|
-
|
|
202
|
-
for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
|
|
203
|
-
for (const [method, operation] of Object.entries(pathItem)) {
|
|
204
|
-
if (!['get', 'post', 'put', 'patch', 'delete'].includes(method)) continue;
|
|
205
|
-
|
|
206
|
-
const op = operation as OpenAPIOperation;
|
|
207
|
-
const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, '')}`;
|
|
208
|
-
|
|
209
|
-
const hasResponse = !!op.responses?.['200']?.content?.['application/json']?.schema;
|
|
210
|
-
const responseType = hasResponse ? `${capitalize(opId)}Response` : 'any';
|
|
211
|
-
|
|
212
|
-
const params = op.parameters || [];
|
|
213
|
-
const hasParams = params.length > 0;
|
|
214
|
-
const paramsType = hasParams ? `${capitalize(opId)}Params` : 'void';
|
|
215
|
-
|
|
216
|
-
const hasBody = !!op.requestBody?.content?.['application/json']?.schema;
|
|
217
|
-
const bodyType = hasBody ? `${capitalize(opId)}Body` : 'void';
|
|
218
|
-
|
|
219
|
-
if (method === 'get') {
|
|
220
|
-
const queryParams = params.map(p => p.name);
|
|
221
|
-
const queryString = queryParams.length > 0
|
|
222
|
-
? `?${queryParams.map((p: string) => `\${params?.${p} !== undefined ? '${p}=' + params.${p} : ''}`).join('&')}`
|
|
223
|
-
: '';
|
|
224
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Elysia OpenAPI Code Generator
|
|
4
|
+
* Generates typed React Query hooks from OpenAPI specifications.
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import https from 'https';
|
|
9
|
+
import http from 'http';
|
|
10
|
+
async function fetchSpec(source) {
|
|
11
|
+
if (source.startsWith('http://') || source.startsWith('https://')) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const client = source.startsWith('https://') ? https : http;
|
|
14
|
+
client.get(source, (res) => {
|
|
15
|
+
let data = '';
|
|
16
|
+
res.on('data', (chunk) => data += chunk.toString());
|
|
17
|
+
res.on('end', () => {
|
|
18
|
+
try {
|
|
19
|
+
resolve(JSON.parse(data));
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
reject(new Error(`Failed to parse OpenAPI spec: ${e.message}`));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
res.on('error', reject);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return JSON.parse(fs.readFileSync(source, 'utf8'));
|
|
30
|
+
}
|
|
31
|
+
function resolveType(schema) {
|
|
32
|
+
if (!schema)
|
|
33
|
+
return 'any';
|
|
34
|
+
if (schema.$ref) {
|
|
35
|
+
return schema.$ref.split('/').pop() || 'any';
|
|
36
|
+
}
|
|
37
|
+
if (schema.type === 'array' && schema.items) {
|
|
38
|
+
return `Array<${resolveType(schema.items)}>`;
|
|
39
|
+
}
|
|
40
|
+
if (schema.type === 'object') {
|
|
41
|
+
if (!schema.properties)
|
|
42
|
+
return 'Record<string, any>';
|
|
43
|
+
const props = Object.entries(schema.properties).map(([key, prop]) => {
|
|
44
|
+
const isRequired = schema.required?.includes(key);
|
|
45
|
+
const optional = isRequired ? '' : '?';
|
|
46
|
+
return ` ${key}${optional}: ${resolveType(prop)};`;
|
|
47
|
+
});
|
|
48
|
+
return `{\n${props.join('\n')}\n}`;
|
|
49
|
+
}
|
|
50
|
+
if (schema.anyOf || schema.oneOf) {
|
|
51
|
+
return (schema.anyOf || schema.oneOf || []).map(resolveType).join(' | ');
|
|
52
|
+
}
|
|
53
|
+
if (schema.allOf) {
|
|
54
|
+
return schema.allOf.map(resolveType).join(' & ');
|
|
55
|
+
}
|
|
56
|
+
if (schema.nullable) {
|
|
57
|
+
return `${resolveType({ ...schema, nullable: false })} | null`;
|
|
58
|
+
}
|
|
59
|
+
const typeMap = {
|
|
60
|
+
string: 'string',
|
|
61
|
+
number: 'number',
|
|
62
|
+
integer: 'number',
|
|
63
|
+
boolean: 'boolean',
|
|
64
|
+
null: 'null',
|
|
65
|
+
};
|
|
66
|
+
return (schema.type && typeMap[schema.type]) || 'any';
|
|
67
|
+
}
|
|
68
|
+
function generateTypes(spec) {
|
|
69
|
+
const definitions = [];
|
|
70
|
+
if (spec.components?.schemas) {
|
|
71
|
+
for (const [name, schema] of Object.entries(spec.components.schemas)) {
|
|
72
|
+
definitions.push(`export type ${name} = ${resolveType(schema)};`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
|
|
76
|
+
for (const [method, operation] of Object.entries(pathItem)) {
|
|
77
|
+
if (!['get', 'post', 'put', 'patch', 'delete'].includes(method))
|
|
78
|
+
continue;
|
|
79
|
+
const op = operation;
|
|
80
|
+
const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, '')}`;
|
|
81
|
+
const response = op.responses?.['200'];
|
|
82
|
+
if (response?.content?.['application/json']?.schema) {
|
|
83
|
+
const responseType = resolveType(response.content['application/json'].schema);
|
|
84
|
+
definitions.push(`export type ${capitalize(opId)}Response = ${responseType};`);
|
|
85
|
+
}
|
|
86
|
+
const params = op.parameters || [];
|
|
87
|
+
if (params.length > 0) {
|
|
88
|
+
const paramProps = params.map(param => {
|
|
89
|
+
const required = param.required ? '' : '?';
|
|
90
|
+
return ` ${param.name}${required}: ${resolveType(param.schema)};`;
|
|
91
|
+
});
|
|
92
|
+
definitions.push(`export type ${capitalize(opId)}Params = {\n${paramProps.join('\n')}\n};`);
|
|
93
|
+
}
|
|
94
|
+
if (op.requestBody?.content?.['application/json']?.schema) {
|
|
95
|
+
const bodyType = resolveType(op.requestBody.content['application/json'].schema);
|
|
96
|
+
definitions.push(`export type ${capitalize(opId)}Body = ${bodyType};`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return definitions.join('\n\n');
|
|
101
|
+
}
|
|
102
|
+
function generateHooks(spec) {
|
|
103
|
+
const hooks = [];
|
|
104
|
+
const baseUrl = spec.servers?.[0]?.url || '';
|
|
105
|
+
for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
|
|
106
|
+
for (const [method, operation] of Object.entries(pathItem)) {
|
|
107
|
+
if (!['get', 'post', 'put', 'patch', 'delete'].includes(method))
|
|
108
|
+
continue;
|
|
109
|
+
const op = operation;
|
|
110
|
+
const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, '')}`;
|
|
111
|
+
const hasResponse = !!op.responses?.['200']?.content?.['application/json']?.schema;
|
|
112
|
+
const responseType = hasResponse ? `${capitalize(opId)}Response` : 'any';
|
|
113
|
+
const params = op.parameters || [];
|
|
114
|
+
const hasParams = params.length > 0;
|
|
115
|
+
const paramsType = hasParams ? `${capitalize(opId)}Params` : 'void';
|
|
116
|
+
const hasBody = !!op.requestBody?.content?.['application/json']?.schema;
|
|
117
|
+
const bodyType = hasBody ? `${capitalize(opId)}Body` : 'void';
|
|
118
|
+
if (method === 'get') {
|
|
119
|
+
const queryParams = params.map(p => p.name);
|
|
120
|
+
const queryString = queryParams.length > 0
|
|
121
|
+
? `?${queryParams.map((p) => `\${params?.${p} !== undefined ? '${p}=' + params.${p} : ''}`).join('&')}`
|
|
122
|
+
: '';
|
|
225
123
|
hooks.push(`
|
|
226
124
|
export const use${capitalize(opId)} = (
|
|
227
125
|
params${hasParams ? '' : '?'}: ${paramsType},
|
|
@@ -236,21 +134,20 @@ export const use${capitalize(opId)} = (
|
|
|
236
134
|
},
|
|
237
135
|
...options,
|
|
238
136
|
});
|
|
239
|
-
};`);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
let
|
|
243
|
-
|
|
244
|
-
if (hasBody) {
|
|
245
|
-
inputType = bodyType;
|
|
246
|
-
inputArg = 'body';
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const hasInput = inputType !== 'void';
|
|
253
|
-
|
|
137
|
+
};`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
let inputType = 'void';
|
|
141
|
+
let inputArg = '';
|
|
142
|
+
if (hasBody) {
|
|
143
|
+
inputType = bodyType;
|
|
144
|
+
inputArg = 'body';
|
|
145
|
+
}
|
|
146
|
+
else if (hasParams) {
|
|
147
|
+
inputType = paramsType;
|
|
148
|
+
inputArg = 'params';
|
|
149
|
+
}
|
|
150
|
+
const hasInput = inputType !== 'void';
|
|
254
151
|
hooks.push(`
|
|
255
152
|
export const use${capitalize(opId)} = (
|
|
256
153
|
options?: UseMutationOptions<${responseType}, Error, ${inputType}>
|
|
@@ -267,53 +164,51 @@ export const use${capitalize(opId)} = (
|
|
|
267
164
|
},
|
|
268
165
|
...options,
|
|
269
166
|
});
|
|
270
|
-
};`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
config.
|
|
307
|
-
|
|
308
|
-
if (!config.
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
function showHelp() {
|
|
167
|
+
};`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return hooks.join('\n');
|
|
172
|
+
}
|
|
173
|
+
function capitalize(str) {
|
|
174
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
175
|
+
}
|
|
176
|
+
async function parseArgs() {
|
|
177
|
+
const args = process.argv.slice(2);
|
|
178
|
+
const config = {
|
|
179
|
+
input: '',
|
|
180
|
+
output: '',
|
|
181
|
+
};
|
|
182
|
+
for (let i = 0; i < args.length; i++) {
|
|
183
|
+
const arg = args[i];
|
|
184
|
+
if (!arg)
|
|
185
|
+
continue;
|
|
186
|
+
if (arg === '-i' || arg === '--input') {
|
|
187
|
+
const value = args[++i];
|
|
188
|
+
if (!value) {
|
|
189
|
+
console.error(`Error: ${arg} flag requires a value`);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
config.input = value;
|
|
193
|
+
}
|
|
194
|
+
else if (arg === '-o' || arg === '--output') {
|
|
195
|
+
const value = args[++i];
|
|
196
|
+
if (!value) {
|
|
197
|
+
console.error(`Error: ${arg} flag requires a value`);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
config.output = value;
|
|
201
|
+
}
|
|
202
|
+
else if (!arg.startsWith('-')) {
|
|
203
|
+
if (!config.input)
|
|
204
|
+
config.input = arg;
|
|
205
|
+
else if (!config.output)
|
|
206
|
+
config.output = arg;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return config;
|
|
210
|
+
}
|
|
211
|
+
function showHelp() {
|
|
317
212
|
console.log(`
|
|
318
213
|
Elysia OpenAPI Code Generator
|
|
319
214
|
Generate React Query hooks and TypeScript types from OpenAPI specifications.
|
|
@@ -335,33 +230,26 @@ Examples:
|
|
|
335
230
|
# Using positional arguments
|
|
336
231
|
elysia-codegen https://api.example.com/openapi.json ./src/api
|
|
337
232
|
elysia-codegen ./openapi.json ./generated
|
|
338
|
-
`);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
try {
|
|
360
|
-
const spec = await fetchSpec(input);
|
|
361
|
-
const types = generateTypes(spec);
|
|
362
|
-
const hooks = generateHooks(spec);
|
|
363
|
-
const baseUrl = spec.servers?.[0]?.url || '';
|
|
364
|
-
|
|
233
|
+
`);
|
|
234
|
+
}
|
|
235
|
+
async function main() {
|
|
236
|
+
const args = process.argv.slice(2);
|
|
237
|
+
if (args.includes('-h') || args.includes('--help') || args.length === 0) {
|
|
238
|
+
showHelp();
|
|
239
|
+
process.exit(0);
|
|
240
|
+
}
|
|
241
|
+
const { input, output } = await parseArgs();
|
|
242
|
+
if (!input || !output) {
|
|
243
|
+
console.error('Error: Both input source and output directory are required.\n');
|
|
244
|
+
showHelp();
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
console.log('Fetching OpenAPI spec...');
|
|
248
|
+
try {
|
|
249
|
+
const spec = await fetchSpec(input);
|
|
250
|
+
const types = generateTypes(spec);
|
|
251
|
+
const hooks = generateHooks(spec);
|
|
252
|
+
const baseUrl = spec.servers?.[0]?.url || '';
|
|
365
253
|
const fileContent = `/* eslint-disable */
|
|
366
254
|
/**
|
|
367
255
|
* Auto-generated by Elysia OpenAPI Codegen
|
|
@@ -374,20 +262,18 @@ const baseUrl = '${baseUrl}';
|
|
|
374
262
|
${types}
|
|
375
263
|
|
|
376
264
|
${hooks}
|
|
377
|
-
`;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
console.
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
main().catch(console.error);
|
|
265
|
+
`;
|
|
266
|
+
if (!fs.existsSync(output)) {
|
|
267
|
+
fs.mkdirSync(output, { recursive: true });
|
|
268
|
+
}
|
|
269
|
+
const outputPath = path.join(output, 'generated.ts');
|
|
270
|
+
fs.writeFileSync(outputPath, fileContent);
|
|
271
|
+
console.log(`Successfully generated hooks at ${outputPath}`);
|
|
272
|
+
}
|
|
273
|
+
catch (err) {
|
|
274
|
+
console.error('Generation failed:', err instanceof Error ? err.message : String(err));
|
|
275
|
+
process.exit(1);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
main().catch(console.error);
|
|
279
|
+
//# sourceMappingURL=index.js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;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elysia-openapi-codegen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Generate React Query hooks and fully typed TypeScript interfaces from Elysia OpenAPI specs.",
|
|
5
|
-
"
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
6
8
|
"type": "module",
|
|
7
9
|
"bin": {
|
|
8
|
-
"elysia-codegen": "./index.
|
|
10
|
+
"elysia-codegen": "./dist/index.js"
|
|
9
11
|
},
|
|
10
12
|
"files": [
|
|
11
|
-
"
|
|
13
|
+
"dist",
|
|
12
14
|
"README.md"
|
|
13
15
|
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.build.json",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
14
20
|
"author": "Khantamir mkhantamir77@gmail.com",
|
|
15
21
|
"license": "MIT",
|
|
16
22
|
"repository": {
|
|
@@ -30,7 +36,8 @@
|
|
|
30
36
|
"tanstack-query"
|
|
31
37
|
],
|
|
32
38
|
"devDependencies": {
|
|
33
|
-
"@types/bun": "latest"
|
|
39
|
+
"@types/bun": "latest",
|
|
40
|
+
"typescript": "^5"
|
|
34
41
|
},
|
|
35
42
|
"peerDependencies": {
|
|
36
43
|
"typescript": "^5"
|