Merge pull request #255984 from SuperSandro2000/patch-1

build-npm-package: give a hint when npm prune fails
This commit is contained in:
Lily Foster 2023-10-07 17:51:52 -04:00 committed by GitHub
commit 57087b8346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,16 @@ npmInstallHook() {
if [ ! -d "$nodeModulesPath" ]; then
if [ -z "${dontNpmPrune-}" ]; then
npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
if ! npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then
echo
echo
echo "ERROR: npm prune step failed"
echo
echo 'If npm tried to download additional dependencies above, try setting `dontNpmPrune = true`.'
echo
exit 1
fi
fi
find node_modules -maxdepth 1 -type d -empty -delete