-
Notifications
You must be signed in to change notification settings - Fork 45
support node -r nodereport app.js
as well as programmatic use via API
#25
Comments
+1, with preference for 'paths being switched' because the API user is more likely to study the docs. @sam-github do you have any documentation references for the 'module/option' syntax? |
I would prefer it to be as easy to use on an existing script out of the box as possible. Maybe it's just me but I don't see the code hooks as being quite as valuable (and the feel a bit more invasive). IIRC this is the sort of reason FWIW tools like dprof have this similar behavior and I feel a previous precedent has already been set by similar modules that act upon requiring. |
So you two would prefer
for the opt-in case, and
for opt-out of hooks, with the understanding that this works to get hooks, and have the API:
Above is fine by me. |
I think I'm also in favour of
being opt-in and
for opt-out of hooks. Since this would be a change in behaviour, would this be semver-major? |
yep, semver-major
|
Given the consensus, I'm ok with node -r being opt in by default. |
PR #33 landed.
Not published in npm yet. Currently we are at 1.0.7, should this go up as 1.1.0 or 2.0.0? |
2.0.0 as it's a |
node-report v2.0.0 (including #33) has been released. |
@sam-github OK to close this now? |
ATM, nodereport works better via API, its clumsy if you want automatic hooking, see:
#23 (comment)
On the other hand, if you want to use nodereport to trigger a report manually, just using its public API, you don't want its (quite intrusive) hook mechanisms, which modify exit codes, behaviours, and even steal signals.
In summary, we need easy opt-in for default behaviour, but we also need easy opt-out, and I don't see any way to provide the two via a single require entry point that does not depend on env vars for configuration.
To make both use-cases easy, I suggest:
for the opt-in case, and
for the opt-out.
I'm OK with the require paths being switched, so
node -r nodereport
opts-in, andrequire("nodereport/api")
or something of the like just requires the nodereport API without hooks.Any other suggestions?
The text was updated successfully, but these errors were encountered: