doc: Document npmHooks.npmInstallHook

This commit is contained in:
Ross Smyth 2026-02-04 17:59:23 -05:00
commit d76f3f1741
3 changed files with 60 additions and 0 deletions

View file

@ -29,6 +29,7 @@ mpi-check-hook.section.md
ninja.section.md
npm-build-hook.section.md
npm-config-hook.section.md
npm-install-hook.section.md
patch-rc-path-hooks.section.md
perl.section.md
pkg-config.section.md

View file

@ -0,0 +1,35 @@
# npmHooks.npmInstallHook {#npm-install-hook}
Hook to install node_modules for npm packages.
Does not create wrappers for executable npm projects
Primarily made for a multi-language environment.
## Examples {#npm-install-hook-snippet}
[](#npm-build-hook-example-snippet)
## Variables controlling `npmInstallHook` {#npm-install-hook-variables}
### `npmInstallHook` Exclusive Variables {#npm-install-hook-exclusive-variables}
#### `dontNpmPrune` {#npm-install-hook-dont-prune}
Whether to run {command}`npm prune` on the `node_modules` or not.
Defaults to `true`.
#### `npmInstallFlags` {#npm-install-hook-prune-flags}
Flags to pass to the {command}`npm prune` call for the `node_modules` of the package.
Defaults to `--omit=dev --no-save` which cannot be modified.
#### `dontNpmInstall` {#npm-install-hook-dont}
Controls whether `npmInstallHook` is enabled or not.
Defaults to `true`, so the hook will run.
### Honored Variables {#npm-install-hook-honored-variables}
The following variables are honored by the `npmInstallHook`.
- [`npmWorkspace`](#javascript-buildNpmPackage-npmWorkspace)
- [`npmFlags`](#javascript-buildNpmPackage-npmFlags)

View file

@ -260,6 +260,30 @@
"npm-config-hook-writable-cache": [
"index.html#npm-config-hook-writable-cache"
],
"npm-install-hook": [
"index.html#npm-install-hook"
],
"npm-install-hook-dont": [
"index.html#npm-install-hook-dont"
],
"npm-install-hook-dont-prune": [
"index.html#npm-install-hook-dont-prune"
],
"npm-install-hook-exclusive-variables": [
"index.html#npm-install-hook-exclusive-variables"
],
"npm-install-hook-honored-variables": [
"index.html#npm-install-hook-honored-variables"
],
"npm-install-hook-prune-flags": [
"index.html#npm-install-hook-prune-flags"
],
"npm-install-hook-snippet": [
"index.html#npm-install-hook-snippet"
],
"npm-install-hook-variables": [
"index.html#npm-install-hook-variables"
],
"pkgs-replacevars": [
"index.html#pkgs-replacevars",
"index.html#pkgs-substituteall",