@@ -147,7 +147,7 @@ export const fromTypes =
147147 . replace ( / .t s x $ / , '.ts' )
148148 . replace ( / .t s $ / , '.d.ts' )
149149
150- let targetFile =
150+ const targetFile =
151151 ( overrideOutputPath
152152 ? typeof overrideOutputPath === 'string'
153153 ? overrideOutputPath . startsWith ( '/' )
@@ -156,41 +156,31 @@ export const fromTypes =
156156 : overrideOutputPath ( tmpRoot )
157157 : undefined ) ?? join ( tmpRoot , 'dist' , fileName )
158158
159- {
160- const _targetFile = join (
161- tmpRoot ,
162- 'dist' ,
163- fileName . slice ( fileName . indexOf ( '/' ) + 1 )
164- )
165-
166- if ( ! existsSync ( _targetFile ) ) {
167- rmSync ( join ( tmpRoot , 'tsconfig.json' ) )
159+ if ( ! existsSync ( targetFile ) ) {
160+ rmSync ( join ( tmpRoot , 'tsconfig.json' ) )
168161
169- console . warn (
170- '[@elysiajs/openapi/gen] Failed to generate OpenAPI schema'
171- )
172- console . warn ( "Couldn't find generated declaration file" )
173-
174- if ( existsSync ( join ( tmpRoot , 'dist' ) ) ) {
175- const tempFiles = readdirSync ( join ( tmpRoot , 'dist' ) , {
176- recursive : true
177- } )
178- . filter ( ( x ) => x . toString ( ) . endsWith ( '.d.ts' ) )
179- . map ( ( x ) => `- ${ x } ` )
180- . join ( '\n' )
181-
182- if ( tempFiles ) {
183- console . warn (
184- 'You can override with `overrideOutputPath` with one of the following:'
185- )
186- console . warn ( tempFiles )
187- }
162+ console . warn (
163+ '[@elysiajs/openapi/gen] Failed to generate OpenAPI schema'
164+ )
165+ console . warn ( "Couldn't find generated declaration file" )
166+
167+ if ( existsSync ( join ( tmpRoot , 'dist' ) ) ) {
168+ const tempFiles = readdirSync ( join ( tmpRoot , 'dist' ) , {
169+ recursive : true
170+ } )
171+ . filter ( ( x ) => x . toString ( ) . endsWith ( '.d.ts' ) )
172+ . map ( ( x ) => `- ${ x } ` )
173+ . join ( '\n' )
174+
175+ if ( tempFiles ) {
176+ console . warn (
177+ 'You can override with `overrideOutputPath` with one of the following:'
178+ )
179+ console . warn ( tempFiles )
188180 }
189-
190- return
191181 }
192182
193- targetFile = _targetFile
183+ return
194184 }
195185
196186 const declaration = readFileSync ( targetFile , 'utf8' )
0 commit comments