mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-05 00:02:22 +00:00
fix relative path resolution in router and link crawling
This commit is contained in:
parent
232652149a
commit
2f6747b166
44 changed files with 160 additions and 106 deletions
quartz/util
22
quartz/util/glob.ts
Normal file
22
quartz/util/glob.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
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[]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue