File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -32,18 +32,22 @@ function rmdirRecursive(dirPath) {
3232
3333function readdirRecursive ( dirPath , opts = { } ) {
3434 const { ignoreDir } = opts ;
35- return fs . readdirSync ( dirPath , { withFileTypes : true } )
36- . flatMap ( dirent => {
37- const name = dirent . name ;
38- if ( dirent . isDirectory ( ) ) {
39- if ( ignoreDir && ignoreDir . test ( name ) ) {
40- return [ ] ;
41- }
42- return readdirRecursive ( path . join ( dirPath , name ) , opts )
43- . map ( f => path . join ( name , f ) ) ;
44- }
45- return dirent . name ;
46- } ) ;
35+ const result = [ ] ;
36+ for ( const dirent of fs . readdirSync ( dirPath , { withFileTypes : true } ) ) {
37+ const name = dirent . name ;
38+ if ( ! dirent . isDirectory ( ) ) {
39+ result . push ( dirent . name ) ;
40+ continue ;
41+ }
42+
43+ if ( ignoreDir && ignoreDir . test ( name ) ) {
44+ continue ;
45+ }
46+ const list = readdirRecursive ( path . join ( dirPath , name ) , opts )
47+ . map ( f => path . join ( name , f ) ) ;
48+ result . push ( ...list ) ;
49+ }
50+ return result ;
4751}
4852
4953function writeFile ( destPath , data ) {
You can’t perform that action at this time.
0 commit comments