fix: rebuild errors on windows (#692)
1 files added
3 files modified
| | |
| | | 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" |
| | |
| | | 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" |
| | |
| | | |
| | | const release = await mut.acquire() |
| | | perf.addEvent("clean") |
| | | await rimraf(output) |
| | | await rmrf(output) |
| | | console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`) |
| | | |
| | | perf.addEvent("glob") |
| | |
| | | |
| | | // TODO: we can probably traverse the link graph to figure out what's safe to delete here |
| | | // instead of just deleting everything |
| | | await rimraf(argv.output) |
| | | await rmrf(argv.output) |
| | | await emitContent(ctx, filteredContent) |
| | | console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`)) |
| | | } catch (err) { |
| | |
| | | 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" |
| | |
| | | gitPull, |
| | | popContentFolder, |
| | | stashContentFolder, |
| | | rmrf, |
| | | } from "./helpers.js" |
| | | import { |
| | | UPSTREAM_NAME, |
| | |
| | | if (contentStat.isSymbolicLink()) { |
| | | await fs.promises.unlink(contentFolder) |
| | | } else { |
| | | await rimraf(contentFolder) |
| | | await rmrf(contentFolder) |
| | | } |
| | | } |
| | | |
| | |
| | | import { contentCacheFolder } from "./constants.js" |
| | | import { spawnSync } from "child_process" |
| | | import fs from "fs" |
| | | import { rimraf } from "rimraf" |
| | | |
| | | export function escapePath(fp) { |
| | | return fp |
| | |
| | | }) |
| | | 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) |
| | | } |
| | | } |
| New file |
| | |
| | | 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) |
| | | } |
| | | } |