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

[Feature] run local dependency binary only #565

Closed
2 tasks
segrey opened this issue Nov 5, 2019 · 4 comments
Closed
2 tasks

[Feature] run local dependency binary only #565

segrey opened this issue Nov 5, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@segrey
Copy link
Contributor

segrey commented Nov 5, 2019

  • I'd be willing to implement this feature
  • This feature can already be implemented through a plugin

Describe the user story

It'd be great to be able to run a local dependency binary without additional options coming from scripts.
For example, "eslint": "eslint sources scripts" (from pnp-sample-app/package.json#L51) prevents running yarn run eslint --print-config .eslintrc.js

$ yarn run eslint --print-config .eslintrc.js
The --print-config option must be used with exactly one file name.

Removing the eslint script from the package.json fixes the error.

Describe the solution you'd like

Maybe a new flag for run command, for example yarn run --local-dependency-binary-only eslint --print-config .eslintrc.js?
Or, maybe a new command, for example yarn runLocalDependencyBinary eslint --print-config .eslintrc.js?
Any solution would work for me.

Describe the drawbacks of your solution

Seems introducing a new flag or a new command shouldn't break any of existent use cases.

Describe alternatives you've considered

Don't see any alternatives currently. I could be wrong here.

Additional context

Based on previous discussion: #499 (comment)

In general, redefining commands is usually needed to specify some custom options. Then, if IDE passes the same options, it's unclear what will happen (the first wins, the latter wins or an error is thrown). I will let you know once I have a particular case.

Found the case with ESLint => created this issue.

@arcanis
Copy link
Member

arcanis commented Nov 8, 2019

Fixed in #570 🎉

@arcanis arcanis closed this as completed Nov 8, 2019
@segrey
Copy link
Contributor Author

segrey commented Jan 22, 2020

Seems it doesn't work with scoped packages.

{
  "dependencies": {
    "@vue/cli-service": "^4.1.2",
    "karma": "^4.4.1"
  }
}

This command works as expected: yarn run --binaries-only karma --help
But this doesn't: yarn run --binaries-only @vue/cli-service --help

@arcanis Should I file a new issue?

@arcanis
Copy link
Member

arcanis commented Jan 22, 2020

@segrey it's not a bug, the bin that @vue/cli-service exposes is called vue-cli-service, so the right command would be:

yarn run --binaries-only vue-cli-service --help

I guess the next question is "how to know what's the name of the binary for a given package", to which the answer is "it's theoretically hard to do it perfectly because there might be multiple binaries for one package" 😛

That being said, I'll improve yarn bin in the next release to support a --json flag which will provide this information (which package provides which binary). I guess it'll be good enough in most cases (where 1 package = 1 binary).

@segrey
Copy link
Contributor Author

segrey commented Jan 23, 2020

Ah, you're right! Sorry for the noise. IDE has capability to list all binaries provided by a package by reading its package.json, but --json won't hurt.

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

No branches or pull requests

2 participants