You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
See also: #882
Describe the user story
As a developer, I want to write a bash script to be executed by
npx
oryarn dlx
. I create an appropriatepackage.json
withbin
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 tonode
.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
oryarn dlx
is simplicity. Requiring a plugin is counter to this.The text was updated successfully, but these errors were encountered: