chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / no / nodejsInstallExecutables / hook.sh
blobab2a8e372da426abb1f7d927fa57398ea7a2b23e
1 # shellcheck shell=bash
3 nodejsInstallExecutables() {
4 local -r packageJson="${1-./package.json}"
6 local -r packageOut="$out/lib/node_modules/$(@jq@ --raw-output '.name' package.json)"
8 # Based on code from Python's buildPythonPackage wrap.sh script, for
9 # supporting both the case when makeWrapperArgs is an array and a
10 # IFS-separated string.
12 # TODO: remove the string branch when __structuredAttrs are used.
13 if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then
14 local -a user_args=("${makeWrapperArgs[@]}")
15 else
16 local -a user_args="(${makeWrapperArgs:-})"
19 while IFS=" " read -ra bin; do
20 mkdir -p "$out/bin"
21 makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" "${user_args[@]}"
22 done < <(@jq@ --raw-output '(.bin | type) as $typ | if $typ == "string" then
23 .name + " " + .bin
24 elif $typ == "object" then .bin | to_entries | map(.key + " " + .value) | join("\n")
25 elif $typ == "null" then empty
26 else "invalid type " + $typ | halt_error end' "$packageJson")