fix: list-files will not ignore entire tree if there's error while browsing (#2089)

This commit is contained in:
Linh Tran authored and GitHub committed 2025-03-05 13:19:34 -08:00
1 parent 3a44bcf784
commit faa5e4dd61
1 file changed
+2 -1
+2 -1
View File
@@ -36,7 +36,7 @@ export async function listFiles(dirPath: string, recursive: boolean, limit: numb
".*", // '!**/.*' excludes hidden directories, while '!**/.*/**' excludes only their contents. This way we are at least aware of the existence of hidden directories.
].map((dir) => `**/${dir}/**`)
const options = {
const options: Options = {
cwd: dirPath,
dot: true, // do not ignore hidden files/directories
absolute: true,
@@ -44,6 +44,7 @@ export async function listFiles(dirPath: string, recursive: boolean, limit: numb
gitignore: recursive, // globby ignores any files that are gitignored
ignore: recursive ? dirsToIgnore : undefined, // just in case there is no gitignore, we ignore sensible defaults
onlyFiles: false, // true by default, false means it will list directories on their own too
suppressErrors: true,
}
// * globs all files in one dir, ** globs files in nested directories