*Need to manage native modules

*Override __dirname
*Override @achingbrain/ssdp, default-gateway, and ipfs-utils with forks to ensure no issues
This commit is contained in:
Derrick Hammer 2022-08-30 02:53:25 -04:00
parent 175972b69d
commit 9d2979067a
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 16 additions and 3 deletions

View File

@ -5,5 +5,8 @@ esbuild.buildSync({
outfile: 'dist/ipfs.js', outfile: 'dist/ipfs.js',
format: 'cjs', format: 'cjs',
bundle: true, bundle: true,
platform: "node" platform: "node",
define: {
__dirname: '"./plugins/leveldown"'
}
}) })

6
build.sh Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
node build.js
mkdir dist/dist -p
rsync -avzP node_modules/leveldown/prebuilds dist/leveldown
cp node_modules/rabin-wasm/dist/rabin.wasm dist/dist/rabin.wasm

View File

@ -3,15 +3,19 @@
"type": "module", "type": "module",
"version": "0.1.0", "version": "0.1.0",
"scripts": { "scripts": {
"build": "node build.js" "build": "rimraf node_modules/*/node_modules/ipfs-utils node_modules/@achingbrain/nat-port-mapper/node_modules/default-gateway && bash build.sh"
}, },
"devDependencies": { "devDependencies": {
"@lumeweb/relay-types": "https://github.com/LumeWeb/relay-types.git", "@lumeweb/relay-types": "https://github.com/LumeWeb/relay-types.git",
"esbuild": "^0.15.5" "esbuild": "^0.15.5",
"rimraf": "^3.0.2"
}, },
"dependencies": { "dependencies": {
"@achingbrain/ssdp": "https://github.com/LumeWeb/ssdp.git",
"default-gateway": "https://github.com/LumeWeb/default-gateway.git",
"ipfs-core": "^0.15.4", "ipfs-core": "^0.15.4",
"ipfs-http-response": "^3.0.4", "ipfs-http-response": "^3.0.4",
"ipfs-utils": "https://github.com/LumeWeb/js-ipfs-utils.git",
"multiformats": "^9.7.1" "multiformats": "^9.7.1"
} }
} }