-
Notifications
You must be signed in to change notification settings - Fork 26
Usage in npm module #33
Comments
Glad you're using and benefitting from api-check! So api-check doesn't have any mechanism for disabling itself during production (maybe it should?) so you have to do so manually. In my app, when I build for production, what I do is: var apiCheckFactory = require('api-check');
apiCheckFactory.globalConfig.disabled = process.env.NODE_ENV === 'production'; // <-- do this before anything else to get maximum perf benefits
var myInstanceOfApiCheck = apiCheckFactory(); So when you build your app, just set the |
Hmm thanks for your reply. I wonder what the best way would be to allow the user of the npm module to control this functionality. Maybe they'd want it to be disabled via the node_env variable, but maybe not... It seems like there must be a better way than hardcoding it into the module. Do you know of any other approaches that would allow the user to specify when/how it should be disabled? Thanks again for all your work! |
So, you mean you're developing a library that uses api-check and you want Most of the time, they'd want to disable api-check globally. So you can Let me know if I'm understanding you incorrectly. On Fri, Sep 11, 2015, 12:03 PM Thomas Rich notifications@github.com wrote:
|
Hey there,
I had a question about how best to use api-check when using it in an npm module I'm developing. Currently I'm developing the module as a local module within a larger project, so it is just using the same api-check setup file as is used in the larger application. However, I'd like to soon split this local module out of my project to have it be its own stand-alone npm module.
I would still like to have api-check running for my stand-alone npm module, which I think means I'll need to duplicate the api-check setup file, and instead require it explicitly within the module this time.
I'm wondering if there will be a way to disable api-check for my now npm-required module when building my app in production. I guess the question boils down to: does api-check get disabled if its included in node_modules when building an app in production?
Hope this question makes sense. Thanks a bunch for the excellent package!
Thomas
The text was updated successfully, but these errors were encountered: