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

fix: fixes browser script tag example #3034

Merged
merged 5 commits into from
May 14, 2020
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
2 changes: 1 addition & 1 deletion examples/browser-add-readable-stream/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>
<pre id="output"></pre>
<script src="./node_modules/ipfs/dist/index.js"></script>
<script src="./node_modules/ipfs/dist/index.min.js"></script>
<script src="index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/browser-add-readable-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"test-ipfs-example": "^2.0.1"
}
}
4 changes: 2 additions & 2 deletions examples/browser-browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"concat-stream": "^2.0.0",
"execa": "^4.0.0",
"http-server": "^0.11.1",
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"test-ipfs-example": "^2.0.1"
},
"browser": {
"ipfs": "ipfs/dist/index.js"
"ipfs": "ipfs/dist/index.min.js"
}
}
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 @@ -3,7 +3,7 @@
"private": true,
"dependencies": {
"dot-prop": "^5.0.0",
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"ipfs-css": "^0.13.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-mfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"webpack-cli": "^3.0.8"
},
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"mime-sniffer": "~0.0.3"
}
}
2 changes: 1 addition & 1 deletion examples/browser-parceljs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"ipfs": "^0.43.0"
"ipfs": "^0.43.3"
},
"devDependencies": {
"@babel/cli": "^7.1.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-readablestream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"webpack": "^4.28.4"
},
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"it-to-stream": "^0.1.1",
"videostream": "^3.2.0"
}
Expand Down
12 changes: 7 additions & 5 deletions examples/browser-script-tag/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>IPFS in the Browser</title>
<script src="./node_modules/ipfs/dist/index.js"></script>
<script src="./node_modules/ipfs/dist/index.min.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', async () => {
const node = await Ipfs.create({ repo: 'ipfs-' + Math.random() })
Expand Down Expand Up @@ -31,8 +31,9 @@ <h2>Some suggestions</h2>

<code style="display:block; white-space:pre-wrap; background-color:#d7d6d6">
async function addFile () {
const filesAdded = await node.add('Hello world!')
filesAdded.forEach((file) => console.log('successfully stored', file.hash))
for await (const { cid } of node.add('Hello world!')) {
console.log('successfully stored', cid)
}
}

addFile()
Expand All @@ -42,8 +43,9 @@ <h2>Some suggestions</h2>

<code style="display:block; white-space:pre-wrap; background-color:#d7d6d6">
async function catFile () {
const data = await node.cat('QmQzCQn4puG4qu8PVysxZmscmQ5vT1ZXpqo7f58Uh9QfyY')
console.log(data.toString())
for await (const data of node.cat('QmQzCQn4puG4qu8PVysxZmscmQ5vT1ZXpqo7f58Uh9QfyY')) {
console.log(data.toString())
}
}

catFile()
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-script-tag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"test-ipfs-example": "^2.0.1"
},
"dependencies": {
"ipfs": "^0.43.0"
"ipfs": "^0.43.3"
}
}
2 changes: 1 addition & 1 deletion examples/browser-video-streaming/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<body>
<video id="video" controls></video>
<script src="./node_modules/ipfs/dist/index.js"></script>
<script src="./node_modules/ipfs/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hlsjs-ipfs-loader@latest/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="streaming.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-video-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"test-ipfs-example": "^2.0.1"
},
"dependencies": {
"ipfs": "^0.43.0"
"ipfs": "^0.43.3"
}
}
2 changes: 1 addition & 1 deletion examples/browser-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"core-js": "^3.6.4",
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"vue": "^2.6.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"ipfs": "^0.43.0"
"ipfs": "^0.43.3"
},
"browserslist": [
">1%",
Expand Down
4 changes: 2 additions & 2 deletions examples/circuit-relaying/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"author": "Dmitriy Ryajov <dryajov@gmail.com>",
"license": "MIT",
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"ipfs-pubsub-room": "^2.0.1"
},
"devDependencies": {
"execa": "^4.0.0",
"ipfs-css": "^0.13.1",
"ipfs-http-client": "^43.0.1",
"ipfs-http-client": "^44.0.3",
"parcel-bundler": "^1.12.4",
"tachyons": "^4.9.1",
"test-ipfs-example": "^2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-ipfs-repo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "MIT",
"dependencies": {
"datastore-fs": "^0.9.1",
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"ipfs-repo": "^2.0.1",
"it-all": "^1.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-libp2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"license": "MIT",
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"libp2p": "^0.27.7",
"libp2p-bootstrap": "^0.10.3",
"libp2p-kad-dht": "^0.18.7",
Expand Down
4 changes: 2 additions & 2 deletions examples/exchange-files-in-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"ipfs-http-client": "^43.0.1"
},
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"it-all": "^1.0.1",
"it-last": "^1.0.1",
"test-ipfs-example": "^2.0.1"
},
"browser": {
"ipfs": "ipfs/dist"
"ipfs": "ipfs/dist/index.min.js"
}
}
4 changes: 2 additions & 2 deletions examples/explore-ethereum-blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"ipfs": "^0.43.0",
"ipfs-http-client": "^43.0.1",
"ipfs": "^0.43.3",
"ipfs-http-client": "^44.0.3",
"test-ipfs-example": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/ipfs-101/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "David Dias <daviddias@ipfs.io>",
"license": "MIT",
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"it-all": "^1.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/run-in-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"electron": "^6.0.0",
"electron-rebuild": "^1.8.4",
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"test-ipfs-example": "^2.0.1"
},
"greenkeeper": {
Expand Down
2 changes: 1 addition & 1 deletion examples/running-multiple-nodes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"test-ipfs-example": "^2.0.1"
},
"dependencies": {
"ipfs": "^0.43.0"
"ipfs": "^0.43.3"
}
}
3 changes: 2 additions & 1 deletion examples/test-ipfs-example/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function startServer (dir) {
if (fs.existsSync(f)) {
console.info('Found bare file', f)

const distFile = path.resolve(process.cwd(), 'node_modules/ipfs/dist/index.js')
const distFile = path.resolve(process.cwd(), 'node_modules/ipfs/dist/index.min.js')

console.info('Looking for IPFS dist file at', distFile)

Expand All @@ -78,6 +78,7 @@ async function startServer (dir) {
cwd: path.resolve(dir, '../../packages/ipfs'),
env: {
...process.env,
NODE_ENV: 'production', // otherwise we only produce index.js and not index.min.js
CI: true // needed for some "clever" build tools
},
all: true
Expand Down
2 changes: 1 addition & 1 deletion examples/traverse-ipld-graphs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test-ipfs-example": "^2.0.1"
},
"dependencies": {
"ipfs": "^0.43.0",
"ipfs": "^0.43.3",
"ipld-block": "^0.9.1"
}
}
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/dht/find-peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = (common, options) => {
it('should respect timeout option when finding a peer on the DHT', async () => {
const nodeBId = await nodeB.id()

await testTimeout(() => nodeA.dht.findPeer(nodeBId, {
await testTimeout(() => nodeA.dht.findPeer(nodeBId.id, {
timeout: 1
}))
})
Expand Down
3 changes: 0 additions & 3 deletions packages/ipfs-http-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ To always request the latest version, use one of the following examples:
```html
<!-- loading the minified version using jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/ipfs-http-client/dist/index.min.js"></script>

<!-- loading the human-readable (not minified) version jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/ipfs-http-client/dist/index.js"></script>
```

For maximum security you may also decide to:
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ You can load IPFS right in your browser by adding the following to your page usi
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>

<!-- loading the human-readable (not minified) version jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
```

Inserting one of the above lines will make an `Ipfs` object available in the global namespace:
Expand Down