Closed paulirish closed 7 years ago
@paulirish https://github.com/tapjs/node-tap/issues/160#issuecomment-173047581 would mirroring this behavior be of enough use to you? It'd be nice to make sure there's a more general way of passing opts down to node. This would also only apply to actual execution operations, not when npx is internally doing npm operations.
so you're saying an API like this:
npx --node-arg=--inspect-brk eslint .
that's not as ideal but i guess it works. Though at that point i already have to freehand type such a long command, i'd rather just start with node --inspect-brk
and then go back to tab completing the node_modules path. :/
so if you prefer that direction then i'll probably release a mini npx-inspect
module that wraps around it for ease of use.
@paulirish I spent some more time thinking about this and I really like the idea of just having a wrapper that hides the verbosity. This is the sort of thing that stuff like that or aliases are good for.
Plus, it means you can do $ npx npx-inspect eslint .
😂
There's one caveat to all this: If I add this option, I'm going to have to make npx crash out if it can't detect that the target is a node script. in general, this should be fine, but npx's detection of shebangs isn't really perfect right now. I imagine you're ok with an 80% solution and then we can fine-tune if/when running into stuff where npx can't tell if it's node.
I've prototyped this over at #77.
This is available in npx@9.1.0
.
(Been using
npx
since 1.0.2. Love it.)I often want to run
node --inspect
andnode --inspect-brk
on apps that I also like to run vianpx
. For example: I want to breakpoint debug a mocha test, or do a performance profile ofeslint .
AFAIK, there isnt' a decent workaround, so I always go back to
node --inspect-brk ./node_modules/eslint/bin/eslint.js .
which is fine but obviously it'd be nice to avoid this.Could we add
--inspect-brk
and--inspect
as supportednpx
flags?