diff options
author | Lily Foster <lily@lily.flowers> | 2023-11-13 12:44:13 -0500 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-12-05 21:53:59 +0100 |
commit | b5ca84b4507550b956a4ba38a8f6ad64d1f201de (patch) | |
tree | 75ccdc38f16d3d3b2bf9e22bf73f3af7dc5fa824 /pkgs/build-support/node | |
parent | 3bc050455c6fd32d153f823ebc469c05883e3a51 (diff) |
npmHooks.npmInstallHook: only overwrite npm cache for `npm pack` rather than for entire hook
Diffstat (limited to 'pkgs/build-support/node')
-rw-r--r-- | pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh | 6 |
1 files changed, 2 insertions, 4 deletions
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 a2f77bdc6d430..1e446bb1b0510 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 @@ -5,16 +5,14 @@ npmInstallHook() { runHook preInstall - # `npm pack` writes to cache - npm config delete cache - local -r packageOut="$out/lib/node_modules/$(@jq@ --raw-output '.name' package.json)" + # `npm pack` writes to cache so temporarily override it while IFS= read -r file; do local dest="$packageOut/$(dirname "$file")" mkdir -p "$dest" cp "${npmWorkspace-.}/$file" "$dest" - done < <(@jq@ --raw-output '.[0].files | map(.path) | join("\n")' <<< "$(npm pack --json --dry-run --loglevel=warn --no-foreground-scripts ${npmWorkspace+--workspace=$npmWorkspace} $npmPackFlags "${npmPackFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}")") + done < <(@jq@ --raw-output '.[0].files | map(.path) | join("\n")' <<< "$(npm_config_cache="$HOME/.npm" npm pack --json --dry-run --loglevel=warn --no-foreground-scripts ${npmWorkspace+--workspace=$npmWorkspace} $npmPackFlags "${npmPackFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}")") # Based on code from Python's buildPythonPackage wrap.sh script, for # supporting both the case when makeWrapperArgs is an array and a |