1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

Attempt to work around npm/npm#5400.

This commit is contained in:
Simo Kinnunen 2014-08-05 17:38:58 +09:00
parent a8170e316b
commit 18cf96a06a

View file

@ -24,11 +24,27 @@ status "Using Node.js $node_version"
# Run subsequent node/npm commands from the build path # Run subsequent node/npm commands from the build path
cd $build_dir cd $build_dir
install() {
(
# Scope config var availability only to `npm install`
if [ -d "$env_dir" ]; then
status "Exporting config vars to environment"
export_env_dir $env_dir
fi
status "Installing npm dependencies"
# Make npm output to STDOUT instead of its default STDERR
npm install --loglevel=http --userconfig $build_dir/.npmrc "$@" 2>&1 | indent
)
}
# If node_modules directory is checked into source control then # If node_modules directory is checked into source control then
# rebuild any native deps. Otherwise, restore from the build cache. # rebuild any native deps. Otherwise, restore from the build cache.
if test -d $build_dir/node_modules; then if test -d $build_dir/node_modules; then
status "Found existing node_modules directory; skipping cache" status "Found existing node_modules directory; skipping cache"
status "Rebuilding any native dependencies" # Attempt to work around npm/npm#5400
install --ignore-scripts
status "Rebuilding any native dependencies to work around npm/npm#5400"
npm rebuild 2>&1 | indent npm rebuild 2>&1 | indent
elif test -d $cache_dir/node/node_modules; then elif test -d $cache_dir/node/node_modules; then
status "Restoring node_modules directory from cache" status "Restoring node_modules directory from cache"
@ -42,20 +58,15 @@ elif test -d $cache_dir/node/node_modules; then
npm rebuild 2>&1 | indent npm rebuild 2>&1 | indent
fi fi
# Let's hope that npm/npm#5400 only hits us on the first run
install
else
# Attempt to work around npm/npm#5400
install --ignore-scripts
status "Rebuilding any native dependencies to work around npm/npm#5400"
npm rebuild 2>&1 | indent
fi fi
# Scope config var availability only to `npm install`
(
if [ -d "$env_dir" ]; then
status "Exporting config vars to environment"
export_env_dir $env_dir
fi
status "Installing npm dependencies"
# Make npm output to STDOUT instead of its default STDERR
npm install --loglevel=http --userconfig $build_dir/.npmrc 2>&1 | indent
)
# Persist goodies like node-version in the slug # Persist goodies like node-version in the slug
mkdir -p $build_dir/.heroku mkdir -p $build_dir/.heroku