diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-01-28 21:47:47 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2021-01-28 23:47:09 +0300 |
commit | 9351cbf9afd2310c56b9953c005505ea5126a5d4 (patch) | |
tree | 865ec1d49fece7cc6835b8c15a44ab3868156be8 /docs | |
parent | abae00ca05925e521696dd12480853509aab6c0a (diff) |
docs: refresh npm run-script docs
- Added configuration section
- Documented a few more relevant config options
PR-URL: https://github.com/npm/cli/pull/2566
Credit: @ruyadorno
Close: #2566
Reviewed-by: @nlf
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/commands/npm-run-script.md | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/docs/content/commands/npm-run-script.md b/docs/content/commands/npm-run-script.md index b7ab20a73..8b89435e1 100644 --- a/docs/content/commands/npm-run-script.md +++ b/docs/content/commands/npm-run-script.md @@ -32,7 +32,7 @@ npm run test -- --grep="pattern" ``` The arguments will only be passed to the script specified after ```npm run``` -and not to any pre or post script. +and not to any `pre` or `post` script. The `env` script is a special built-in command that can be used to list environment variables that will be available to the script at runtime. If an @@ -56,7 +56,8 @@ instead of ``` The actual shell your script is run within is platform dependent. By default, -on Unix-like systems it is the `/bin/sh` command, on Windows it is the `cmd.exe`. +on Unix-like systems it is the `/bin/sh` command, on Windows it is +`cmd.exe`. The actual shell referred to by `/bin/sh` also depends on the system. You can customize the shell with the `script-shell` configuration. @@ -73,15 +74,43 @@ If `--scripts-prepend-node-path=auto` is passed (which has been the default in `npm` v3), this is only performed when that `node` executable is not found in the `PATH`. -If you try to run a script without having a `node_modules` directory and it fails, -you will be given a warning to run `npm install`, just in case you've forgotten. +If you try to run a script without having a `node_modules` directory and it +fails, you will be given a warning to run `npm install`, just in case you've +forgotten. -You can use the `--silent` flag to prevent showing `npm ERR!` output on error. +### Configuration + +#### if-present + +* Type: Boolean +* Default: false You can use the `--if-present` flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. +#### ignore-scripts + +* Type: Boolean +* Default: false + +Skips running `pre` and `post` scripts. + +#### script-shell + +* Type: String +* Default: `null` + +Optional custom script to use to execute the command. If not defined defaults +to `/bin/sh` on Unix, defaults to `env.comspec` or `cmd.exe` on Windows. + +#### silent + +* Type: Boolean +* Default: false + +You can use the `--silent` flag to prevent showing `npm ERR!` output on error. + ### See Also * [npm scripts](/using-npm/scripts) |