File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -107,8 +107,12 @@ async function generateSchema(pathToSpec) {
107
107
let outputFilePath = new URL ( flags . output , CWD ) ; // note: may be directory
108
108
const isDir = fs . existsSync ( outputFilePath ) && fs . lstatSync ( outputFilePath ) . isDirectory ( ) ;
109
109
if ( isDir ) {
110
- const filename = pathToSpec . replace ( EXT_RE , ".ts" ) . replace ( / ^ h t t p s ? : \/ \/ / , '' ) ;
111
- outputFilePath = new URL ( filename , outputFilePath ) ;
110
+ const filename = pathToSpec . replace ( EXT_RE , ".ts" ) ;
111
+ const originalOutputFilePath = outputFilePath ;
112
+ outputFilePath = new URL ( filename , originalOutputFilePath ) ;
113
+ if ( outputFilePath . protocol !== 'file' ) {
114
+ outputFilePath = new URL ( outputFilePath . host . replace ( EXT_RE , ".ts" ) , originalOutputFilePath ) ;
115
+ }
112
116
}
113
117
114
118
fs . writeFileSync ( outputFilePath , result , "utf8" ) ;
You can’t perform that action at this time.
0 commit comments