This commit is contained in:
Jacky Zhao 2023-08-02 22:11:46 -07:00
parent f38ed1f1c6
commit 7264f15314
2 changed files with 9 additions and 5 deletions

View File

@ -78,7 +78,7 @@ async function startServing(ctx: BuildCtx, initialContent: ProcessedContent[]) {
let toRebuild: Set<FilePath> = new Set()
let toRemove: Set<FilePath> = new Set()
async function rebuild(fp: string, action: "add" | "change" | "delete") {
fp = toPosixPath(fp)
fp = toPosixPath(fp)
if (!ignored(fp)) {
const filePath = joinSegments(argv.directory, fp) as FilePath
if (action === "add" || action === "change") {

View File

@ -1,12 +1,16 @@
import path from "path";
import { FilePath } from "./path";
import { globby } from "globby";
import path from "path"
import { FilePath } from "./path"
import { globby } from "globby"
export function toPosixPath(fp: string): string {
return fp.split(path.sep).join("/")
}
export async function glob(pattern: string, cwd: string, ignorePatterns: string[]): Promise<FilePath[]> {
export async function glob(
pattern: string,
cwd: string,
ignorePatterns: string[],
): Promise<FilePath[]> {
const fps = (
await globby(pattern, {
cwd,