31 lines
903 B
JavaScript
31 lines
903 B
JavaScript
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = path.resolve(__dirname, "..");
|
|
|
|
const resetTargets = [
|
|
path.join(repoRoot, "data", "runtime"),
|
|
path.join(repoRoot, "storage", "runtime", "seed"),
|
|
path.join(repoRoot, "storage", "runtime", "originals"),
|
|
path.join(repoRoot, "storage", "runtime", "thumbs"),
|
|
path.join(repoRoot, "storage", "runtime", "previews"),
|
|
path.join(repoRoot, "storage", "runtime", "renders")
|
|
];
|
|
|
|
await Promise.all(
|
|
resetTargets.map(async (targetPath) => {
|
|
await fs.rm(targetPath, { recursive: true, force: true });
|
|
})
|
|
);
|
|
|
|
await Promise.all(
|
|
[
|
|
path.join(repoRoot, "data"),
|
|
path.join(repoRoot, "storage")
|
|
].map((targetPath) => fs.mkdir(targetPath, { recursive: true }))
|
|
);
|
|
|
|
console.log("Runtime state cleared.");
|