diff options
| author | Lily Foster <lily@lily.flowers> | 2023-11-13 12:44:13 -0500 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2023-12-05 20:54:44 +0000 |
| commit | 7f735989896cca318fd201c43d0e13b87b863bea (patch) | |
| tree | 9c21fa3cc24eadf41664d45119a8f86ad2188b00 | |
| parent | Merge pull request #272105 from NixOS/backport-271720-to-release-23.11 (diff) | |
| download | nixpkgs-origin/backport-267314-to-release-23.11.tar.gz | |
npmHooks.npmInstallHook: only overwrite npm cache for `npm pack` rather than for entire hookorigin/backport-267314-to-release-23.11
(cherry picked from commit 357c8cdb89715d68defb712f944be2c0fe9644e9)
| -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 a2f77bdc6d43..1e446bb1b051 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 |
