From ae86a507edd30911f2dfb1359ad83b448cbddb28 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 6 Dec 2023 10:43:56 -0500 Subject: [PATCH] npmHooks.npmInstallHook: ignore bundle deps when calculating files to install This assumes that downstream users of `buildNpmPackage` would rather our own built `node_modules` be copied to the output rather than only the `bundleDependencies` specified in the `package.json` file. Having the latter behavior seems unexpected and unintuitive, and would not work as installing from an `npm pack` is intended to (since doing that would not do a `rebuild` step on those dependencies and it would skip reifying a full dependency tree). --- .../node/build-npm-package/hooks/npm-install-hook.sh | 2 +- 1 file changed, 1 insertion(+), 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 56e3a883b99a..750ed421789f 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 @@ -12,7 +12,7 @@ npmInstallHook() { local dest="$packageOut/$(dirname "$file")" mkdir -p "$dest" cp "${npmWorkspace-.}/$file" "$dest" - 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[@]}")") + done < <(@jq@ --raw-output '.[0].files | map(.path | select(. | startswith("node_modules/") | not)) | 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