Easily setup prebuilding of native modules using CI and prebuildify
npm install -g prebuildify-ci
First create a native module and add a
prebuild script to your npm scripts
that prebuilds the module using prebuildify.
An example of this can be found in the turbo-net package
Then setup a travis and appveyor file using prebuildify-ci
The above script will prompt for an encrypted travis and appveyor github token.
You can use the
travis command line tool to encrypt one for travis using the
travis encrypt command,
and for appveyor you can use the following web interface, https://ci.appveyor.com/tools/encrypt
The Github token needs access to upload to the Github releases of the project.
The ci config will prebuild on every time a new tag is pushed.
# tag your release npm version minor
git push it (you might need a
git push --tags depending on your config) without npm publishing it.
Wait for CI to finish. Once all the builds are done run
This will download all the prebuilds into ./prebuilds where node-gyp-build will expect them to be stored.
That's it! Now you are ready to publish your tarball with the prebuilds included.