npm / npm/rfcs

[RRFC] Ensure that binaries defined by the current package are recognized as available binaries inside itself by npm run

Open
#673 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
778
Forks
266
PR merge metrics
No merged PRs in 30d

Description

Motivation ("The Why")

The motivations behind this is that it seems natural to me, even if a bit niche, and scripts defined like this are the cleanest possibly way to write them that I can think of:

{
  "name": "pkg",
  "bin": "./src/index.js",
  "scripts": {
     "something": "pkg something"
  }
}

Notice how the something script inside pkg references the pkg bin, i.e. itself.

Example

See above.

How
Current Behaviour

Currently running an npm run something leads to an error saying that pkg has not been found.

Desired Behaviour

npm run should take into consideration the binaries defined by the current package, and consider them as available binaries too.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the motivation, example package manifest, and the linked original npm/cli issue #6141. Investigate how npm run exposes package binaries and determine the proposal needed so a package's own bin is available to its scripts; done means the behavior is specified clearly enough for implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.