Skip to content

Commit e6528d3

Browse files
committedJan 25, 2023
fix: update ipfs-http-client to v60.0.0
1 parent 7177d48 commit e6528d3

File tree

6 files changed

+1420
-209
lines changed

6 files changed

+1420
-209
lines changed
 

‎package-lock.json

+1,399-196
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"i18next-fs-backend": "1.1.4",
8282
"i18next-icu": "^2.0.3",
8383
"intl-messageformat": "^9.13.0",
84-
"ipfs-http-client": "56.0.2",
84+
"ipfs-http-client": "^60.0.0",
8585
"ipfsd-ctl": "10.0.6",
8686
"it-last": "^1.0.6",
8787
"multiaddr": "10.0.1",

‎src/add-to-ipfs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { extname, basename } = require('path')
22
const { clipboard } = require('electron')
3-
const { globSource } = require('ipfs-http-client')
43
const i18n = require('i18next')
54
const last = require('it-last')
65
const fs = require('fs-extra')
@@ -88,6 +87,7 @@ async function addFileOrDirectory (ipfs, filepath) {
8887
let cid = null
8988

9089
if (stat.isDirectory()) {
90+
const { globSource } = await import('ipfs-http-client')
9191
const files = globSource(filepath, '**/*', { recursive: true })
9292
const res = await last(ipfs.addAll(files, { pin: false, wrapWithDirectory: true }))
9393
cid = res.cid

‎src/daemon/daemon.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ function getIpfsBinPath () {
3131
async function getIpfsd (flags, path) {
3232
const ipfsBin = getIpfsBinPath()
3333

34+
const ipfsHttpModule = await import('ipfs-http-client')
3435
const ipfsd = await Ctl.createController({
35-
ipfsHttpModule: require('ipfs-http-client'),
36+
ipfsHttpModule,
3637
ipfsBin,
3738
ipfsOptions: {
3839
repo: path

‎test/e2e/utils/ipfsd.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@ const Ctl = require('ipfsd-ctl')
55

66
const { join } = require('path')
77

8-
const factory = Ctl.createFactory({
9-
type: 'go',
10-
ipfsHttpModule: require('ipfs-http-client'),
11-
ipfsBin: require('go-ipfs').path(),
12-
remote: false,
13-
disposable: true,
14-
test: true // run on random ports
15-
})
8+
let factory
9+
async function getFactory () {
10+
if (factory === undefined) {
11+
const ipfsHttpModule = await import('ipfs-http-client')
12+
factory = Ctl.createFactory({
13+
type: 'go',
14+
ipfsHttpModule,
15+
ipfsBin: require('go-ipfs').path(),
16+
remote: false,
17+
disposable: true,
18+
test: true // run on random ports
19+
})
20+
}
21+
return factory
22+
}
1623

1724
async function makeRepository ({ start = false }) {
1825
const { name: repoPath } = tmp.dirSync({ prefix: 'tmp_IPFS_PATH_', unsafeCleanup: true })
1926
const configPath = join(repoPath, 'config')
2027

28+
const factory = await getFactory()
2129
const ipfsd = await factory.spawn({
2230
ipfsOptions: { repo: repoPath },
2331
init: false,

‎test/unit/add-to-ipfs.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const mockNotify = require('./mocks/notify')
77

88
const proxyquire = require('proxyquire').noCallThru()
99

10-
const { makeRepository } = require('./../e2e/utils/ipfsd')
11-
1210
const getFixtures = (...files) => files.map(f => path.join(__dirname, 'fixtures', f))
1311

1412
if (process.env.CI === 'true') test.setTimeout(120000) // slow ci
@@ -17,6 +15,7 @@ test.describe('Add To Ipfs', function () {
1715
let electron, notify, addToIpfs, ipfsd, ctx
1816

1917
test.beforeAll(async () => {
18+
const { makeRepository } = require('./../e2e/utils/ipfsd')
2019
const repo = await makeRepository({ start: true })
2120
ipfsd = repo.ipfsd
2221
ctx = {

0 commit comments

Comments
 (0)
Please sign in to comment.