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

Commit

Permalink
fix: ts types after multihashing-async release (#3529)
Browse files Browse the repository at this point in the history
The new types in multihashing-async are unsurprisingly stricter than using no types at all.

fixes #3527
  • Loading branch information
achingbrain authored Feb 7, 2021
1 parent 9cbc09c commit 95b891f
Show file tree
Hide file tree
Showing 31 changed files with 42 additions and 31 deletions.
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 @@ -13,6 +13,6 @@
"license": "MIT",
"devDependencies": {
"ipfs": "^0.54.1",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/browser-browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"http-server": "^0.12.3",
"ipfs": "^0.54.1",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"browser": {
"ipfs": "ipfs/dist/index.min.js"
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 @@ -13,7 +13,7 @@
},
"devDependencies": {
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-exchange-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"it-all": "^1.0.4",
"libp2p-websockets": "^0.15.0",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"browser": {
"ipfs": "ipfs/dist/index.min.js"
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-http-client-upload-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"react": "^16.8.6",
"react-dom": "^16.8.6",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"browserslist": [
"last 2 versions and not dead and > 2%"
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-ipns-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"go-ipfs": "0.8.0-rc2",
"parcel-bundler": "^1.12.4",
"path": "^0.12.7",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"repository": {
"type": "git",
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 @@ -17,7 +17,7 @@
"http-server": "^0.12.3",
"rimraf": "^3.0.2",
"terser-webpack-plugin": "^1.2.1",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-parceljs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"parcel-bundler": "^1.12.4",
"rimraf": "^3.0.2",
"standard": "^13.1.0",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/browser-readablestream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"http-server": "^0.12.3",
"rimraf": "^3.0.2",
"terser-webpack-plugin": "^1.2.1",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"webpack": "^4.43.0"
},
"dependencies": {
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 @@ -13,7 +13,7 @@
"license": "MIT",
"devDependencies": {
"http-server": "^0.12.3",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"dependencies": {
"ipfs": "^0.54.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-service-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@babel/preset-env": "^7.3.1",
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.4",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"webpack": "5.4.0",
"webpack-cli": "4.1.0",
"webpack-dev-server": "3.11.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-sharing-node-across-tabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.4",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0",
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 @@ -13,7 +13,7 @@
"license": "MIT",
"devDependencies": {
"http-server": "^0.12.3",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"dependencies": {
"ipfs": "^0.54.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "^6.8.0",
"eslint-plugin-vue": "^6.2.1",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
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 @@ -23,7 +23,7 @@
"react-hot-loader": "^4.12.21",
"rimraf": "^3.0.2",
"stream-browserify": "^3.0.0",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"webpack": "^5.18.0",
"webpack-cli": "^4.4.0",
"webpack-dev-server": "^3.11.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/circuit-relaying/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"parcel-bundler": "^1.12.4",
"rimraf": "^3.0.2",
"tachyons": "^4.11.1",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"browserslist": [
">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 @@ -17,6 +17,6 @@
},
"devDependencies": {
"execa": "^4.0.3",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/custom-ipld-formats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"devDependencies": {
"execa": "^4.0.3",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"dependencies": {
"cids": "^1.1.5",
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 @@ -21,6 +21,6 @@
},
"devDependencies": {
"execa": "^4.0.3",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/explore-ethereum-blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"ipfs-http-client": "^49.0.1",
"ipfsd-ctl": "^7.2.0",
"ipld-ethereum": "^5.0.1",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/http-client-browser-pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"ipfs": "^0.54.1",
"ipfsd-ctl": "^7.2.0",
"parcel-bundler": "^1.12.4",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/http-client-bundle-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ipfsd-ctl": "^7.2.0",
"react-hot-loader": "^4.12.21",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3",
"test-ipfs-example": "^3.0.0",
"webpack": "^4.43.0",
"webpack-dev-server": "^3.11.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/http-client-name-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ipfsd-ctl": "^7.2.0",
"parcel-bundler": "^1.12.4",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"browserslist": [
"last 2 versions and not dead and > 2%"
Expand Down
2 changes: 1 addition & 1 deletion examples/ipfs-101/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"uint8arrays": "^2.0.5"
},
"devDependencies": {
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/ipfs-client-add-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ipfsd-ctl": "^7.2.0",
"parcel-bundler": "^1.12.4",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"browserslist": [
"last 2 versions and not dead and > 2%"
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 @@ -19,7 +19,7 @@
"electron": "^11.2.1",
"electron-rebuild": "^2.3.4",
"ipfs": "^0.54.1",
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"greenkeeper": {
"ignore": [
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 @@ -10,7 +10,7 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"dependencies": {
"ipfs": "^0.54.1"
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 @@ -10,7 +10,7 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"test-ipfs-example": "^2.0.3"
"test-ipfs-example": "^3.0.0"
},
"dependencies": {
"cids": "^1.1.5",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"lint": "lerna run lint",
"dep-check": "lerna run dep-check",
"configure-examples": "run-s configure-examples:* release:pre:reinstall release:pre:bundle",
"configure-examples:pre:add-examples": "json -I -f ./lerna.json -e \"this.packages.push('examples/*'); this.packages = [...new Set(this.packages)]\"",
"configure-examples:add-examples": "json -I -f ./lerna.json -e \"this.packages.push('examples/*'); this.packages = [...new Set(this.packages)]\"",
"configure-examples:add-hoisted-modules": "json -I -f ./lerna.json -e \"this.command.bootstrap.nohoist = ['ipfs-css', 'tachyons']; this.command.bootstrap.nohoist = [...new Set(this.command.bootstrap.nohoist)]\"",
"release": "run-s release:pre:* release:publish docker:release release:post:*",
"release:pre:non-dirty-repo": "git diff --quiet",
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-core/src/components/block/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = ({ blockService, pin, gcLock, preload }) => {
cidVersion = options.version
}

const multihash = await multihashing(block, mhtype)
const multihash = await multihashing(bytes, mhtype)
const cid = new CID(cidVersion, format, multihash)

block = new Block(bytes, cid)
Expand Down Expand Up @@ -120,7 +120,7 @@ module.exports = ({ blockService, pin, gcLock, preload }) => {
* @typedef {Object} PutOptions
* @property {CID} [cid] - A CID to store the block under (default: `undefined`)
* @property {string} [format='dag-pb'] - The codec to use to create the CID (default: `'dag-pb'`)
* @property {string} [mhtype='sha2-256'] - The hashing algorithm to use to create the CID (default: `'sha2-256'`)
* @property {import('multihashes').HashName} [mhtype='sha2-256'] - The hashing algorithm to use to create the CID (default: `'sha2-256'`)
* @property {number} [mhlen]
* @property {CIDVersion} [version=0] - The version to use to create the CID (default: `0`)
* @property {boolean} [pin=false] - If true, pin added blocks recursively (default: `false`)
Expand Down
11 changes: 11 additions & 0 deletions scripts/update-example-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,27 @@ async function main () {

console.info('Running on branch', branch)

// list all of the package.json files we may have just updated
const potentiallyUpdatedProjects = []

for (const dir of fs.readdirSync(PACKAGES_DIR)) {
const projectPkgPath = path.resolve(PACKAGES_DIR, dir, 'package.json')

if (!fs.existsSync(projectPkgPath)) {
continue
}

potentiallyUpdatedProjects.push(projectPkgPath)
}

// add the example test runner
potentiallyUpdatedProjects.push(path.resolve(EXAMPLES_DIR, 'test-ipfs-example', 'package.json'))

for (const projectPkgPath of potentiallyUpdatedProjects) {
const projectPkg = JSON.parse(fs.readFileSync(projectPkgPath, { encoding: 'utf8' }))
const projectDepVersion = `^${projectPkg.version}`

// look through all the example projects and update their deps
for (const dir of fs.readdirSync(EXAMPLES_DIR)) {
const examplePkgPath = path.resolve(EXAMPLES_DIR, dir, 'package.json')

Expand Down

0 comments on commit 95b891f

Please sign in to comment.