Refactor folder removal in build.ts

This commit is contained in:
fl0werpowers 2025-03-31 11:55:18 +02:00
parent da1e99df3c
commit f204443095

View File

@ -3,7 +3,7 @@ sourceMapSupport.install(options)
import path from "path" import path from "path"
import { PerfTimer } from "./util/perf" import { PerfTimer } from "./util/perf"
import { rm } from "fs/promises" import { rm } from "fs/promises"
import { globby, GlobbyFilterFunction, isGitIgnored } from "globby" import { GlobbyFilterFunction, isGitIgnored } from "globby"
import { styleText } from "util" import { styleText } from "util"
import { parseMarkdown } from "./processors/parse" import { parseMarkdown } from "./processors/parse"
import { filterContent } from "./processors/filter" import { filterContent } from "./processors/filter"
@ -67,7 +67,8 @@ async function buildQuartz(argv: Argv, mut: Mutex, clientRefresh: () => void) {
const release = await mut.acquire() const release = await mut.acquire()
perf.addEvent("clean") perf.addEvent("clean")
for (const rmPath of await globby(path.join(output, "*"))) await rm(rmPath, { recursive: true })
await rm(output, { recursive: true, force: true })
console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`) console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`)
perf.addEvent("glob") perf.addEvent("glob")