UNPKG

@codemod-utils/files

Version:
67 lines (66 loc) 1.48 kB
import type { FilePath, Options } from './types.js'; /** * Returns the paths of all files that match your search criteria * (i.e. {@link https://github.com/isaacs/node-glob#glob-primer | glob pattern}, ignore list, and project root). * The paths are sorted in alphabetical order. * * @param pattern * * A glob pattern that describes which files you are looking for. * * @param options * * An object with `ignoreList` (an array of file paths or glob * patterns) and `projectRoot`. * * @return * * Paths of all files that match your search criteria. * * @example * * Find all component templates in an Ember app. * * ```ts * const filePaths = findFiles('app/components/**\/*.hbs', { * projectRoot, * }); * ``` * * @example * * Find all component classes in an Ember app. * * ```ts * const filePaths = findFiles('app/components/**\/*.{js,ts}', { * ignoreList: ['**\/*.d.ts'], * projectRoot, * }); * ``` * * @example * * Pass an array of glob patterns (pattern A or pattern B or ...). * * ```ts * const filePaths = findFiles([ * 'LICENSE.md', * 'README.md', * ], { * projectRoot, * }); * ``` * * ```ts * const filePaths = findFiles([ * 'app/components/**\/*.hbs', * 'tests/integration/components/**\/*-test.{js,ts}', * ], { * projectRoot, * }); * ``` */ export declare function findFiles(pattern: string | string[], options: Options & { ignoreList?: string[]; projectRoot: string; }): FilePath[];