Skip to content

Commit

Permalink
Replace npm in dev bundle with version from our own fork
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Jul 24, 2015
1 parent 122093b commit e924dc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion scripts/dev-bundle-tool-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var packageJson = {
// Version is not important but is needed to prevent warnings.
version: "0.0.0",
dependencies: {
npm: "1.4.28",
fibers: fibersVersion,
"meteor-babel": "0.4.4",
"meteor-promise": "0.4.0",
Expand Down
22 changes: 22 additions & 0 deletions scripts/generate-dev-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ else
curl "${MONGO_URL}" | tar zx
fi

# Copy bundled npm to temporary directory so we can restore it later
# We do this because the bundled node is built using PORTABLE=1,
# which makes npm look for node relative to it's own directory
# See build-node-for-dev-bundle.sh
cp -r "$DIR/lib/node_modules/npm" "$DIR/bundled-npm"

# export path so we use the downloaded node and npm
export PATH="$DIR/bin:$PATH"

Expand Down Expand Up @@ -167,6 +173,22 @@ mv BrowserStackLocal "$DIR/bin/"
# remove our temporary npm3 directory
rm -rf "$DIR/bin/npm3"

# Sanity check to see if we're not breaking anything by replacing npm
INSTALLED_NPM_VERSION=$(cat "$DIR/lib/node_modules/npm/package.json" |
xargs -0 node -e "console.log(JSON.parse(process.argv[1]).version)")
if [ "$INSTALLED_NPM_VERSION" != "1.3.4" ]; then
echo "Unexpected NPM version in lib/node_modules: $INSTALLED_NPM_VERSION"
echo "We will be replacing it with our own version because the bundled node"
echo "is built using PORTABLE=1, which makes npm look for node relative to"
echo "its own directory."
echo "Update this check if you know what you're doing."
exit 1
fi

# Overwrite lib/modules/npm with bundled npm from temporary directory
rm -rf "$DIR/lib/node_modules/npm"
mv -f "$DIR/bundled-npm" "$DIR/lib/node_modules/npm"

echo BUNDLING

cd "$DIR"
Expand Down

0 comments on commit e924dc4

Please sign in to comment.