I wrote a cross-platform nodejs native module in C using cmake , musl , as well as a few abstractions and carefully placed # ifdefs .
It is integrated into the module, using the cmake-js , and I have 3 build server: Windows
, Mac
and Linux
making buliding, so I have 3 of their own modules that work well on all platforms.
We have an internal NPM repository that I could publish so that other teams within the company could just npm install module
get my module.
The fact is that it is dirty, that the client will need to select the module on the platform on which they are located (i.e. I would deploy all 3 modules from each of the build servers), so I would prefer to deploy one module somehow combined 3 platform-specific modules.
Is this possible and how can I structure the internals of such a module? *
Are there bindings , for example, to determine the platform and find the corresponding file .node
?
& ast; I don’t want to include the code and compile it, because it puts a rather heavy load on the client (they would expect that they could write a simple script using Javascript, for example, and use my module - it would be a shock that they need to configure C assembly chains, worry about the platform on which their script is running, etc. etc. etc.).