Skip to content

Commit

Permalink
Fix bug in generating multiple spec to folder (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMPL committed Nov 23, 2022
1 parent e335c76 commit 4b354a5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node

import fs from "node:fs";
import path from "path";
import { URL } from "node:url";
import glob from "fast-glob";
import parser from "yargs-parser";
Expand Down Expand Up @@ -177,8 +178,12 @@ async function main() {
await Promise.all(
inputSpecPaths.map(async (specPath) => {
if (flags.output !== "." && output === OUTPUT_FILE) {
if (isGlob) outputDir = new URL(specPath, outputDir);
fs.mkdirSync(outputDir, { recursive: true }); // recursively make parent dirs
if (isGlob) {
fs.mkdirSync(new URL(path.dirname(specPath), outputDir), { recursive: true }); // recursively make parent dirs
}
else {
fs.mkdirSync(outputDir, { recursive: true }); // recursively make parent dirs
}
}
await generateSchema(specPath);
})
Expand Down

0 comments on commit 4b354a5

Please sign in to comment.