···1414 cp "${npmWorkspace-.}/$file" "$dest"
1515 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[@]}")")
16161717- # Based on code from Python's buildPythonPackage wrap.sh script, for
1818- # supporting both the case when makeWrapperArgs is an array and a
1919- # IFS-separated string.
2020- #
2121- # TODO: remove the string branch when __structuredAttrs are used.
2222- if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then
2323- local -a user_args=("${makeWrapperArgs[@]}")
2424- else
2525- local -a user_args="(${makeWrapperArgs:-})"
2626- fi
2727- while IFS=" " read -ra bin; do
2828- mkdir -p "$out/bin"
2929- makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" "${user_args[@]}"
3030- done < <(@jq@ --raw-output '(.bin | type) as $typ | if $typ == "string" then
3131- .name + " " + .bin
3232- elif $typ == "object" then .bin | to_entries | map(.key + " " + .value) | join("\n")
3333- elif $typ == "null" then empty
3434- else "invalid type " + $typ | halt_error end' "${npmWorkspace-.}/package.json")
1717+ nodejsInstallExecutables "${npmWorkspace-.}/package.json"
35183636- while IFS= read -r man; do
3737- installManPage "$packageOut/$man"
3838- done < <(@jq@ --raw-output '(.man | type) as $typ | if $typ == "string" then .man
3939- elif $typ == "list" then .man | join("\n")
4040- elif $typ == "null" then empty
4141- else "invalid type " + $typ | halt_error end' "${npmWorkspace-.}/package.json")
1919+ nodejsInstallManuals "${npmWorkspace-.}/package.json"
42204321 local -r nodeModulesPath="$packageOut/node_modules"
4422
+27
pkgs/by-name/no/nodejsInstallExecutables/hook.sh
···11+# shellcheck shell=bash
22+33+nodejsInstallExecutables() {
44+ local -r packageJson="${1-./package.json}"
55+66+ local -r packageOut="$out/lib/node_modules/$(@jq@ --raw-output '.name' package.json)"
77+88+ # Based on code from Python's buildPythonPackage wrap.sh script, for
99+ # supporting both the case when makeWrapperArgs is an array and a
1010+ # IFS-separated string.
1111+ #
1212+ # TODO: remove the string branch when __structuredAttrs are used.
1313+ if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then
1414+ local -a user_args=("${makeWrapperArgs[@]}")
1515+ else
1616+ local -a user_args="(${makeWrapperArgs:-})"
1717+ fi
1818+1919+ while IFS=" " read -ra bin; do
2020+ mkdir -p "$out/bin"
2121+ makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" "${user_args[@]}"
2222+ done < <(@jq@ --raw-output '(.bin | type) as $typ | if $typ == "string" then
2323+ .name + " " + .bin
2424+ elif $typ == "object" then .bin | to_entries | map(.key + " " + .value) | join("\n")
2525+ elif $typ == "null" then empty
2626+ else "invalid type " + $typ | halt_error end' "$packageJson")
2727+}