Skip to content

Commit 60958df

Browse files
authored
Add npm run-script to README (#1872)
1 parent 63abdac commit 60958df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Readme.md

+12
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
4848
- [createCommand()](#createcommand)
4949
- [Node options such as `--harmony`](#node-options-such-as---harmony)
5050
- [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands)
51+
- [npm run-script](#npm-run-script)
5152
- [Display error](#display-error)
5253
- [Override exit and output handling](#override-exit-and-output-handling)
5354
- [Additional documentation](#additional-documentation)
@@ -1061,6 +1062,17 @@ the inspector port is incremented by 1 for the spawned subcommand.
10611062

10621063
If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your launch.json configuration.
10631064

1065+
### npm run-script
1066+
1067+
By default when you call your program using run-script, `npm` will parse any options on the command-line and they will not reach your program. Use
1068+
`--` to stop the npm option parsing and pass through all the arguments.
1069+
1070+
The synopsis for [npm run-script](https://docs.npmjs.com/cli/v9/commands/npm-run-script) explicitly shows the `--` for this reason:
1071+
1072+
```console
1073+
npm run-script <command> [-- <args>]
1074+
```
1075+
10641076
### Display error
10651077

10661078
This routine is available to invoke the Commander error handling for your own error conditions. (See also the next section about exit handling.)

0 commit comments

Comments
 (0)