node-bindgen icon indicating copy to clipboard operation
node-bindgen copied to clipboard

Support for publishing NPM modules with binary targets

Open sehz opened this issue 5 years ago • 3 comments

node-bindgen is primary used for building native-modules using Rust. However, it assumes that consume of the modules has rust/cargo toolschain installed and expected to use to build modules. We need to enable for non rust users to consume the modules.

In order to do so we should do following

  • [ ] Enhance Nj-cli to publish NPM modules with binaries bundles in. It should have list of rust target that should be included in the published module. For example: [x86_64-apple-darwin, x86_64-unknown-linux-gnu].
  • [ ] When modules are installed, it should only keep binaries that are specific to host

sehz avatar Jan 12 '21 17:01 sehz

Regarding your 2nd point, there are at least two ways of doing it:

  1. Bundle the binaries for all platforms in the npm package itself, then post-install just link the relevant one and ignore/discard the rest.
  2. Keep the binaries packaged as github releases, not on the npm package. The npm package will download the relevant binary post install. We get a smaller npm package in exchange for an extra download during package installation.

Thoughts?

diegopy avatar Mar 04 '21 17:03 diegopy

Thanks for suggestion. Building binaries for different platform seems to be one of the pain points. This need to be higher priority

sehz avatar Aug 14 '21 13:08 sehz

I agree. First is to support loading binaries from anywhere including GitHub release.

sehz avatar Aug 14 '21 15:08 sehz