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:
parent
a8170e316b
commit
18cf96a06a
1 changed files with 24 additions and 13 deletions
|
@ -24,11 +24,27 @@ status "Using Node.js $node_version"
|
|||
# Run subsequent node/npm commands from the build path
|
||||
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
|
||||
# rebuild any native deps. Otherwise, restore from the build cache.
|
||||
if test -d $build_dir/node_modules; then
|
||||
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
|
||||
elif test -d $cache_dir/node/node_modules; then
|
||||
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
|
||||
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
|
||||
|
||||
# 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
|
||||
mkdir -p $build_dir/.heroku
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue