digidem / comapeo-mobile

The next version of Mapeo mobile
GNU General Public License v3.0
5 stars 1 forks source link

Native Module Integration #68

Closed achou11 closed 1 year ago

achou11 commented 1 year ago

In order to actually use Mapeo Core we need to get native modules to work with NodeJS Mobile React Native. The general plan is to create and host prebuilds of the relevant native modules outside the project, and then have a build script in this repo that pulls the prebuild and places it in the directory required by the NodeJS Mobile build process.

Rough steps are:

Doing a quick check using npx native-modules on the mapeo core repo lists these:

better-sqlite3
crc-universal
fs-native-extensions
napi-build-utils # not needed
quickbit-native
simdle-native
sodium-native
udx-native
napi-macros/example # not needed
sodium-universal -> sodium-native # ideally de-duped 

The main ones are better-sqlite3 and (maybe) sodium-native (although using sodium-universal may allow us to tackle it later on). Hypercore ecosystem introduced quite a few more but hopefully they're not too tricky to get built (since they're rather small projects). There may be other ones coming for peer deps such as Fastify that aren't listed.

achou11 commented 1 year ago

Template repo: https://github.com/digidem/nodejs-mobile-prebuilds-template

sodium-native: https://github.com/digidem/sodium-native-nodejs-mobile

crc-native: https://github.com/digidem/crc-native-nodejs-mobile

fs-native-extensions: https://github.com/digidem/fs-native-extensions-nodejs-mobile

quickbit-native: https://github.com/digidem/quickbit-native-nodejs-mobile

simdle-native: https://github.com/digidem/simdle-native-nodejs-mobile

udx-native: https://github.com/digidem/udx-native-nodejs-mobile

better-sqlite3: https://github.com/digidem/better-sqlite3-nodejs-mobile