From ee8b769b96f7e3c8414bbf85853ab4e21e8fd11c Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Thu, 14 May 2020 19:32:25 +0100 Subject: [PATCH] fix: fixes browser script tag example (#3034) Updates example syntax to new api, also removes references to `dist/index.js` in favour of `dist/index.min.js`. fixes #3027 --- examples/browser-add-readable-stream/index.html | 2 +- examples/browser-add-readable-stream/package.json | 2 +- examples/browser-browserify/package.json | 4 ++-- examples/browser-create-react-app/package.json | 2 +- examples/browser-mfs/package.json | 2 +- examples/browser-parceljs/package.json | 2 +- examples/browser-readablestream/package.json | 2 +- examples/browser-script-tag/index.html | 12 +++++++----- examples/browser-script-tag/package.json | 2 +- examples/browser-video-streaming/index.html | 2 +- examples/browser-video-streaming/package.json | 2 +- examples/browser-vue/package.json | 2 +- examples/browser-webpack/package.json | 2 +- examples/circuit-relaying/package.json | 4 ++-- examples/custom-ipfs-repo/package.json | 2 +- examples/custom-libp2p/package.json | 2 +- examples/exchange-files-in-browser/package.json | 4 ++-- examples/explore-ethereum-blockchain/package.json | 4 ++-- examples/ipfs-101/package.json | 2 +- examples/run-in-electron/package.json | 2 +- examples/running-multiple-nodes/package.json | 2 +- examples/test-ipfs-example/utils.js | 3 ++- examples/traverse-ipld-graphs/package.json | 2 +- packages/interface-ipfs-core/src/dht/find-peer.js | 2 +- packages/ipfs-http-client/README.md | 3 --- packages/ipfs/README.md | 2 +- 26 files changed, 36 insertions(+), 36 deletions(-) diff --git a/examples/browser-add-readable-stream/index.html b/examples/browser-add-readable-stream/index.html index 23d5b3d289..3b5d853e6d 100644 --- a/examples/browser-add-readable-stream/index.html +++ b/examples/browser-add-readable-stream/index.html @@ -5,7 +5,7 @@

-    
+    
     
   
 
diff --git a/examples/browser-add-readable-stream/package.json b/examples/browser-add-readable-stream/package.json
index 04d4dc777b..eb08371b2f 100644
--- a/examples/browser-add-readable-stream/package.json
+++ b/examples/browser-add-readable-stream/package.json
@@ -11,7 +11,7 @@
   "keywords": [],
   "license": "MIT",
   "devDependencies": {
-    "ipfs": "^0.43.0",
+    "ipfs": "^0.43.3",
     "test-ipfs-example": "^2.0.1"
   }
 }
diff --git a/examples/browser-browserify/package.json b/examples/browser-browserify/package.json
index 32788bc0aa..673fce9c39 100644
--- a/examples/browser-browserify/package.json
+++ b/examples/browser-browserify/package.json
@@ -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"
   }
 }
diff --git a/examples/browser-create-react-app/package.json b/examples/browser-create-react-app/package.json
index 8b88a1c0c9..951e2b6051 100644
--- a/examples/browser-create-react-app/package.json
+++ b/examples/browser-create-react-app/package.json
@@ -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",
diff --git a/examples/browser-mfs/package.json b/examples/browser-mfs/package.json
index 01b1ae205a..cf1f09b9b5 100644
--- a/examples/browser-mfs/package.json
+++ b/examples/browser-mfs/package.json
@@ -20,7 +20,7 @@
     "webpack-cli": "^3.0.8"
   },
   "dependencies": {
-    "ipfs": "^0.43.0",
+    "ipfs": "^0.43.3",
     "mime-sniffer": "~0.0.3"
   }
 }
diff --git a/examples/browser-parceljs/package.json b/examples/browser-parceljs/package.json
index 6bef66afa6..26f414cc92 100644
--- a/examples/browser-parceljs/package.json
+++ b/examples/browser-parceljs/package.json
@@ -17,7 +17,7 @@
   "author": "",
   "license": "ISC",
   "dependencies": {
-    "ipfs": "^0.43.0"
+    "ipfs": "^0.43.3"
   },
   "devDependencies": {
     "@babel/cli": "^7.1.5",
diff --git a/examples/browser-readablestream/package.json b/examples/browser-readablestream/package.json
index ebc4bb282e..41872d49d1 100644
--- a/examples/browser-readablestream/package.json
+++ b/examples/browser-readablestream/package.json
@@ -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"
   }
diff --git a/examples/browser-script-tag/index.html b/examples/browser-script-tag/index.html
index 82ad0f52fa..6bb9fb3ba3 100644
--- a/examples/browser-script-tag/index.html
+++ b/examples/browser-script-tag/index.html
@@ -2,7 +2,7 @@
 
 
   IPFS in the Browser
-  
+  
   
+    
     
     
     
diff --git a/examples/browser-video-streaming/package.json b/examples/browser-video-streaming/package.json
index fb99720df4..8325f9e1f6 100644
--- a/examples/browser-video-streaming/package.json
+++ b/examples/browser-video-streaming/package.json
@@ -15,6 +15,6 @@
     "test-ipfs-example": "^2.0.1"
   },
   "dependencies": {
-    "ipfs": "^0.43.0"
+    "ipfs": "^0.43.3"
   }
 }
diff --git a/examples/browser-vue/package.json b/examples/browser-vue/package.json
index e7c5de6aaa..d9816f795e 100644
--- a/examples/browser-vue/package.json
+++ b/examples/browser-vue/package.json
@@ -10,7 +10,7 @@
   },
   "dependencies": {
     "core-js": "^3.6.4",
-    "ipfs": "^0.43.0",
+    "ipfs": "^0.43.3",
     "vue": "^2.6.11"
   },
   "devDependencies": {
diff --git a/examples/browser-webpack/package.json b/examples/browser-webpack/package.json
index a950c754ee..0a3b6ebf49 100644
--- a/examples/browser-webpack/package.json
+++ b/examples/browser-webpack/package.json
@@ -25,7 +25,7 @@
     "webpack-dev-server": "^3.1.14"
   },
   "dependencies": {
-    "ipfs": "^0.43.0"
+    "ipfs": "^0.43.3"
   },
   "browserslist": [
     ">1%",
diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json
index c93a3064a1..eba7712b4e 100644
--- a/examples/circuit-relaying/package.json
+++ b/examples/circuit-relaying/package.json
@@ -13,13 +13,13 @@
   "author": "Dmitriy Ryajov ",
   "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"
diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json
index d9cf6651a5..cdf7929309 100644
--- a/examples/custom-ipfs-repo/package.json
+++ b/examples/custom-ipfs-repo/package.json
@@ -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"
   },
diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json
index 5dc4b618b7..e11c025ac0 100644
--- a/examples/custom-libp2p/package.json
+++ b/examples/custom-libp2p/package.json
@@ -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",
diff --git a/examples/exchange-files-in-browser/package.json b/examples/exchange-files-in-browser/package.json
index 0a55034fd6..77f1c11f46 100644
--- a/examples/exchange-files-in-browser/package.json
+++ b/examples/exchange-files-in-browser/package.json
@@ -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"
   }
 }
diff --git a/examples/explore-ethereum-blockchain/package.json b/examples/explore-ethereum-blockchain/package.json
index 0ca5d972db..24b730a0ac 100644
--- a/examples/explore-ethereum-blockchain/package.json
+++ b/examples/explore-ethereum-blockchain/package.json
@@ -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"
   }
 }
diff --git a/examples/ipfs-101/package.json b/examples/ipfs-101/package.json
index 1183fce77f..3812a64aba 100644
--- a/examples/ipfs-101/package.json
+++ b/examples/ipfs-101/package.json
@@ -9,7 +9,7 @@
   "author": "David Dias ",
   "license": "MIT",
   "dependencies": {
-    "ipfs": "^0.43.0",
+    "ipfs": "^0.43.3",
     "it-all": "^1.0.1"
   },
   "devDependencies": {
diff --git a/examples/run-in-electron/package.json b/examples/run-in-electron/package.json
index 7ea429eafb..ab2552c1a1 100644
--- a/examples/run-in-electron/package.json
+++ b/examples/run-in-electron/package.json
@@ -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": {
diff --git a/examples/running-multiple-nodes/package.json b/examples/running-multiple-nodes/package.json
index 566f1d86fd..421aa5b90b 100644
--- a/examples/running-multiple-nodes/package.json
+++ b/examples/running-multiple-nodes/package.json
@@ -12,6 +12,6 @@
     "test-ipfs-example": "^2.0.1"
   },
   "dependencies": {
-    "ipfs": "^0.43.0"
+    "ipfs": "^0.43.3"
   }
 }
diff --git a/examples/test-ipfs-example/utils.js b/examples/test-ipfs-example/utils.js
index 9d549d9a2f..8e1032e4c7 100644
--- a/examples/test-ipfs-example/utils.js
+++ b/examples/test-ipfs-example/utils.js
@@ -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)
 
@@ -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
diff --git a/examples/traverse-ipld-graphs/package.json b/examples/traverse-ipld-graphs/package.json
index 28bf258f91..32de8b7ad3 100644
--- a/examples/traverse-ipld-graphs/package.json
+++ b/examples/traverse-ipld-graphs/package.json
@@ -12,7 +12,7 @@
     "test-ipfs-example": "^2.0.1"
   },
   "dependencies": {
-    "ipfs": "^0.43.0",
+    "ipfs": "^0.43.3",
     "ipld-block": "^0.9.1"
   }
 }
diff --git a/packages/interface-ipfs-core/src/dht/find-peer.js b/packages/interface-ipfs-core/src/dht/find-peer.js
index bcec1d725a..38fa494a90 100644
--- a/packages/interface-ipfs-core/src/dht/find-peer.js
+++ b/packages/interface-ipfs-core/src/dht/find-peer.js
@@ -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
       }))
     })
diff --git a/packages/ipfs-http-client/README.md b/packages/ipfs-http-client/README.md
index b73a6c1c59..cef3d3ffd0 100644
--- a/packages/ipfs-http-client/README.md
+++ b/packages/ipfs-http-client/README.md
@@ -255,9 +255,6 @@ To always request the latest version, use one of the following examples:
 ```html
 
 
-
-
-
 ```
 
 For maximum security you may also decide to:
diff --git a/packages/ipfs/README.md b/packages/ipfs/README.md
index f535a2ea75..95e7b795a4 100644
--- a/packages/ipfs/README.md
+++ b/packages/ipfs/README.md
@@ -81,7 +81,7 @@ You can load IPFS right in your browser by adding the following to your page usi
 
 
 
-
+
 ```
 
 Inserting one of the above lines will make an `Ipfs` object available in the global namespace: