File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -62,14 +62,13 @@ export function findFileBySuffix({
6262 ; ( function search ( currentDir ) {
6363 for ( const entry of fs . readdirSync ( currentDir ) ) {
6464 const entryPath = path . join ( currentDir , entry ) , stat = fs . statSync ( entryPath )
65- if ( entry == 'node_modules'
66- || ( entry . startsWith ( '.' ) && ! dotFolders && stat . isDirectory ( ) ) // dotfolder but disabled
67- ) continue // skip it
68- if ( stat . isDirectory ( ) && recursive ) search ( entryPath )
69- else if ( stat . isFile ( ) && entry . endsWith ( suffix ) // file w/ `suffix`
70- && ( dotFiles || ! entry . startsWith ( '.' ) ) // not dotfile if disabled
71- && ! ignoreFiles . includes ( entry ) // not ignored file
72- ) { foundFiles . push ( entryPath ) ; if ( verbose ) console . log ( entryPath ) }
65+ if ( stat . isDirectory ( ) ) {
66+ if ( entry == 'node_modules' || ( entry . startsWith ( '.' ) && ! dotFolders ) ) continue
67+ if ( recursive ) search ( entryPath )
68+ } else if ( stat . isFile ( ) ) {
69+ if ( ignoreFiles . includes ( entry ) || ( entry . startsWith ( '.' ) && ! dotFiles ) ) continue
70+ if ( entry . endsWith ( suffix ) ) { foundFiles . push ( entryPath ) ; if ( verbose ) console . log ( entryPath ) }
71+ }
7372 }
7473 } ) ( path . resolve ( dir ) )
7574 return foundFiles
You can’t perform that action at this time.
0 commit comments