intel / iotivity-node

Node.js bindings for IoTivity
https://www.iotivity.org/
42 stars 44 forks source link

Automated npm upload? #117

Open hansmbakker opened 7 years ago

hansmbakker commented 7 years ago

It would be great if there would be an automatic upload to the npm repository after the Travis builds finish, since that way people don't need to set up Scons etc before they can try out iotivity-node.

gabrielschulhof commented 7 years ago

The problem is that the binaries are very specific to each system. I'd have to provide binaries for Windows, OSX, and Linux, and I'm not 100% sure they'd all be binary-compatible etc. I suspect the npm package would be rather large if it contained all possible binaries. Additionally, I don't think I can get the Windows binaries and the OSX binaries into the same package, because they're created on different jobs and on different CI systems.

I'd have to set up some server that receives these binaries, performs the packaging and uploads a single npm package containing the binaries for all platforms. Then the postinstall script could remove binaries irrelevant to the local platform.

This sounds like a sizeable task with need for infrastructure support.

hansmbakker commented 7 years ago

I understand what you're saying, I don't have experience with it either. However here is an old but interesting article to read: https://cylonjs.com/blog/2014/11/19/creating-multiplatform-precompiled-binaries-for-node-modules/

gabrielschulhof commented 7 years ago

There's another problem with pre-build binaries: we need to have a secure way of distributing them, and adding them to the npm package is not really an option because we'd have to add every possible arch for every possible platform (linux, windows, and OSX) into the package, which might make the package rather large, and containing lots of useless binaries.

OTOH, having npm download the binaries upon installation carries with it the responsibility of securely storing the binaries online. We must avoid them becoming compromised. This can get complicated.