松浦 知也 Matsuura Tomoya
2024-02-05 ba836dd3e0cda5df23f6d34539809d36805d230e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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[]
}