helia-examples
helia-examples copied to clipboard
feat: test on bun runtime
In this PR:
- adding support to run bun as a supported runtime.
Currently failing:
Added file contents: Hello World 101
1 | // createRequire is native in node version >= 12
2 | import { createRequire } from 'module';
3 | const require = createRequire(import.meta.url);
4 |
5 | const nodeDataChannel = require('../build/Release/node_datachannel.node');
^
TypeError: /home/runner/work/helia-examples/helia-examples/node_modules/node-datachannel/build/Release/node_datachannel.node: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
at /home/runner/work/helia-examples/helia-examples/node_modules/node-datachannel/lib/node-datachannel.js:5:25
This looks promising, but everything is broken?
Also - we don't need to run every single example on bun as this will expose us to having to make sure every framework etc in every example also runs on bun.
Just make it run the helia-101 example on bun as well as node, that should be enough.
Depends on:
- [x] https://github.com/ipfs-examples/test-ipfs-example/pull/18
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| verified-fetch | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 24, 2024 7:15pm |
I think we need to pull in [email protected] here for things to work?
seems like bun is not trusting some deps' postinstall scripts.
so node-datachannel is not being found: https://github.com/ipfs-examples/helia-examples/actions/runs/8821723588/job/24218234527?pr=101#step:6:13
Running locally shows:
╰─ ✔ ❯ bun pm untrusted
bun pm untrusted v1.1.4 (fbe2fe0c)
./node_modules/@nestjs/core @10.3.0
» [postinstall]: opencollective || exit 0
./node_modules/protobufjs @7.2.6
» [postinstall]: node scripts/postinstall
./node_modules/node-datachannel @0.5.3
» [install]: prebuild-install -r napi || (npm install --ignore-scripts --production=false && npm run _prebuild)
These dependencies had their lifecycle scripts blocked during install.
If you trust them and wish to run their scripts, use `bun pm trust`.
helia-101 on bun passes now: https://github.com/ipfs-examples/helia-examples/actions/runs/8822048749/job/24219321434?pr=101
removal of CustomEvent polyfill from libp2p broke bun build: https://github.com/ipfs-examples/helia-examples/actions/runs/11505470232/job/32027234171?pr=101#step:6:30
removal of CustomEvent polyfill from libp2p broke bun build: ipfs-examples/helia-examples/actions/runs/11505470232/job/32027234171?pr=101#step:6:30
With bun v1.1.33, the tests pass for me fine, but they seem to fail in CI.. maybe macOS vs linux?
bun tests passed when I explicitly installed node>20.. https://github.com/ipfs-examples/helia-examples/actions/runs/11505990080/job/32028925951?pr=101
is bun calling node or are we calling it somehow? testing if we can alias node to bun in github CI: 26415bd (#101)
FYI: bun is not running successfully due to some crypto errors