Skip to content

Commit 2b762a5

Browse files
committed
support data loaders in sub directories of docs/
closes #130
1 parent bb96a2c commit 2b762a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dataloader.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {spawn} from "node:child_process";
22
import {existsSync} from "node:fs";
3-
import {open, rename, unlink} from "node:fs/promises";
4-
import {join} from "node:path";
3+
import {mkdir, open, rename, unlink} from "node:fs/promises";
4+
import {dirname, join} from "node:path";
55
import {maybeStat, prepareOutput} from "./files.js";
66

77
const runningCommands = new Map<string, Promise<string>>();
@@ -92,6 +92,7 @@ export class Loader {
9292
});
9393
await tempFd.close();
9494
if (code === 0) {
95+
await mkdir(dirname(cachePath), {recursive: true});
9596
await rename(tempPath, cachePath);
9697
} else {
9798
await unlink(tempPath);

0 commit comments

Comments
 (0)