Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit fc4a0f0

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 aa9d19d commit fc4a0f0

File tree

173 files changed

+854
-1247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+854
-1247
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ jobs:
1515
project:
1616
- browser-add-readable-stream
1717
- browser-angular
18-
- browser-browserify
1918
- browser-create-react-app
2019
- browser-exchange-files
2120
- browser-ipns-publish
2221
- browser-lit
2322
- browser-mfs
2423
- browser-nextjs
25-
- browser-parceljs
2624
- browser-readablestream
2725
- browser-script-tag
2826
- browser-service-worker
2927
- browser-sharing-node-across-tabs
3028
- browser-video-streaming
29+
- browser-vite
3130
- browser-vue
3231
- browser-webpack
3332
- circuit-relaying
@@ -39,7 +38,7 @@ jobs:
3938
- http-client-name-api
4039
- http-client-upload-file
4140
- ipfs-101
42-
- ipfs-client-add-files
41+
#- ipfs-client-add-files
4342
- run-in-electron
4443
- running-multiple-nodes
4544
- traverse-ipld-graphs

examples/browser-add-readable-stream/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
"name": "example-browser-add-readable-stream",
33
"version": "1.0.0",
44
"private": true,
5+
"type": "module",
56
"description": "How to add readable streams in the browser",
67
"keywords": [],
78
"license": "MIT",
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-core": "^0.14.0"
18+
"ipfs-core": "^0.15.2"
1819
},
1920
"devDependencies": {
2021
"@babel/core": "^7.14.8",
2122
"@playwright/test": "^1.12.3",
22-
"parcel": "^2.3.2",
2323
"playwright": "^1.12.3",
2424
"process": "^0.11.10",
2525
"rimraf": "^3.0.2",
2626
"test-util-ipfs-example": "^1.0.2",
27-
"util": "^0.12.4"
27+
"util": "^0.12.4",
28+
"vite": "^3.0.0-beta.1"
2829
}
2930
}

examples/browser-add-readable-stream/src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict'
2-
31
import { create } from 'ipfs-core'
42

53
const main = async () => {

examples/browser-add-readable-stream/tests/test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
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';
53

64
// Setup
75
const play = test.extend({
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+
}

examples/browser-angular/angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"builder": "@angular-builders/custom-webpack:browser",
1919
"options": {
2020
"customWebpackConfig": {
21-
"path": "./extra-webpack.config.ts"
21+
"path": "./extra-webpack.config.js"
2222
},
2323
"outputPath": "dist/",
2424
"index": "src/index.html",
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Configuration, ProvidePlugin } from 'webpack';
2-
import * as NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
1+
import webpack from 'webpack';
2+
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
33

44
export default {
55
plugins: [
@@ -9,8 +9,8 @@ export default {
99
// dependencies causing runtime errors. This is a workaround to provide
1010
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
1111
// is fixed.
12-
new ProvidePlugin({
12+
new webpack.ProvidePlugin({
1313
global: ['global']
1414
})
1515
]
16-
} as Configuration;
16+
};

examples/browser-angular/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "example-browser-angular",
33
"version": "0.0.0",
44
"private": true,
5+
"type": "module",
56
"scripts": {
67
"clean": "rimraf ./dist",
78
"ng": "ng",
@@ -20,9 +21,10 @@
2021
"@angular/platform-browser": "^13.2.0",
2122
"@angular/platform-browser-dynamic": "^13.2.0",
2223
"@angular/router": "^13.2.0",
24+
"@libp2p/interface-peer-id": "^1.0.2",
2325
"global": "^4.4.0",
24-
"ipfs-core": "^0.14.0",
25-
"ipfs-core-types": "^0.10.0",
26+
"ipfs-core": "^0.15.2",
27+
"ipfs-core-types": "^0.11.0",
2628
"rxjs": "^7.5.2",
2729
"tslib": "^2.3.0",
2830
"zone.js": "~0.11.4"

examples/browser-angular/src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
22
import { IpfsService } from './ipfs.service';
3+
import { PeerId } from '@libp2p/interface-peer-id';
34

45
@Component({
56
selector: 'app-root',
@@ -8,7 +9,7 @@ import { IpfsService } from './ipfs.service';
89
})
910
export class AppComponent implements OnInit {
1011
title = 'browser-angular';
11-
id: string | null = null;
12+
id: PeerId | null = null;
1213
version: string | null = null;
1314
status: string | null = null;
1415

examples/browser-angular/tests/test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
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';
53

64
// Setup
75
const play = test.extend({

examples/browser-browserify/.github/workflows/sync.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/browser-browserify/README.md

Lines changed: 0 additions & 122 deletions
This file was deleted.

examples/browser-browserify/img/1.png

-184 KB
Binary file not shown.

examples/browser-browserify/img/2.png

-232 KB
Binary file not shown.

examples/browser-browserify/package.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)