Skip to content

Commit f92f753

Browse files
authored
Fix path generation (#991)
* Fix path generation * Fix file path
1 parent 4917ce2 commit f92f753

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bin/cli.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ async function generateSchema(pathToSpec) {
112112
const isDir = fs.existsSync(outputFilePath) && fs.lstatSync(outputFilePath).isDirectory();
113113
if (isDir) {
114114
const filename = pathToSpec.replace(EXT_RE, ".ts");
115-
outputFilePath = new URL(filename, outputFilePath);
115+
const originalOutputFilePath = outputFilePath;
116+
outputFilePath = new URL(filename, originalOutputFilePath);
117+
if (outputFilePath.protocol !== 'file') {
118+
outputFilePath = new URL(outputFilePath.host.replace(EXT_RE, ".ts"), originalOutputFilePath);
119+
}
116120
}
117121

118122
fs.writeFileSync(outputFilePath, result, "utf8");

0 commit comments

Comments
 (0)