Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorHafizur046 <hafijurrahman046@gmail.com>2022-09-21 23:09:24 +0300
committerGitHub <noreply@github.com>2022-09-21 23:09:24 +0300
commit19762b4ac4b10741ff53ddd315be1fd23d9b1e28 (patch)
treeb38288abc44a7fabb4ae307a0c35102f45332064 /docs
parent8402fd8780c5e0461850da882dca024f7df1a681 (diff)
docs: modify misleading doc about package.json:bin (#5529)
docs: modify Misleading doc about bins closes #3788
Diffstat (limited to 'docs')
-rw-r--r--docs/content/configuring-npm/package-json.md20
1 files changed, 12 insertions, 8 deletions
diff --git a/docs/content/configuring-npm/package-json.md b/docs/content/configuring-npm/package-json.md
index 5b4acf187..39d672124 100644
--- a/docs/content/configuring-npm/package-json.md
+++ b/docs/content/configuring-npm/package-json.md
@@ -339,12 +339,14 @@ install into the PATH. npm makes this pretty easy (in fact, it uses this
feature to install the "npm" executable.)
To use this, supply a `bin` field in your package.json which is a map of
-command name to local file name. When this package is installed
-globally, that file will be linked where global bins go so it is
-available to run by name. When this package is installed as a
-dependency in another package, the file will be linked where it will be
-available to that package either directly by `npm exec` or by name in other
-scripts when invoking them via `npm run-script`.
+command name to local file name. When this package is installed globally,
+that file will be either linked inside the global bins directory or
+a cmd (Windows Command File) will be created which executes the specified
+file in the `bin` field, so it is available to run by `name` or `name.cmd` (on
+Windows PowerShell). When this package is installed as a dependency in another
+package, the file will be linked where it will be available to that package
+either directly by `npm exec` or by name in other scripts when invoking them
+via `npm run-script`.
For example, myapp could have this:
@@ -357,8 +359,10 @@ For example, myapp could have this:
}
```
-So, when you install myapp, it'll create a symlink from the `cli.js` script
-to `/usr/local/bin/myapp`.
+So, when you install myapp, in case of unix-like OS it'll create a symlink
+from the `cli.js` script to `/usr/local/bin/myapp` and in case of windows it
+will create a cmd file usually at `C:\Users\{Username}\AppData\Roaming\npm\myapp.cmd`
+which runs the `cli.js` script.
If you have a single executable, and its name should be the name of the
package, then you can just supply it as a string. For example: