@@ -17,9 +17,11 @@ const getFormedRunCommand = (file, conf = path.resolve(process.cwd(), './protrac
1717 * @param {string } dir a path to the director what should be read
1818 * @param {array<string> } fileList option, empty array what will contains all files
1919 * @param {array<string> } directoryToSkip option, directories what should be exclude from files list
20+ * @param {boolean } ignoreSubDirs option, directories what should be exclude from files list
2021 * @returns {array<string> }
2122 */
22- const getFilesArray = function ( dir , fileList = [ ] , directoryToSkip = [ ] ) {
23+ const getFilesList = function ( dir , fileList = [ ] , directoryToSkip = [ ] , ignoreSubDirs ) {
24+
2325 const files = fs . readdirSync ( dir )
2426 files . forEach ( function ( file ) {
2527 const isDirr = fs . statSync ( path . join ( dir , file ) ) . isDirectory ( )
@@ -30,8 +32,8 @@ const getFilesArray = function(dir, fileList = [], directoryToSkip = []) {
3032
3133 if ( shouldBeExcluded ) { return }
3234
33- if ( isDirr ) {
34- fileList = getFilesArray ( path . join ( dir , file ) , fileList , directoryToSkip )
35+ if ( isDirr && ! ignoreSubDirs ) {
36+ fileList = getFilesList ( path . join ( dir , file ) , fileList , directoryToSkip , ignoreSubDirs )
3537 } else {
3638 fileList . push ( path . join ( dir , file ) )
3739 }
@@ -60,6 +62,6 @@ module.exports = {
6062 getFormedRunCommand,
6163 getPollTime,
6264 sleep,
63- getFilesArray ,
65+ getFilesList ,
6466 returnStringType
6567}
0 commit comments