This PR implements the local script handling described in #49. I think this essentially covers the most-expected alternatives in each situation. It's DWIMy for sure, but relatively safe. In the end, any of this behavior can be bypassed by using more explicit commands (that is, npx node ./foo or npx bash ./foo instead of npx ./foo).
The main thing this is trying to address is a regular issue I'd run into where I'd do something like $ npx ./some-dir/foo with the intention of having foo see all the $PATH stuff npx does. But instead, it would try to install./some-dir/foo as a local dep, symlinking and everything. To make matters more confusing, this would work just as expected if you happened to pass in a -p <pkg> argument, because that would prevent the usual argument parsing from happening. While local directory deps are technically installable packages, I think literally no one ever actually wants $ npx ./foo to install anything -- and if they do want to install a local dep like that, they can just do $ npx -p ./foo foo.
This PR implements the local script handling described in #49. I think this essentially covers the most-expected alternatives in each situation. It's DWIMy for sure, but relatively safe. In the end, any of this behavior can be bypassed by using more explicit commands (that is,
npx node ./foo
ornpx bash ./foo
instead ofnpx ./foo
).The main thing this is trying to address is a regular issue I'd run into where I'd do something like
$ npx ./some-dir/foo
with the intention of havingfoo
see all the$PATH
stuff npx does. But instead, it would try to install./some-dir/foo
as a local dep, symlinking and everything. To make matters more confusing, this would work just as expected if you happened to pass in a-p <pkg>
argument, because that would prevent the usual argument parsing from happening. While local directory deps are technically installable packages, I think literally no one ever actually wants$ npx ./foo
to install anything -- and if they do want to install a local dep like that, they can just do$ npx -p ./foo foo
.