Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Commit 00af9c5

Browse files
committed
Don't copy node_modules/.bin in exported packages to fix pruning issue on Travis
1 parent 7c49375 commit 00af9c5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/package.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ function shouldIgnore(file) {
3535
file = file.substring(sourceRootPath.length + 1).replace(/\\/g, "/");
3636

3737
// Protected folders
38-
if (file.indexOf("node_modules/") !== -1) return false;
38+
if (file.indexOf("node_modules/") !== -1) {
39+
// We don't need .bin files and they contain symlinks, messing up pruning
40+
// So let's never copy them
41+
if (file.indexOf("node_modules/.bin") !== -1) return true;
42+
return false;
43+
}
3944
if (file.indexOf("public/") !== -1) return false;
4045

4146
if (file[0] === "." || file.indexOf("/.") !== -1) return true;
@@ -76,6 +81,7 @@ readdirRecursive(sourceRootPath, [ shouldIgnore ], (err, files) => {
7681

7782
async.eachSeries(buildPaths, (buildPath, cb) => {
7883
if (!fs.existsSync(`${buildPath}/package.json`)) { cb(); return; }
84+
7985
const spawnOptions = { cwd: buildPath, env: process.env, stdio: "inherit" };
8086
const npm = child_process.spawn(`npm${execSuffix ? ".cmd" : ""}`, [ "prune", "--production" ], spawnOptions);
8187

0 commit comments

Comments
 (0)