Stand-alone binary
joepie91 opened this issue · 6 comments
It would be useful to be able to npm install -g pretty-error
, and get a pe-node
binary or something like that, that enables pretty errors for whatever script you are trying to run - supporting something like --ignore-node
and --ignore-module
arguments for basic configuration. That way you don't have to hardcode it into your application or library, but you can still get pretty errors during development.
Is anything like this planned?
EDIT: For clarification, an invocation would look something like pe-node --ignore-node --ignore-module bluebird app.js
Apologies for the delay.
This is a great idea. My only concern is, how can it be used with other node-invoking binaries, like coffee
? Because I rarely ever use node
directly. Usually I call it from coffee
or nodemon
or something like that. And I suspect I'll be able to use pe-node
that often if it doesn't work with other binaries.
One idea would be to use io.js' new -r
flag. It would look something like this:
$ node script.js -r pretty-error/start
But that's only for io.js.
Thoughts?
I presume that it could work with /usr/bin/coffee
, like is the case for other tools, because the coffee
binary is really just a Javascript file. Your command would then look like:
pe-node --ignore-node --ignore-module bluebird /usr/bin/coffee app.coffee
This is basically how you use eg. nodemon
with Coffeescript. I don't know whether this also works on Windows, though.
@joepie91: This sounds like something we could do. How useful do you think this feature would be for you?
@alexgorbatchev: Hey Alex! Long time no see :) what do you think of this?
It would be quite useful :)
Especially when working with third-party code, it's not as easy to drop pretty-error
into the codebase, but it'd still be nice to have pretty errors - a stand-alone binary would really help with that.
Plus the aforementioned benefit of not having to put what is effectively debugging code into your codebase permanently - for example, when running in production, you might be logging errors to a logfile instead, and then ANSI escape codes are not very practical.
Okay then :) I'll keep this issue open for now and get back to it the next chance I get.
You can now preload pretty-error into your code using node's --require argument:
$ node --require pretty-error/start your-module.js