File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,7 @@ const getAllFiles = dirPath =>
2626 if ( file === 'node_modules' ) return acc ;
2727 const relativePath = dirPath + '/' + file ;
2828 const isDirectory = fs . statSync ( relativePath ) . isDirectory ( ) ;
29- // Removes the dirPath from start of the string
30- const fileNameForSandbox = relativePath . replace ( new RegExp ( `^${ dirPath } /` ) , "" )
31- const additions = isDirectory ? getAllFiles ( relativePath ) : [ fileNameForSandbox ] ;
29+ const additions = isDirectory ? getAllFiles ( relativePath ) : [ relativePath ] ;
3230 return [ ...acc , ...additions ] ;
3331 } , [ ] ) ;
3432
@@ -58,7 +56,9 @@ module.exports = (
5856 const getFilesList = directory => {
5957 let packageJsonFound = false ;
6058 const folderFiles = getAllFiles ( directory ) ;
59+ const basePathRE = new RegExp ( `^${ directory } /` ) ;
6160 const sandboxFiles = folderFiles
61+ . map ( file => file . replace ( basePathRE , '' ) )
6262 // we ignore the package.json file as it will
6363 // be handled separately
6464 . filter ( file => ! file . includes ( 'package.json' ) )
You can’t perform that action at this time.
0 commit comments