File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 2
2
existsSync
3
3
} = require ( 'fs' ) ;
4
4
const {
5
- join
5
+ resolve
6
6
} = require ( 'path' )
7
7
const fs = require ( 'fs' )
8
8
@@ -34,17 +34,19 @@ function getBuildFiles(externalFiles, debugLog) {
34
34
}
35
35
36
36
const getAllBuildFiles = function ( dirPath , arrayOfFiles ) {
37
- const files = fs . readdirSync ( dirPath )
37
+ const files = fs . readdirSync ( dirPath , {
38
+ withFileTypes : true
39
+ } )
40
+ . filter ( it => ! it . name . startsWith ( '.' ) && ! it . name . startsWith ( 'node_modules' ) )
38
41
39
42
arrayOfFiles = arrayOfFiles || [ ]
40
43
41
- files . forEach ( ( file ) => {
42
- const fsStat = fs . statSync ( join ( dirPath , "/" , file ) )
43
-
44
- if ( fsStat . isDirectory ( ) ) {
45
- arrayOfFiles = getAllBuildFiles ( join ( dirPath , "/" , file ) , arrayOfFiles )
44
+ files . forEach ( ( dirent ) => {
45
+ const resolvedFile = resolve ( dirPath , dirent . name ) ;
46
+ if ( dirent . isDirectory ( ) ) {
47
+ arrayOfFiles = getAllBuildFiles ( resolvedFile , arrayOfFiles )
46
48
} else {
47
- arrayOfFiles . push ( join ( dirPath , "/" , file ) )
49
+ arrayOfFiles . push ( resolvedFile )
48
50
}
49
51
} )
50
52
You can’t perform that action at this time.
0 commit comments