Loading pkgs/build-support/node/build-npm-package/default.nix +5 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ , npmBuildScript ? "build" # Flags to pass to all npm commands. , npmFlags ? [ ] # Flags to pass to `npm ci` and `npm prune`. # Flags to pass to `npm ci`. , npmInstallFlags ? [ ] # Flags to pass to `npm rebuild`. , npmRebuildFlags ? [ ] Loading @@ -30,6 +30,10 @@ , npmBuildFlags ? [ ] # Flags to pass to `npm pack`. , npmPackFlags ? [ ] # Flags to pass to `npm prune`. , npmPruneFlags ? npmInstallFlags # Value for npm `--workspace` flag and directory in which the files to be installed are found. , npmWorkspace ? null , ... } @ args: Loading pkgs/build-support/node/build-npm-package/hooks/npm-build-hook.sh +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ npmBuildHook() { exit 1 fi if ! npm run "$npmBuildScript" $npmBuildFlags "${npmBuildFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then if ! npm run ${npmWorkspace+--workspace=$npmWorkspace} "$npmBuildScript" $npmBuildFlags "${npmBuildFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then echo echo 'ERROR: `npm build` failed' echo Loading pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh +4 −4 Original line number Diff line number Diff line Loading @@ -13,8 +13,8 @@ npmInstallHook() { while IFS= read -r file; do local dest="$packageOut/$(dirname "$file")" mkdir -p "$dest" cp "$file" "$dest" done < <(@jq@ --raw-output '.[0].files | map(.path) | join("\n")' <<< "$(npm pack --json --dry-run $npmPackFlags "${npmPackFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}")") 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[@]}")") while IFS=" " read -ra bin; do mkdir -p "$out/bin" Loading @@ -22,13 +22,13 @@ npmInstallHook() { 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") else "invalid type " + $typ | halt_error end' package.json) else "invalid type " + $typ | halt_error end' "${npmWorkspace-.}/package.json") local -r nodeModulesPath="$packageOut/node_modules" if [ ! -d "$nodeModulesPath" ]; then if [ -z "${dontNpmPrune-}" ]; then npm prune --omit dev --no-save $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}" npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}" fi find node_modules -maxdepth 1 -type d -empty -delete Loading Loading
pkgs/build-support/node/build-npm-package/default.nix +5 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ , npmBuildScript ? "build" # Flags to pass to all npm commands. , npmFlags ? [ ] # Flags to pass to `npm ci` and `npm prune`. # Flags to pass to `npm ci`. , npmInstallFlags ? [ ] # Flags to pass to `npm rebuild`. , npmRebuildFlags ? [ ] Loading @@ -30,6 +30,10 @@ , npmBuildFlags ? [ ] # Flags to pass to `npm pack`. , npmPackFlags ? [ ] # Flags to pass to `npm prune`. , npmPruneFlags ? npmInstallFlags # Value for npm `--workspace` flag and directory in which the files to be installed are found. , npmWorkspace ? null , ... } @ args: Loading
pkgs/build-support/node/build-npm-package/hooks/npm-build-hook.sh +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ npmBuildHook() { exit 1 fi if ! npm run "$npmBuildScript" $npmBuildFlags "${npmBuildFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then if ! npm run ${npmWorkspace+--workspace=$npmWorkspace} "$npmBuildScript" $npmBuildFlags "${npmBuildFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then echo echo 'ERROR: `npm build` failed' echo Loading
pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh +4 −4 Original line number Diff line number Diff line Loading @@ -13,8 +13,8 @@ npmInstallHook() { while IFS= read -r file; do local dest="$packageOut/$(dirname "$file")" mkdir -p "$dest" cp "$file" "$dest" done < <(@jq@ --raw-output '.[0].files | map(.path) | join("\n")' <<< "$(npm pack --json --dry-run $npmPackFlags "${npmPackFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}")") 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[@]}")") while IFS=" " read -ra bin; do mkdir -p "$out/bin" Loading @@ -22,13 +22,13 @@ npmInstallHook() { 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") else "invalid type " + $typ | halt_error end' package.json) else "invalid type " + $typ | halt_error end' "${npmWorkspace-.}/package.json") local -r nodeModulesPath="$packageOut/node_modules" if [ ! -d "$nodeModulesPath" ]; then if [ -z "${dontNpmPrune-}" ]; then npm prune --omit dev --no-save $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}" npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}" fi find node_modules -maxdepth 1 -type d -empty -delete Loading