TooTallNate/node-bindings

Option to vendor binding files in top-level app?..

busticated opened this issue ยท 0 comments

hey there ๐Ÿ‘‹

thanks for the super-helpful lib ๐Ÿ™

i'm looking for a way to "vendor" the binding files for my app such that dependencies (e.g. @serialport/bindings) use the vendor'ed bindings files provided by the root app instead of their module-local default. i don't see a way to do this - am i just missing it?

very roughly, you could:

  1. determine the app_root (perhaps via app-root-path)
  2. determine module_name (the package.json name field for the module - e.g. @serialport/bindings)
  3. add a lookup entry to the list here which is resolved first and attempts to load from a path like:
['app_root', 'vendor', 'module_name',  `abi-v${process.versions.modules}`, 'platform', 'arch', 'bindings']

...does that make sense and fit with your goals for this lib? happy to create a PR if so!

related: serialport/node-serialport#2044