deno FFI, how to automatically build the shared-custom-lib while using the deno-library?
hey there, i am currently fiddling around with FFI and a custom c/rust lib.. works fine, awesome!
BUT.. in the real world, once you build and put together your cool c/rust- and deno-lib.. you wanto to open-source it.. so others might use it too.
in the NPM world, once you do "npm install my-custom-thingy" .. you could set it up that it build the c-lib then on the target platform and if it does not work, the install fails.
how to achieve the same with deno? without writing a 100 pages long readme how to build the custom lib xD
thanks 🙂
7 Replies
npm lifecycle scripts doesn't run by default unless --allow-scripts
but it's not an npm package. it's a deno package 🙂
Do you mean JSR packages?
There won't be lifecycle scripts for JSR tho
One solution is to use pre-built binary
Also you can write a script to build these and ask the user to run it for binaries
and the script shipped with is the somehow accessible via the deno cli?
Like export a
build-binary
and ask the user to run deno run -A jsr:@scope/your-pkg/build-binary
1. user imports the lib
2. it gets automatically fetched by deno or the ide?
3. what Todo?
ah yeah, that sounds promising 🙂
The most popular way is to distribute your lib (like in github ci) and use it with plug https://jsr.io/@denosaurs/plug/dependents