zkat / npx

execute npm package binaries (moved)
https://github.com/npm/npx
Other
2.63k stars 105 forks source link

Short-circuit self-calls #125

Closed benderTheCrime closed 6 years ago

benderTheCrime commented 7 years ago

First of all, let me just say that npx is objectively better than having to call "./node_modules/.bin/xxx." Thanks for the convenience that this has provided specific to my npm lifecycle scripts.

This would fall under the category of feature requests, although it's certainly not a necessity and likely is a useful side-effect to the behavior of npx.

From the command line, I can chain npx infinitely:

npx npx npx npx npx mocha

which definitely doesn't fall under the bug category, but I almost committed code that read:

npx npx mocha

as opposed to

npx nyc npx mocha

Which seems like a "me" problem, but I like tools that prevent foot guns.

It may be that this is desired behavior (full disclosure, I didn't pour over the documentation before raising this 😞), if not I'm happy to open a PR that checks to see if the provided command ($0) is "npx" and warning, exiting 0/1.

zkat commented 7 years ago

I'm not sure this particularly falls in the category of a footgun, and it turns out there is special consideration that has gone into making sure npx npx npx npx npx npx ... works, in the past. I think it's definitely a useful thing to support, since npx npx@version1 ... is a useful thing that even I've done before.

That's pretty funny though.

zkat commented 6 years ago

Since this is intentional, and I don't think a particularly terrible footgun, I'm just gonna close this. Cheers!