Skip to content

Commit

Permalink
npmHooks.npmInstallHook: allow disabling npm prune invocation
Browse files Browse the repository at this point in the history
In some odd scenarios, `npm prune` either fails, or hangs. I have no idea
what could possibly be wrong at the moment, but let's provide an escape
hatch for packages that can still use the rest of the install hook's
functionality.
  • Loading branch information
winterqt committed May 28, 2023
1 parent 22c55e2 commit 9de8683
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -27,7 +27,10 @@ npmInstallHook() {
local -r nodeModulesPath="$packageOut/node_modules"

if [ ! -d "$nodeModulesPath" ]; then
npm prune --omit dev --no-save $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
if [ -z "${dontNpmPrune-}" ]; then
npm prune --omit dev --no-save $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
fi

find node_modules -maxdepth 1 -type d -empty -delete

cp -r node_modules "$nodeModulesPath"
Expand Down

0 comments on commit 9de8683

Please sign in to comment.