@@ -238,6 +238,11 @@ const program = cli({
238
238
description : 'sort routes in alphabetical order' ,
239
239
default : codeGenBaseConfig . sortRoutes ,
240
240
} ,
241
+ {
242
+ flags : "--custom-config <string>" ,
243
+ description : "custom config: primitiveTypeConstructs, hooks, ... " ,
244
+ default : '' ,
245
+ }
241
246
] ,
242
247
} ) ;
243
248
@@ -292,16 +297,30 @@ program.addCommand({
292
297
const main = async ( ) => {
293
298
const { command, options } = await program . execute ( { args : process . argv } ) ;
294
299
300
+ let customConfig = null
301
+
302
+ if ( options . customConfig ) {
303
+ try {
304
+ const customConfigPath = resolve ( process . cwd ( ) , options . customConfig )
305
+ console . log ( `✨ found custom config at: ${ customConfigPath } ` )
306
+ customConfig = require ( customConfigPath )
307
+ } catch ( e ) { }
308
+ }
309
+
295
310
try {
296
311
switch ( command ) {
297
312
case null : {
298
313
await generateApi ( {
299
314
...options ,
315
+ name : options . name ,
316
+ url : options . path ,
317
+ generateRouteTypes : options . routeTypes ,
300
318
generateClient : ! ! ( options . axios || options . client ) ,
301
319
httpClientType : options . axios ? HTTP_CLIENT . AXIOS : HTTP_CLIENT . FETCH ,
302
320
url : options . path ,
303
321
input : resolve ( process . cwd ( ) , options . path ) ,
304
322
output : resolve ( process . cwd ( ) , options . output || '.' ) ,
323
+ ...customConfig ,
305
324
} ) ;
306
325
break ;
307
326
}
0 commit comments