Skip to content

Commit 35dc4b7

Browse files
authored
Fix generation of empty directory (#633)
1 parent cf1b89a commit 35dc4b7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

bin/cli.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ async function main() {
153153
inputSpecPaths.map(async (specPath) => {
154154
if (cli.flags.output !== "." && output === OUTPUT_FILE) {
155155
let outputDir = path.join(process.cwd(), cli.flags.output);
156-
if (!isGlob) outputDir = path.dirname(outputDir); // use output dir for glob; use parent dir for single files
157-
await fs.promises.mkdir(path.join(outputDir, path.dirname(specPath)), { recursive: true }); // recursively make parent dirs
156+
if (isGlob) {
157+
outputDir = path.join(outputDir, path.dirname(specPath)); // globs: use output dir + spec dir
158+
} else {
159+
outputDir = path.dirname(outputDir); // single files: just use output parent dir
160+
}
161+
await fs.promises.mkdir(outputDir, { recursive: true }); // recursively make parent dirs
158162
}
159163
await generateSchema(specPath);
160164
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"lint": "eslint --ignore-path .gitignore --ext .js,.ts src",
4949
"prepare": "npm run build",
5050
"pregenerate": "npm run build",
51-
"test": "npm run build && jest --no-cache",
51+
"test": "npm run build && jest --no-cache --test-timeout=10000",
5252
"test:coverage": "npm run build && jest --no-cache --coverage && codecov",
5353
"typecheck": "tsc --noEmit",
5454
"version": "npm run build"

0 commit comments

Comments
 (0)