cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Misleading documentation on package.json:bin

Open 0x2b3bfa0 opened this issue 3 years ago • 4 comments

What / Why

Documentation states the following:

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. (quote from the documentation)

Unfortunately, this is not true for Windows, where it doesn't use symbolic links, but rather a custom script generated by the cmd-shim package.

When

  • running npm install

Where

  • on the package.json:bin

How

Steps to Reproduce

main.js

const [, file, ...parameters] = process.argv;
console.log(require('path').basename(file));

package.json

{
  "bin": {
    "one": "main.js",
    "two": "main.js"
  }
  ···
}

Current Behavior

Running one will print main.js on Windows and one on every other platform.

Expected Behavior

Running one should print one on every platform.

0x2b3bfa0 avatar Sep 22 '21 23:09 0x2b3bfa0

@0x2b3bfa0 this particular documentation is actually tracked in the CLI repository and checked in to this repository via automation. I'm going to transfer this issue to the appropriate repository

MylesBorins avatar Sep 23 '21 19:09 MylesBorins

Is this still an issue? Can I pick this up?

Bruce-Hopkins avatar Dec 29 '21 08:12 Bruce-Hopkins

@darcyclarke Hey , I want to contribute to this issue , can you share me the preferable resources which can help me.

monikasharma1234 avatar May 30 '22 12:05 monikasharma1234

@darcyclarke I would like to work on this issue. Thank you

YashasviChaurasia avatar Aug 07 '22 17:08 YashasviChaurasia

I searched about this issue and I found a useful article to understand the context.

I am not asking to work on this issue because I am a macOS user.

axelsomerseth avatar Sep 01 '22 17:09 axelsomerseth