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

Commit

Permalink
Don't copy node_modules/.bin in exported packages to fix pruning issu…
Browse files Browse the repository at this point in the history
…e on Travis
  • Loading branch information
elisee committed Mar 18, 2019
1 parent 7c49375 commit 00af9c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ function shouldIgnore(file) {
file = file.substring(sourceRootPath.length + 1).replace(/\\/g, "/");

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

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

async.eachSeries(buildPaths, (buildPath, cb) => {
if (!fs.existsSync(`${buildPath}/package.json`)) { cb(); return; }

const spawnOptions = { cwd: buildPath, env: process.env, stdio: "inherit" };
const npm = child_process.spawn(`npm${execSuffix ? ".cmd" : ""}`, [ "prune", "--production" ], spawnOptions);

Expand Down

0 comments on commit 00af9c5

Please sign in to comment.