@hyperse/dependency-sync
Version:
A comprehensive Node.js utility for managing dependencies in monorepo environments, specifically designed for Hyperse plugin ecosystems.
24 lines (23 loc) • 704 B
JavaScript
import { globby } from 'globby';
/**
* Traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules
* @example
* ```ts
* // https://github.com/mrmlnc/fast-glob
* const files = await fileWalk('**\/*.*', {
* cwd: fixtureCwd,
* ignore: ['**\/*.{jpg,png}'],
* });
* ```
* @returns The paths of the files that matched the pattern.
*/
export const fileWalk = (pattern, options = {}) => {
const ignorePattern = options.ignore || [];
return globby(pattern, {
absolute: true,
dot: true,
unique: true,
...options,
ignore: [...ignorePattern, '**/__MACOSX/**', '**/*.DS_Store'],
});
};