Revert "fix: rebuild errors on windows (#692)" (#695)

This reverts commit 8eec47c340.
This commit is contained in:
kabirgh 2024-01-15 19:51:46 +00:00 committed by GitHub
parent 8eec47c340
commit 30640e3441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 27 deletions

View File

@ -2,6 +2,7 @@ import sourceMapSupport from "source-map-support"
sourceMapSupport.install(options) sourceMapSupport.install(options)
import path from "path" import path from "path"
import { PerfTimer } from "./util/perf" import { PerfTimer } from "./util/perf"
import { rimraf } from "rimraf"
import { isGitIgnored } from "globby" import { isGitIgnored } from "globby"
import chalk from "chalk" import chalk from "chalk"
import { parseMarkdown } from "./processors/parse" import { parseMarkdown } from "./processors/parse"
@ -12,7 +13,6 @@ import { FilePath, joinSegments, slugifyFilePath } from "./util/path"
import chokidar from "chokidar" import chokidar from "chokidar"
import { ProcessedContent } from "./plugins/vfile" import { ProcessedContent } from "./plugins/vfile"
import { Argv, BuildCtx } from "./util/ctx" import { Argv, BuildCtx } from "./util/ctx"
import { rmrf } from "./util/fs"
import { glob, toPosixPath } from "./util/glob" import { glob, toPosixPath } from "./util/glob"
import { trace } from "./util/trace" import { trace } from "./util/trace"
import { options } from "./util/sourcemap" import { options } from "./util/sourcemap"
@ -40,7 +40,7 @@ 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")
await rmrf(output) await rimraf(output)
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")
@ -145,7 +145,7 @@ async function startServing(
// TODO: we can probably traverse the link graph to figure out what's safe to delete here // TODO: we can probably traverse the link graph to figure out what's safe to delete here
// instead of just deleting everything // instead of just deleting everything
await rmrf(argv.output) await rimraf(argv.output)
await emitContent(ctx, filteredContent) await emitContent(ctx, filteredContent)
console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`)) console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`))
} catch (err) { } catch (err) {

View File

@ -5,6 +5,7 @@ import chalk from "chalk"
import { sassPlugin } from "esbuild-sass-plugin" import { sassPlugin } from "esbuild-sass-plugin"
import fs from "fs" import fs from "fs"
import { intro, outro, select, text } from "@clack/prompts" import { intro, outro, select, text } from "@clack/prompts"
import { rimraf } from "rimraf"
import chokidar from "chokidar" import chokidar from "chokidar"
import prettyBytes from "pretty-bytes" import prettyBytes from "pretty-bytes"
import { execSync, spawnSync } from "child_process" import { execSync, spawnSync } from "child_process"
@ -20,7 +21,6 @@ import {
gitPull, gitPull,
popContentFolder, popContentFolder,
stashContentFolder, stashContentFolder,
rmrf,
} from "./helpers.js" } from "./helpers.js"
import { import {
UPSTREAM_NAME, UPSTREAM_NAME,
@ -109,7 +109,7 @@ export async function handleCreate(argv) {
if (contentStat.isSymbolicLink()) { if (contentStat.isSymbolicLink()) {
await fs.promises.unlink(contentFolder) await fs.promises.unlink(contentFolder)
} else { } else {
await rmrf(contentFolder) await rimraf(contentFolder)
} }
} }

View File

@ -3,7 +3,6 @@ import chalk from "chalk"
import { contentCacheFolder } from "./constants.js" import { contentCacheFolder } from "./constants.js"
import { spawnSync } from "child_process" import { spawnSync } from "child_process"
import fs from "fs" import fs from "fs"
import { rimraf } from "rimraf"
export function escapePath(fp) { export function escapePath(fp) {
return fp return fp
@ -53,11 +52,3 @@ export async function popContentFolder(contentFolder) {
}) })
await fs.promises.rm(contentCacheFolder, { force: true, recursive: true }) await fs.promises.rm(contentCacheFolder, { force: true, recursive: true })
} }
export async function rmrf(path) {
if (os.platform() == "win32") {
return rimraf.windows(path)
} else {
return rimraf(path)
}
}

View File

@ -1,13 +0,0 @@
import os from "os"
import { rimraf, RimrafAsyncOptions } from "rimraf"
export async function rmrf(
path: string | string[],
opt?: RimrafAsyncOptions | undefined,
): Promise<boolean> {
if (os.platform() == "win32") {
return rimraf.windows(path, opt)
} else {
return rimraf(path, opt)
}
}