UNPKG

vuoto

Version:

Modern whitespace normalizer CLI with enhanced output and developer experience - cut the noise, clean the void

27 lines (26 loc) 771 B
import fs from 'node:fs/promises'; import path from 'node:path'; import { VUOTO_IGNORE_FILENAME } from '../consts.js'; /** * Load patterns from .vuotoignore file. * @param cwd Current working directory. * @returns Array of ignore patterns. * @example * ```ts * const patterns = await loadVuotoIgnore(process.cwd()); * console.log(patterns); // ['dist/**', 'build/**'] * ``` */ export async function loadVuotoIgnore(cwd) { const vuotoignorePath = path.join(cwd, VUOTO_IGNORE_FILENAME); try { const content = await fs.readFile(vuotoignorePath, 'utf8'); return content .split('\n') .map((line) => line.trim()) .filter((line) => line && !line.startsWith('#')); } catch { return []; } }