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

fix: update vite example #431

Merged
merged 8 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/browser-add-readable-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"ipfs-core": "^0.15.2"
"ipfs-core": "^0.16.0"
},
"devDependencies": {
"@babel/core": "^7.14.8",
Expand All @@ -25,6 +25,6 @@
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
}
}
9 changes: 6 additions & 3 deletions examples/browser-add-readable-stream/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,16 @@ const main = async () => {
DOM.content.innerHTML = '';

for await (const file of fileList) {
const content = [];
const decoder = new TextDecoder()
let content = ''

for await (const chunk of ipfs.cat(file.cid)) {
content.push(chunk)
content += decoder.decode(chunk, {
stream: true
})
}

showStatus(`\u2514\u2500 ${file.name} ${file.path} ${content.toString()}`)
showStatus(`\u2514\u2500 ${file.name} ${file.path} ${content}`)
showStatus(`Preview: https://ipfs.io/ipfs/${file.path}`, COLORS.success)
addFileDOM(file.name, content, DOM.content, false)
}
Expand Down
27 changes: 23 additions & 4 deletions examples/browser-add-readable-stream/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
export default {
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'esnext',
minify: false
target: 'es2020',
minify: false,
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
commonjsOptions: {
include: []
}
},
define: {
'process.env.NODE_DEBUG': 'false',
'global': 'globalThis'
},
optimizeDeps: {
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
disabled: false,

// target: es2020 added as workaround to make big ints work
// - should be removable with vite 4
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
esbuildOptions: {
target: 'es2020'
}
}
}
})
4 changes: 2 additions & 2 deletions examples/browser-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"@angular/router": "^13.2.0",
"@libp2p/interface-peer-id": "^1.0.2",
"global": "^4.4.0",
"ipfs-core": "^0.15.2",
"ipfs-core-types": "^0.11.0",
"ipfs-core": "^0.16.0",
"ipfs-core-types": "^0.12.0",
"rxjs": "^7.5.2",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"dot-prop": "^7.1.1",
"ipfs-core": "^0.15.2",
"ipfs-core": "^0.16.0",
"ipfs-css": "^1.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
12 changes: 6 additions & 6 deletions examples/browser-exchange-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"@libp2p/websockets": "^1.0.8",
"ipfs-core": "^0.15.2",
"@libp2p/websockets": "^3.0.3",
"ipfs-core": "^0.16.0",
"it-all": "^1.0.4",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@libp2p/webrtc-star-signalling-server": "^2.0.1",
"@playwright/test": "^1.12.3",
"ipfs": "^0.63.3",
"ipfs-core-types": "^0.11.0",
"ipfs-http-client": "^57.0.1",
"ipfs": "^0.64.0",
"ipfs-core-types": "^0.12.0",
"ipfs-http-client": "^58.0.0",
"playwright": "^1.12.3",
"process": "^0.11.10",
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
}
}
2 changes: 1 addition & 1 deletion examples/browser-exchange-files/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const play = test.extend({
)
});

test.setTimeout(1000 * 60 * 2);
test.setTimeout(1000 * 60 * 10);

play.describe('upload file using http client: ', () => {
// DOM
Expand Down
27 changes: 23 additions & 4 deletions examples/browser-exchange-files/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
export default {
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'esnext',
minify: false
target: 'es2020',
minify: false,
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
commonjsOptions: {
include: []
}
},
define: {
'process.env.NODE_DEBUG': 'false',
'global': 'globalThis'
},
optimizeDeps: {
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
disabled: false,

// target: es2020 added as workaround to make big ints work
// - should be removable with vite 4
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
esbuildOptions: {
target: 'es2020'
}
}
}
})
16 changes: 8 additions & 8 deletions examples/browser-ipns-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"@libp2p/websockets": "^1.0.8",
"ipfs-core": "^0.15.2",
"ipfs-http-client": "^57.0.1",
"@libp2p/websockets": "^3.0.3",
"ipfs-core": "^0.16.0",
"ipfs-http-client": "^58.0.0",
"ipfs-utils": "^9.0.6",
"ipns": "^1.0.2",
"ipns": "^2.0.3",
"it-last": "^1.0.4",
"multiformats": "^9.6.5",
"p-retry": "^4.2.0",
"p-retry": "^5.1.1",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@playwright/test": "^1.12.3",
"delay": "^5.0.0",
"execa": "^6.0.0",
"go-ipfs": "^0.11.0",
"ipfsd-ctl": "^11.0.1",
"go-ipfs": "^0.15.0",
"ipfsd-ctl": "^12.0.2",
"playwright": "^1.12.3",
"process": "^0.11.10",
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
}
}
27 changes: 23 additions & 4 deletions examples/browser-ipns-publish/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
export default {
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'esnext',
minify: false
target: 'es2020',
minify: false,
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
commonjsOptions: {
include: []
}
},
define: {
'process.env.NODE_DEBUG': 'false',
'global': 'globalThis'
},
optimizeDeps: {
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
disabled: false,

// target: es2020 added as workaround to make big ints work
// - should be removable with vite 4
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
esbuildOptions: {
target: 'es2020'
}
}
}
})
4 changes: 2 additions & 2 deletions examples/browser-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"ipfs-core": "^0.15.2",
"ipfs-core": "^0.16.0",
"ipfs-css": "^1.3.0",
"lit": "^2.0.2",
"tachyons": "^4.12.0"
Expand All @@ -28,6 +28,6 @@
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
}
}
27 changes: 23 additions & 4 deletions examples/browser-lit/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
export default {
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'esnext',
minify: false
target: 'es2020',
minify: false,
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
commonjsOptions: {
include: []
}
},
define: {
'process.env.NODE_DEBUG': 'false',
'global': 'globalThis'
},
optimizeDeps: {
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
disabled: false,

// target: es2020 added as workaround to make big ints work
// - should be removable with vite 4
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
esbuildOptions: {
target: 'es2020'
}
}
}
})
4 changes: 2 additions & 2 deletions examples/browser-mfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"browserslist": "last 1 Chrome version",
"dependencies": {
"ipfs-core": "^0.15.2",
"ipfs-core": "^0.16.0",
"mime-sniffer": "~0.0.3"
},
"devDependencies": {
Expand All @@ -26,6 +26,6 @@
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
}
}
27 changes: 23 additions & 4 deletions examples/browser-mfs/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
export default {
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'esnext',
minify: false
target: 'es2020',
minify: false,
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
commonjsOptions: {
include: []
}
},
define: {
'process.env.NODE_DEBUG': 'false',
'global': 'globalThis'
},
optimizeDeps: {
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
disabled: false,

// target: es2020 added as workaround to make big ints work
// - should be removable with vite 4
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
esbuildOptions: {
target: 'es2020'
}
}
}
})
2 changes: 1 addition & 1 deletion examples/browser-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "npm run build && playwright test tests"
},
"dependencies": {
"ipfs-core": "^0.15.2",
"ipfs-core": "^0.16.0",
"next": "^12.0.7",
"react": "^17.0.2",
"react-dom": "^17.0.2"
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-readablestream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"browserslist": "last 1 Chrome version",
"dependencies": {
"buffer": "^6.0.3",
"ipfs-core": "^0.15.2",
"ipfs-core": "^0.16.0",
"it-to-stream": "^1.0.0",
"videostream": "^3.2.0"
},
Expand All @@ -31,6 +31,6 @@
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
}
}
Loading