@@ -178,26 +178,6 @@ const getZvalidatorImports = (verbOption: GeneratorVerbOptions) => {
178
178
return imports . join ( ',\n' ) ;
179
179
} ;
180
180
181
- const getHandlerFix = ( {
182
- rawFile,
183
- content,
184
- } : {
185
- rawFile : string ;
186
- content : string ;
187
- } ) => {
188
- let newContent = content ;
189
-
190
- if ( ! rawFile . includes ( "import { createFactory } from 'hono/factory';" ) ) {
191
- newContent = `import { createFactory } from 'hono/factory';\n${ newContent } ` ;
192
- }
193
-
194
- if ( ! rawFile . includes ( 'const factory = createFactory();' ) ) {
195
- newContent += '\nconst factory = createFactory();' ;
196
- }
197
-
198
- return newContent ;
199
- } ;
200
-
201
181
const getVerbOptionGroupByTag = (
202
182
verbOptions : Record < string , GeneratorVerbOptions > ,
203
183
) => {
@@ -251,10 +231,7 @@ const generateHandlers = async (
251
231
252
232
if ( isExist ) {
253
233
const rawFile = await fs . readFile ( handlerPath , 'utf8' ) ;
254
- let content = getHandlerFix ( {
255
- rawFile,
256
- content : rawFile ,
257
- } ) ;
234
+ let content = rawFile ;
258
235
259
236
if ( ! rawFile . includes ( handlerName ) ) {
260
237
content += getHonoHandlers ( {
@@ -317,10 +294,7 @@ ${getHonoHandlers({
317
294
318
295
if ( isExist ) {
319
296
const rawFile = await fs . readFile ( handlerPath , 'utf8' ) ;
320
- let content = getHandlerFix ( {
321
- rawFile,
322
- content : rawFile ,
323
- } ) ;
297
+ let content = rawFile ;
324
298
325
299
content += Object . values ( verbs ) . reduce ( ( acc , verbOption ) => {
326
300
const handlerName = `${ verbOption . operationName } Handlers` ;
@@ -398,10 +372,7 @@ const factory = createFactory();`;
398
372
399
373
if ( isExist ) {
400
374
const rawFile = await fs . readFile ( handlerPath , 'utf8' ) ;
401
- let content = getHandlerFix ( {
402
- rawFile,
403
- content : rawFile ,
404
- } ) ;
375
+ let content = rawFile ;
405
376
406
377
content += Object . values ( verbOptions ) . reduce ( ( acc , verbOption ) => {
407
378
const handlerName = `${ verbOption . operationName } Handlers` ;
0 commit comments