1
1
import glob from "glob" ;
2
2
import path from "path" ;
3
- import { existsSync , lstatSync , readdirSync } from "fs-extra" ;
3
+ import { existsSync , lstatSync } from "fs-extra" ;
4
4
5
5
import logger from "../shared/logger" ;
6
- import { Options } from "../index" ;
7
6
8
7
const isDirectory = ( filePath : string ) => lstatSync ( filePath ) . isDirectory ( ) ;
9
8
const isFile = ( filePath : string ) => lstatSync ( filePath ) . isFile ( ) ;
@@ -20,8 +19,7 @@ const globSearch = (pattern: string) => {
20
19
} ;
21
20
22
21
/** Recursively get all file paths. */
23
- export const getFilePaths = ( paths : string [ ] , options : Options ) => {
24
- let { detectRoots } = options ;
22
+ export const getFilePaths = ( paths : string [ ] ) => {
25
23
const files : string [ ] [ ] = [ ] ;
26
24
27
25
while ( paths . length > 0 ) {
@@ -39,16 +37,7 @@ export const getFilePaths = (paths: string[], options: Options) => {
39
37
if ( isFile ( filePath ) ) {
40
38
files . push ( [ filePath ] ) ;
41
39
} else if ( isDirectory ( filePath ) ) {
42
- if ( detectRoots ) {
43
- const childDirectories = readdirSync ( path . resolve ( filePath ) )
44
- . map ( x => path . join ( filePath , x ) )
45
- . filter ( x => isDirectory ( x ) ) ;
46
-
47
- paths . push ( ...childDirectories ) ;
48
- detectRoots = false ;
49
- } else {
50
- paths . push ( path . join ( filePath , "/**/*.*" ) ) ;
51
- }
40
+ paths . push ( path . join ( filePath , "/**/*.*" ) ) ;
52
41
}
53
42
} else {
54
43
logger . error ( `Unable to resolve the path: ${ filePath } ` ) ;
0 commit comments