npm/npx

[BUG] Should execute a bin with matching name, when available, instead of first bin alphabetically

Opened this issue · 0 comments

Suppose you have this in your package.json:

{
  "name": "@namespaced/my-awesome-package",
  "bin": {
    "add-numbers": "./bin/add-numbers.js"
    "my-awesome-package": "./bin/my-awesome-package.js"
  }
}

Calling npx @namespaced/my-awesome-package will execute add-numbers, although my-awesome-package is probably expected way more often than not.

Calling npx my-awesome-package -p @namespaced/my-awesome-package is a kludge, but also slow, because -p results in the package installation even if it is available.