Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 9067d4a

Browse files
authored
fix: update ipfs versions (#365)
Updates all examples to use ESM versions of IPFS, swaps parcel for vite everywhere and removes old browserify example because it only understands CJS.
1 parent cd0c315 commit 9067d4a

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22
"name": "example-http-client-name-api",
33
"version": "1.0.0",
44
"private": true,
5+
"type": "module",
56
"description": "",
67
"license": "MIT",
78
"author": "Tara Vancil <tbvanc@gmail.com>",
89
"scripts": {
9-
"clean": "rimraf ./dist ./.cache ./.parcel-cache",
10-
"build": "parcel build index.html --no-scope-hoist",
11-
"serve": "parcel serve index.html --open -p 8888",
10+
"clean": "rimraf ./dist ./.cache ./node_modules/.vite",
11+
"build": "vite build",
12+
"serve": "vite dev --port 8888",
1213
"start": "npm run serve",
1314
"test": "npm run build && playwright test tests"
1415
},
1516
"browserslist": "last 1 Chrome version",
1617
"dependencies": {
17-
"ipfs-http-client": "^56.0.0"
18+
"ipfs-http-client": "^57.0.1"
1819
},
1920
"devDependencies": {
2021
"@babel/core": "^7.14.8",
2122
"@playwright/test": "^1.12.3",
2223
"go-ipfs": "^0.11.0",
23-
"parcel": "^2.3.2",
2424
"playwright": "^1.12.3",
2525
"process": "^0.11.10",
2626
"rimraf": "^3.0.2",
2727
"test-util-ipfs-example": "^1.0.2",
28-
"util": "^0.12.4"
28+
"util": "^0.12.4",
29+
"vite": "^3.0.0-beta.1"
2930
}
3031
}

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* eslint-disable no-console */
2-
'use strict'
3-
42
import { create as ipfsHttp } from 'ipfs-http-client'
53

64
const App = () => {

tests/test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
'use strict'
2-
3-
const { test, expect } = require('@playwright/test');
4-
const { playwright } = require('test-util-ipfs-example');
1+
import { test, expect } from '@playwright/test';
2+
import { playwright } from 'test-util-ipfs-example';
3+
import * as ipfsHttpModule from 'ipfs-http-client'
4+
import * as goIpfsModule from 'go-ipfs'
55

66
// Setup
77
const play = test.extend({
88
...playwright.servers(),
99
...playwright.daemons(
1010
{
11-
ipfsHttpModule: require('ipfs-http-client'),
12-
ipfsBin: require('go-ipfs').path(),
11+
ipfsHttpModule,
12+
ipfsBin: goIpfsModule.path(),
1313
args: ['--enable-pubsub-experiment']
1414
},
1515
{},
@@ -60,7 +60,7 @@ play.describe('bundle http client with webpack: ', () => {
6060
const resolveResult = '#resolve-result'
6161

6262
play.beforeEach(async ({servers, page, daemons}) => {
63-
await daemons[0].api.swarm.connect(await daemons[1].api.peerId.addresses[0])
63+
await daemons[0].api.swarm.connect(await daemons[1]._peerId.addresses[0])
6464
await page.goto(`http://localhost:${servers[0].port}/`);
6565
})
6666

vite.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
build: {
3+
target: 'esnext',
4+
minify: false
5+
},
6+
define: {
7+
'process.env.NODE_DEBUG': 'false',
8+
'global': 'globalThis'
9+
}
10+
}

0 commit comments

Comments
 (0)