buildNpmPackage: give a hint when npm prune fails

Co-authored-by: Lily Foster <lily@lily.flowers>
This commit is contained in:
Sandro 2023-09-19 01:36:06 +02:00 committed by Sandro Jäckel
parent 0ed41137b7
commit 30992a8c51
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5

View file

@ -34,7 +34,16 @@ npmInstallHook() {
if [ ! -d "$nodeModulesPath" ]; then if [ ! -d "$nodeModulesPath" ]; then
if [ -z "${dontNpmPrune-}" ]; 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 fi
find node_modules -maxdepth 1 -type d -empty -delete find node_modules -maxdepth 1 -type d -empty -delete