Skip to content

Commit 9351cbf

Browse files
ruyadornonlf
authored andcommitted
docs: refresh npm run-script docs
- Added configuration section - Documented a few more relevant config options PR-URL: #2566 Credit: @ruyadorno Close: #2566 Reviewed-by: @nlf
1 parent abae00c commit 9351cbf

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

docs/content/commands/npm-run-script.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ npm run test -- --grep="pattern"
3232
```
3333

3434
The arguments will only be passed to the script specified after ```npm run```
35-
and not to any pre or post script.
35+
and not to any `pre` or `post` script.
3636

3737
The `env` script is a special built-in command that can be used to list
3838
environment variables that will be available to the script at runtime. If an
@@ -56,7 +56,8 @@ instead of
5656
```
5757

5858
The actual shell your script is run within is platform dependent. By default,
59-
on Unix-like systems it is the `/bin/sh` command, on Windows it is the `cmd.exe`.
59+
on Unix-like systems it is the `/bin/sh` command, on Windows it is
60+
`cmd.exe`.
6061
The actual shell referred to by `/bin/sh` also depends on the system.
6162
You can customize the shell with the `script-shell` configuration.
6263

@@ -73,15 +74,43 @@ If `--scripts-prepend-node-path=auto` is passed (which has been the default
7374
in `npm` v3), this is only performed when that `node` executable is not
7475
found in the `PATH`.
7576

76-
If you try to run a script without having a `node_modules` directory and it fails,
77-
you will be given a warning to run `npm install`, just in case you've forgotten.
77+
If you try to run a script without having a `node_modules` directory and it
78+
fails, you will be given a warning to run `npm install`, just in case you've
79+
forgotten.
7880

79-
You can use the `--silent` flag to prevent showing `npm ERR!` output on error.
81+
### Configuration
82+
83+
#### if-present
84+
85+
* Type: Boolean
86+
* Default: false
8087

8188
You can use the `--if-present` flag to avoid exiting with a non-zero exit code
8289
when the script is undefined. This lets you run potentially undefined scripts
8390
without breaking the execution chain.
8491

92+
#### ignore-scripts
93+
94+
* Type: Boolean
95+
* Default: false
96+
97+
Skips running `pre` and `post` scripts.
98+
99+
#### script-shell
100+
101+
* Type: String
102+
* Default: `null`
103+
104+
Optional custom script to use to execute the command. If not defined defaults
105+
to `/bin/sh` on Unix, defaults to `env.comspec` or `cmd.exe` on Windows.
106+
107+
#### silent
108+
109+
* Type: Boolean
110+
* Default: false
111+
112+
You can use the `--silent` flag to prevent showing `npm ERR!` output on error.
113+
85114
### See Also
86115

87116
* [npm scripts](/using-npm/scripts)

0 commit comments

Comments
 (0)