mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-29 06:26:22 +00:00
22 lines
462 B
TypeScript
22 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[]
|
|
}
|