mirror of
https://github.com/ZetaKebab/quartz.git
synced 2025-06-22 16:54:36 +00:00
make path and globbing more platform invariant
This commit is contained in:
18
quartz/glob.ts
Normal file
18
quartz/glob.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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[]
|
||||
}
|
Reference in New Issue
Block a user