From 30640e3441f9273dfdb9f8cf6ea0a29f0bec04a0 Mon Sep 17 00:00:00 2001
From: kabirgh <15871468+kabirgh@users.noreply.github.com>
Date: Mon, 15 Jan 2024 19:51:46 +0000
Subject: [PATCH] Revert "fix: rebuild errors on windows (#692)" (#695)

---
 quartz/build.ts        |    6 +++---
 /dev/null              |   13 -------------
 quartz/cli/handlers.js |    4 ++--
 quartz/cli/helpers.js  |    9 ---------
 4 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/quartz/build.ts b/quartz/build.ts
index 6bb3b50..24f0498 100644
--- a/quartz/build.ts
+++ b/quartz/build.ts
@@ -2,6 +2,7 @@
 sourceMapSupport.install(options)
 import path from "path"
 import { PerfTimer } from "./util/perf"
+import { rimraf } from "rimraf"
 import { isGitIgnored } from "globby"
 import chalk from "chalk"
 import { parseMarkdown } from "./processors/parse"
@@ -12,7 +13,6 @@
 import chokidar from "chokidar"
 import { ProcessedContent } from "./plugins/vfile"
 import { Argv, BuildCtx } from "./util/ctx"
-import { rmrf } from "./util/fs"
 import { glob, toPosixPath } from "./util/glob"
 import { trace } from "./util/trace"
 import { options } from "./util/sourcemap"
@@ -40,7 +40,7 @@
 
   const release = await mut.acquire()
   perf.addEvent("clean")
-  await rmrf(output)
+  await rimraf(output)
   console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`)
 
   perf.addEvent("glob")
@@ -145,7 +145,7 @@
 
       // TODO: we can probably traverse the link graph to figure out what's safe to delete here
       // instead of just deleting everything
-      await rmrf(argv.output)
+      await rimraf(argv.output)
       await emitContent(ctx, filteredContent)
       console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`))
     } catch (err) {
diff --git a/quartz/cli/handlers.js b/quartz/cli/handlers.js
index 8460dad..6f8aad1 100644
--- a/quartz/cli/handlers.js
+++ b/quartz/cli/handlers.js
@@ -5,6 +5,7 @@
 import { sassPlugin } from "esbuild-sass-plugin"
 import fs from "fs"
 import { intro, outro, select, text } from "@clack/prompts"
+import { rimraf } from "rimraf"
 import chokidar from "chokidar"
 import prettyBytes from "pretty-bytes"
 import { execSync, spawnSync } from "child_process"
@@ -20,7 +21,6 @@
   gitPull,
   popContentFolder,
   stashContentFolder,
-  rmrf,
 } from "./helpers.js"
 import {
   UPSTREAM_NAME,
@@ -109,7 +109,7 @@
     if (contentStat.isSymbolicLink()) {
       await fs.promises.unlink(contentFolder)
     } else {
-      await rmrf(contentFolder)
+      await rimraf(contentFolder)
     }
   }
 
diff --git a/quartz/cli/helpers.js b/quartz/cli/helpers.js
index 1bb9b23..702a1b7 100644
--- a/quartz/cli/helpers.js
+++ b/quartz/cli/helpers.js
@@ -3,7 +3,6 @@
 import { contentCacheFolder } from "./constants.js"
 import { spawnSync } from "child_process"
 import fs from "fs"
-import { rimraf } from "rimraf"
 
 export function escapePath(fp) {
   return fp
@@ -53,11 +52,3 @@
   })
   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)
-  }
-}
diff --git a/quartz/util/fs.ts b/quartz/util/fs.ts
deleted file mode 100644
index ef15fc0..0000000
--- a/quartz/util/fs.ts
+++ /dev/null
@@ -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)
-  }
-}

--
Gitblit v1.10.0