depot/third_party/nixpkgs/pkgs/by-name/no/nodejsInstallManuals/hook.sh
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

14 lines
510 B
Bash

# shellcheck shell=bash
nodejsInstallManuals() {
local -r packageJson="${1-./package.json}"
local -r packageOut="$out/lib/node_modules/$(@jq@ --raw-output '.name' package.json)"
while IFS= read -r man; do
installManPage "$packageOut/$man"
done < <(@jq@ --raw-output '(.man | type) as $typ | if $typ == "string" then .man
elif $typ == "list" then .man | join("\n")
elif $typ == "null" then empty
else "invalid type " + $typ | halt_error end' "$packageJson")
}