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] execute non-JS executables via yarn dlx #4587

Closed
1 of 2 tasks
cspotcode opened this issue Jun 29, 2022 · 2 comments
Closed
1 of 2 tasks

[Feature] execute non-JS executables via yarn dlx #4587

cspotcode opened this issue Jun 29, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@cspotcode
Copy link

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

See also: #882

Describe the user story

As a developer, I want to write a bash script to be executed by npx or yarn dlx. I create an appropriate package.json with bin field and push it and the shell script to github. The shell script has an appropriate #!/usr/bin/env bash. This script is internal tooling meant for my team or my company, so it is safe to assume bash and a posix environment.

Unfortunately, yarn today attempts to execute bin scripts via node even when they are not js.

Describe the solution you'd like

When yarn dlx executes a bin entry which is not js, it is executed as a posix executable, not passed to node.

Describe the drawbacks of your solution

As far as I can tell, this will be backwards compatible. node scripts will continue to execute via node. But bin entries with non-node shebangs can be executed directly. Native executables can also be executed directly, I don't think this will cause particular problems. In evanw/esbuild#237 (comment), it appears that esbuild is deliberately using a native executable and has done the work to do this correctly, with cross-platform supporrt.

Describe alternatives you've considered

The motivation for using npx or yarn dlx is simplicity. Requiring a plugin is counter to this.

@cspotcode cspotcode added the enhancement New feature or request label Jun 29, 2022
@merceyz
Copy link
Member

merceyz commented Jun 29, 2022

Duplicate of #882

@merceyz merceyz marked this as a duplicate of #882 Jun 29, 2022
@merceyz merceyz closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2022
@merceyz
Copy link
Member

merceyz commented Jun 29, 2022

Both yarn dlx and yarn run should support running the same things so tracking this in #882 is sufficient.

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