Skip to content

Commit

Permalink
Run npm rebuild in programs/server/setup.sh.
Browse files Browse the repository at this point in the history
Part of meteor#6537.
  • Loading branch information
Ben Newman committed Apr 7, 2016
1 parent b4fe0d5 commit 91244f3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/isobuild/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,7 @@ class JsImage {
});

const setupScriptPieces = [];
const rebuildDirs = Object.create(null);
// node_modules resources from the packages. Due to appropriate
// builder configuration, 'meteor bundle' and 'meteor deploy' copy
// them, and 'meteor run' symlinks them. If these contain
Expand All @@ -1874,6 +1875,11 @@ class JsImage {
_.each(nodeModulesDirectories, function (nmd) {
assert.strictEqual(typeof nmd.preferredBundlePath, "string");

if (! nmd.isPortable()) {
const parentDir = files.pathDirname(nmd.preferredBundlePath);
rebuildDirs[parentDir] = parentDir;
}

if (nmd.writePackageJSON) {
// Make sure there's an empty node_modules directory at the right place
// in the tree (so that npm install puts modules there instead of
Expand All @@ -1895,7 +1901,7 @@ class JsImage {
// XXX does not support npmDiscards!

setupScriptPieces.push(
'(cd ', nmd.preferredBundlePath, ' && npm install)\n\n');
'(cd ', nmd.preferredBundlePath, ' && npm install)\n');
} else if (nmd.sourcePath !== nmd.preferredBundlePath) {
builder.copyDirectory({
from: nmd.sourcePath,
Expand All @@ -1906,6 +1912,10 @@ class JsImage {
}
});

_.each(rebuildDirs, dir => {
setupScriptPieces.push("(cd ", dir, " && npm rebuild)\n");
});

if (setupScriptPieces.length) {
setupScriptPieces.unshift('#!/usr/bin/env bash\n', 'set -e\n\n');
builder.write('setup.sh', {
Expand Down

0 comments on commit 91244f3

Please sign in to comment.