-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PoC] Evaluate prebuildify for bundling prebuilts #46
Conversation
This looks interesting. The total archive size has me worried though. I wonder if we can get around that by automatically removing unused binaries on the target system? How does the resolution for various platforms work? The current identification with |
To be honest don't think it's that big of a problem, but that definitely depends on the use case. If one makes the call of only offering one NAPI-version (v1 for supporting 8.6.x and 10+, or v3 for only supporting 10+) we'd need to bundle 7 binaries. Estimating from the binary size on macos this would mean
Currently only platform + arch is supported, but I think it would be easy to add a c library option too. I don't know how well |
You're probably right, the size should not be a big issue. So the next steps would be to try out if publishing can be integrated and create a PR to support a libc check in addition to platform + architecture? |
TODO: This should only be the case when using prebuilts not otherwise
I made PRs to |
How's this looking now? |
@rolftimmermans Awesome job building this binding. Really appreciate your work!
The aim of this PR is to see if using
prebuildify
instead ofnode-pre-gyp
would benefit the binding and further improve the installation experience.The main difference between the two is that
prebuildify
bundles all builds inside thenode_modules
folder during publishing. This has a few benefits:npm
installnode-pre-gyp
as a production dependency (1.8 MB in thenode_modules
folder)npm
install scripts are disabled for security reasonsnode_modules
folderThe only disadvantage is the tarball gets a bit bigger since it contains all the available prebuilts. This cost is greatly offset by the removal of
node-pre-gyp
as a direct dependency though. In fact installation speeds are generally faster than downloading the prebuilt from github.Additionally
prebuildify-ci
allows to build all binaries on CI and then download them for npm publishing. Here is a small blog post that explains the workflow: https://www.nearform.com/blog/the-future-of-native-modules-in-node-js/As a bonus, both modules are very lightweight which means that special features or customizations are easy to add.
Please try out this approach and let me know what you think.