Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

feat: add kubo-rpc-client #499

Merged
merged 12 commits into from
Oct 6, 2022
12 changes: 9 additions & 3 deletions .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { resolve } from 'import-meta-resolve'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const ipfsModule = await resolve(process.env.IPFS_JS_HTTP_MODULE || 'ipfs', import.meta.url)
const ipfsHttpModule = await resolve(process.env.IPFS_JS_HTTP_MODULE || 'ipfs-http-client', import.meta.url)
const kuboRpcModule = await resolve(process.env.KUBO_RPC_MODULE || 'kubo-rpc-client', import.meta.url)

async function findGoIpfsBin () {
if (process.env.IPFS_GO_EXEC != null) {
Expand All @@ -32,6 +33,9 @@ const esbuild = {
build.onResolve({ filter: /^ipfs-http-client$/ }, () => {
return { path: ipfsHttpModule.replace('file://', '') }
})
build.onResolve({ filter: /^kubo-rpc-client$/ }, () => {
return { path: kuboRpcModule.replace('file://', '') }
})
}
}
]
Expand All @@ -47,6 +51,7 @@ export default {
},
async before (options) {
const ipfsHttpModule = await import(process.env.IPFS_JS_HTTP_MODULE || 'ipfs-http-client')
const kuboRpcModule = await import(process.env.KUBO_RPC_MODULE || 'kubo-rpc-client')
const ipfsModule = await import(process.env.IPFS_JS_MODULE || 'ipfs')

if (options.runner !== 'node') {
Expand All @@ -56,10 +61,10 @@ export default {
}, {
type: 'go',
test: true,
ipfsHttpModule
}, {
go: {
ipfsBin: await findGoIpfsBin()
ipfsBin: await findGoIpfsBin(),
kuboRpcModule: kuboRpcModule
},
js: {
ipfsOptions: {
Expand All @@ -72,7 +77,8 @@ export default {
}
},
ipfsModule,
ipfsBin: process.env.IPFS_JS_EXEC || ipfsModule.path()
ipfsBin: process.env.IPFS_JS_EXEC || ipfsModule.path(),
ipfsHttpModule,
}
}).start()

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $ node bin/ipfs-interop.js -- -t node --grep {substring-test-name}

### As a project

This module declares peer dependencies of `ipfs`, `ipfs-http-client` and `go-ipfs` so if you have `ipfs-interop` as a dependecy of your project, simply add the extra IPFS dependencies:
This module declares peer dependencies of `ipfs`, `ipfs-http-client`, `kubo-rpc-client` and `go-ipfs` so if you have `ipfs-interop` as a dependecy of your project, simply add the extra IPFS dependencies:

```json
{
Expand All @@ -61,7 +61,8 @@ This module declares peer dependencies of `ipfs`, `ipfs-http-client` and `go-ipf
"go-ipfs": "...",
"ipfs": "...",
"ipfs-http-client": "...",
"ipfs-interop": "..."
"ipfs-interop": "...",
"kubo-rpc-client": "..."
}
}
```
Expand All @@ -80,6 +81,7 @@ Specify the following environmental variables to control which versions of IPFS
- `IPFS_JS_EXEC` A path to `/src/cli.js` inside a js-IPFS install
- `IPFS_JS_MODULE` A path to a js-IPFS install
- `IPFS_JS_HTTP_MODULE` A path to a ipfs-http-client install (optional)
- `KUBO_RPC_MODULE` A path to a kubo-rpc-client install (optional)

Then run:

Expand All @@ -104,6 +106,7 @@ in `./scripts/custom-runtime.sh`, one can:
export IPFS_JS_EXEC=/tmp/js-ipfs/packages/ipfs/src/cli.js
export IPFS_JS_MODULE=/tmp/js-ipfs/packages/ipfs/src/index.js
export IPFS_JS_HTTP_MODULE=/tmp/js-ipfs/packages/ipfs-http-client/src/index.js
export KUBO_RPC_MODULE=/tmp/kubo-rpc-client/src/index.js
./scripts/custom-runtime.sh
node bin/ipfs-interop.js -- -t node --grep "pubsub"

Expand Down
Loading