Skip to content

Commit

Permalink
fix(kubo): ⬆️ Upgrading go-ipfs to kubo (#251)
Browse files Browse the repository at this point in the history
* feat(kubo): ⬆️ go-ipfs -> kubo

Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>

* fix(kubo): 📦 go-ipfs -> kubo

Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>

* fix(kubo): 📦 Change ipfsBin path

Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>

* fix(lint): 🚨 Linter Warning

Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>

---------

Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
  • Loading branch information
whizzzkid authored Sep 2, 2023
1 parent f3a49c0 commit 963a7a2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion benchmarks/add-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"blockstore-fs": "^1.0.1",
"datastore-level": "^10.0.1",
"execa": "^7.0.0",
"go-ipfs": "^0.19.0",
"helia": "^1.0.0",
"ipfs-core": "^0.18.0",
"ipfs-unixfs-importer": "^15.1.5",
"ipfsd-ctl": "^13.0.0",
"it-all": "^2.0.0",
"it-drain": "^2.0.0",
"it-map": "^2.0.1",
"kubo": "^0.22.0",
"kubo-rpc-client": "^3.0.1",
"libp2p": "^0.43.0",
"multiformats": "^11.0.1",
Expand Down
11 changes: 5 additions & 6 deletions benchmarks/add-dir/src/kubo-direct.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { execa } from 'execa'
import { path as kuboPath } from 'kubo'
import { CID } from 'multiformats/cid'
import { promises as fsPromises } from 'node:fs'
import os from 'node:os'
import nodePath from 'node:path'
import { execa } from 'execa'
// @ts-expect-error no types
import * as goIpfs from 'go-ipfs'
import { CID } from 'multiformats/cid'
import type { AddDirBenchmark } from './index.js'

export async function createKuboDirectBenchmark (): Promise<AddDirBenchmark> {
const repoDir = nodePath.join(os.tmpdir(), 'kubo-direct')

await execa(goIpfs.path(), ['--repo-dir', repoDir, 'init'])
await execa(kuboPath(), ['--repo-dir', repoDir, 'init'])

const addDir = async function (dir: string): Promise<CID> {
const { stdout } = await execa(goIpfs.path(), ['--repo-dir', repoDir, 'add', '-r', '--pin=false', dir])
const { stdout } = await execa(kuboPath(), ['--repo-dir', repoDir, 'add', '-r', '--pin=false', dir])
const lines = stdout.split('\n')
const lastLine = lines.pop()
const cid = CID.parse(lastLine?.split(' ')[1] as string)
Expand Down
11 changes: 5 additions & 6 deletions benchmarks/add-dir/src/kubo.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import fs, { promises as fsPromises } from 'node:fs'
import nodePath from 'node:path'
// @ts-expect-error no types
import * as goIpfs from 'go-ipfs'
import { createController } from 'ipfsd-ctl'
import last from 'it-last'
import { path as kuboPath } from 'kubo'
import * as goRpcClient from 'kubo-rpc-client'
import type { AddDirBenchmark } from './index.js'
import type { CID } from 'multiformats/cid'
import fs, { promises as fsPromises } from 'node:fs'
import nodePath from 'node:path'
import type { AddDirBenchmark } from './index.js'

export async function createKuboBenchmark (): Promise<AddDirBenchmark> {
const controller = await createController({
type: 'go',
test: true,
ipfsBin: goIpfs.path(),
ipfsBin: kuboPath(),
kuboRpcModule: goRpcClient,
ipfsOptions: {
init: {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/gc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"blockstore-fs": "^1.0.1",
"datastore-level": "^10.0.1",
"execa": "^7.0.0",
"go-ipfs": "^0.20.0",
"helia": "^1.0.0",
"ipfs-core": "^0.18.0",
"ipfsd-ctl": "^13.0.0",
"it-all": "^3.0.2",
"it-drain": "^3.0.1",
"it-map": "^3.0.3",
"kubo": "^0.22.0",
"kubo-rpc-client": "^3.0.1",
"libp2p": "^0.45.2",
"multiformats": "^11.0.1",
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/gc/src/kubo.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/* eslint-disable no-console */

// @ts-expect-error no types
import * as goIpfs from 'go-ipfs'
import { createController } from 'ipfsd-ctl'
import all from 'it-all'
import drain from 'it-drain'
import { path as kuboPath } from 'kubo'
import * as goRpcClient from 'kubo-rpc-client'
import type { GcBenchmark } from './index.js'

export async function createKuboBenchmark (): Promise<GcBenchmark> {
const controller = await createController({
type: 'go',
test: true,
ipfsBin: goIpfs.path(),
ipfsBin: kuboPath(),
ipfsHttpModule: goRpcClient,
ipfsOptions: {
init: {
Expand Down
2 changes: 1 addition & 1 deletion packages/interop/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
host: '127.0.0.1',
port: ipfsdPort
}, {
ipfsBin: (await import('go-ipfs')).default.path(),
ipfsBin: (await import('kubo')).default.path(),
kuboRpcModule: kuboRpcClient,
ipfsOptions: {
config: {
Expand Down
4 changes: 2 additions & 2 deletions packages/interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@
"aegir": "^40.0.8",
"blockstore-core": "^4.0.0",
"datastore-core": "^9.0.0",
"go-ipfs": "^0.22.0",
"helia": "^2.0.1",
"ipfsd-ctl": "^13.0.0",
"it-all": "^3.0.2",
"it-to-buffer": "^4.0.1",
"kubo": "^0.22.0",
"kubo-rpc-client": "^3.0.1",
"libp2p": "^0.46.6",
"multiformats": "^12.0.1"
},
"browser": {
"./dist/test/fixtures/create-helia.js": "./dist/test/fixtures/create-helia.browser.js",
"./dist/test/fixtures/create-kubo.js": "./dist/test/fixtures/create-kubo.browser.js",
"go-ipfs": false
"kubo": false
}
}
7 changes: 3 additions & 4 deletions packages/interop/test/fixtures/create-kubo.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/prefer-ts-expect-error */
// @ts-ignore no types - TODO: remove me once the next version of npm-go-ipfs has shipped
import * as goIpfs from 'go-ipfs'
import { type Controller, createController } from 'ipfsd-ctl'
import { createController, type Controller } from 'ipfsd-ctl'
import { path as kuboPath } from 'kubo'
import * as kuboRpcClient from 'kubo-rpc-client'

export async function createKuboNode (): Promise<Controller> {
return createController({
kuboRpcModule: kuboRpcClient,
ipfsBin: goIpfs.path(),
ipfsBin: kuboPath(),
test: true,
ipfsOptions: {
config: {
Expand Down

0 comments on commit 963a7a2

Please sign in to comment.