mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
* fix(lint): compositions in .hyperframesignore no longer count as the project's * fix(lint): keep the ignore helper under the package's comment share
14 lines
572 B
TypeScript
14 lines
572 B
TypeScript
import { existsSync, readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import ignore, { type Ignore } from "ignore";
|
|
|
|
const DEFAULT_PROJECT_IGNORE = ["/renders/", "/snapshots/", ".*"];
|
|
|
|
/** What the project leaves out; ask with a relative `/` path, a folder with a trailing `/`. */
|
|
export function projectIgnore(projectDir: string): Ignore {
|
|
const matcher = ignore().add(DEFAULT_PROJECT_IGNORE);
|
|
const ignorePath = join(projectDir, ".hyperframesignore");
|
|
if (existsSync(ignorePath)) matcher.add(readFileSync(ignorePath, "utf-8"));
|
|
return matcher;
|
|
}
|