Skip to content

Commit 4b354a5

Browse files
authored
Fix bug in generating multiple spec to folder (openapi-ts#999)
1 parent e335c76 commit 4b354a5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bin/cli.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
import fs from "node:fs";
4+
import path from "path";
45
import { URL } from "node:url";
56
import glob from "fast-glob";
67
import parser from "yargs-parser";
@@ -177,8 +178,12 @@ async function main() {
177178
await Promise.all(
178179
inputSpecPaths.map(async (specPath) => {
179180
if (flags.output !== "." && output === OUTPUT_FILE) {
180-
if (isGlob) outputDir = new URL(specPath, outputDir);
181-
fs.mkdirSync(outputDir, { recursive: true }); // recursively make parent dirs
181+
if (isGlob) {
182+
fs.mkdirSync(new URL(path.dirname(specPath), outputDir), { recursive: true }); // recursively make parent dirs
183+
}
184+
else {
185+
fs.mkdirSync(outputDir, { recursive: true }); // recursively make parent dirs
186+
}
182187
}
183188
await generateSchema(specPath);
184189
})

0 commit comments

Comments
 (0)