Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fabiospampinato opened this issue Feb 7, 2023 · 1 comment

Comments

@fabiospampinato
Copy link

fabiospampinato commented Feb 7, 2023

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

@ljharb
Copy link
Contributor

ljharb commented Feb 7, 2023

While I'd love this, I'm not sure how it would work, since npm run primarily works by setting up the PATH to include node_modules/.bin. I suppose npm install (only the toplevel one) could add its own bins to node_modules/.bin, and that would Just Work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants