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 22 existsSync
33} = require ( 'fs' ) ;
44const {
5- join
5+ resolve
66} = require ( 'path' )
77const fs = require ( 'fs' )
88
@@ -34,17 +34,19 @@ function getBuildFiles(externalFiles, debugLog) {
3434}
3535
3636const 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' ) )
3841
3942 arrayOfFiles = arrayOfFiles || [ ]
4043
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 )
4648 } else {
47- arrayOfFiles . push ( join ( dirPath , "/" , file ) )
49+ arrayOfFiles . push ( resolvedFile )
4850 }
4951 } )
5052
You can’t perform that action at this time.
0 commit comments