From f9138c5ad63c9c5d1a6266d0b37ee85ef4f6ff05 Mon Sep 17 00:00:00 2001 From: Winter Date: Tue, 23 May 2023 17:16:18 -0400 Subject: [PATCH] npmHooks.npmInstallHook: allow disabling `npm prune` invocation 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. --- .../node/build-npm-package/hooks/npm-install-hook.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh index 59ea2da993d8..4282419d5d6b 100644 --- a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh +++ b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh @@ -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"