Skip to content

Commit fac8a4d

Browse files
author
Guy Thomas
committed
dont remove base path until the end
1 parent 33ae47d commit fac8a4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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'))

0 commit comments

Comments
 (0)