Files
Code-Notes/quartz/util/glob.ts
Oyasumi Gitea 4a5acab07d
All checks were successful
Build and Deploy Quartz / build-and-deploy (push) Has been skipped
init: init commit
2026-01-01 14:16:34 +08:00

23 lines
462 B
TypeScript

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[]> {
const fps = (
await globby(pattern, {
cwd,
ignore: ignorePatterns,
gitignore: true,
})
).map(toPosixPath)
return fps as FilePath[]
}