forked from mirrors/nixpkgs
npmHooks.npmInstallHook: pass install flags to prune
This commit is contained in:
parent
80ecb954e9
commit
93334f5234
|
@ -196,7 +196,7 @@ buildNpmPackage rec {
|
|||
* `makeCacheWritable`: Whether to make the cache writable prior to installing dependencies. Don't set this unless npm tries to write to the cache directory, as it can slow down the build.
|
||||
* `npmBuildScript`: The script to run to build the project. Defaults to `"build"`.
|
||||
* `npmFlags`: Flags to pass to all npm commands.
|
||||
* `npmInstallFlags`: Flags to pass to `npm ci`.
|
||||
* `npmInstallFlags`: Flags to pass to `npm ci` and `npm prune`.
|
||||
* `npmBuildFlags`: Flags to pass to `npm run ${npmBuildScript}`.
|
||||
* `npmPackFlags`: Flags to pass to `npm pack`.
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
, npmBuildScript ? "build"
|
||||
# Flags to pass to all npm commands.
|
||||
, npmFlags ? [ ]
|
||||
# Flags to pass to `npm ci`.
|
||||
# Flags to pass to `npm ci` and `npm prune`.
|
||||
, npmInstallFlags ? [ ]
|
||||
# Flags to pass to `npm rebuild`.
|
||||
, npmRebuildFlags ? [ ]
|
||||
|
|
|
@ -27,7 +27,7 @@ npmInstallHook() {
|
|||
local -r nodeModulesPath="$packageOut/node_modules"
|
||||
|
||||
if [ ! -d "$nodeModulesPath" ]; then
|
||||
npm prune --omit dev
|
||||
npm prune --omit dev $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
|
||||
find node_modules -maxdepth 1 -type d -empty -delete
|
||||
|
||||
cp -r node_modules "$nodeModulesPath"
|
||||
|
|
Loading…
Reference in a new issue