From 05a52a7b5986c7bfab93100f7698cd99bab76ec7 Mon Sep 17 00:00:00 2001 From: Dr Date: Fri, 16 Oct 2020 11:08:37 +0800 Subject: [PATCH] docs: match npm-exec.md -p usage with lib/exec.js updated usage from: https://github.com/npm/cli/blob/v7.0.1/lib/exec.js#L8-L20, and removed extra `-p` occurrences to avoid confusion. --- docs/content/cli-commands/npm-exec.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/content/cli-commands/npm-exec.md b/docs/content/cli-commands/npm-exec.md index 29b7a06e51863..7dde9c86086a9 100644 --- a/docs/content/cli-commands/npm-exec.md +++ b/docs/content/cli-commands/npm-exec.md @@ -12,9 +12,9 @@ description: Run a command from a local or remote npm package ```bash npm exec -- [@] [args...] -npm exec -p [@] -- [args...] +npm exec --package=[@] -- [args...] npm exec -c ' [args...]' -npm exec -p foo -c ' [args...]' +npm exec --package=foo -c ' [args...]' npx [@] [args...] npx -p [@] [args...] @@ -23,7 +23,8 @@ npx -p [@] -c ' [args...]' alias: npm x, npx --p --package= (may be specified multiple times) +--package= (may be specified multiple times) +-p is a shorthand for --package only when using npx executable -c --call= (may not be mixed with positional arguments) ``` @@ -33,9 +34,9 @@ This command allows you to run an arbitrary command from an npm package (either one installed locally, or fetched remotely), in a similar context as running it via `npm run`. -Whatever packages are specified by the `--package` or `-p` option will be +Whatever packages are specified by the `--package` option will be provided in the `PATH` of the executed command, along with any locally -installed package executables. The `--package` or `-p` option may be +installed package executables. The `--package` option may be specified multiple times, to execute the supplied command in an environment where all specified packages are available. @@ -51,7 +52,7 @@ only be considered a match if they have the exact same name and version as the local dependency. If no `-c` or `--call` option is provided, then the positional arguments -are used to generate the command string. If no `-p` or `--package` options +are used to generate the command string. If no `--package` options are provided, then npm will attempt to determine the executable name from the package specifier provided as the first positional argument according to the following heuristic: