diff options
author | Doron Behar <doron.behar@gmail.com> | 2023-10-01 13:41:42 +0300 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2023-10-07 14:09:05 +0300 |
commit | fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e (patch) | |
tree | fc71f66892bdd0b27ac87722a380607a6bd9fc63 /pkgs/build-support | |
parent | d6521ce1868450a6b3fd6840a391cb213d3d9631 (diff) | |
download | nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.tar nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.tar.gz nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.tar.bz2 nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.tar.lz nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.tar.xz nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.tar.zst nixlib-fc96f6d0fdac6ac8e06af95c6ed416cb7c7d4e2e.zip |
buildNpmPackage: support makeWrapperArgs
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh | 12 |
1 files changed, 11 insertions, 1 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 64ddcbd567fc..c5824a6b232b 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 @@ -16,9 +16,19 @@ npmInstallHook() { cp "${npmWorkspace-.}/$file" "$dest" done < <(@jq@ --raw-output '.[0].files | map(.path) | join("\n")' <<< "$(npm pack --json --dry-run ${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 + # IFS-separated string. + # + # TODO: remove the string branch when __structuredAttrs are used. + if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then + local -a user_args=("${makeWrapperArgs[@]}") + else + local -a user_args="(${makeWrapperArgs:-})" + fi while IFS=" " read -ra bin; do mkdir -p "$out/bin" - makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" + makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" "${user_args[@]}" done < <(@jq@ --raw-output '(.bin | type) as $typ | if $typ == "string" then .name + " " + .bin elif $typ == "object" then .bin | to_entries | map(.key + " " + .value) | join("\n") |