diff --git a/.github/workflows/bundlesize.yml b/.github/workflows/bundlesize.yml index 2b77a02d5a..23ba944ad7 100644 --- a/.github/workflows/bundlesize.yml +++ b/.github/workflows/bundlesize.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [14.x] project: - packages/ipfs-core-utils - packages/ipfs-core diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 7ea91b157b..bc2eca3a32 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [14.x] project: - packages/ipfs-core-utils - packages/ipfs-core diff --git a/.travis.yml b/.travis.yml index e18b74ad1e..9d601fa7a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,6 @@ jobs: - name: external - sidetree include: - # manual install step, we do this to cache the installed files for subsequent steps - stage: test name: lint script: @@ -272,9 +271,8 @@ jobs: - stage: test name: examples script: - # Travis lets scripts continue even if previous steps fail: https://github.com/travis-ci/travis-ci/issues/1066 - - npm run build -- --scope={ipfs-core,ipfs,ipfs-http-client,ipfs-message-port-*} && - npm run configure-examples && + # Travis lets scripts continue even if previous steps fail so need to use &&: https://github.com/travis-ci/travis-ci/issues/1066 + - npm run configure-examples && npm run test -- --scope=example* --concurrency=1 - stage: release-rc diff --git a/examples/browser-exchange-files/package.json b/examples/browser-exchange-files/package.json index 549fb7cca3..a80b09a39a 100644 --- a/examples/browser-exchange-files/package.json +++ b/examples/browser-exchange-files/package.json @@ -15,7 +15,7 @@ "execa": "^4.0.3", "http-server": "^0.12.3", "ipfs-http-client": "^48.2.2", - "uint8arrays": "^1.1.0" + "uint8arrays": "^2.0.5" }, "dependencies": { "ipfs": "^0.53.2", diff --git a/examples/browser-ipns-publish/package.json b/examples/browser-ipns-publish/package.json index 5964876fca..4e21872430 100644 --- a/examples/browser-ipns-publish/package.json +++ b/examples/browser-ipns-publish/package.json @@ -15,11 +15,11 @@ "human-crypto-keys": "^0.1.4", "ipfs": "^0.53.2", "ipfs-http-client": "^48.2.2", - "ipfs-utils": "^5.0.0", + "ipfs-utils": "^6.0.0", "ipns": "^0.8.0", "it-last": "^1.0.4", "p-retry": "^4.2.0", - "uint8arrays": "^1.1.0" + "uint8arrays": "^2.0.5" }, "browserslist": [ "last 2 versions and not dead and > 2%" diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json index a75c8f5950..2a288b96b9 100644 --- a/examples/circuit-relaying/package.json +++ b/examples/circuit-relaying/package.json @@ -18,7 +18,7 @@ "ipfs": "^0.53.2", "ipfs-pubsub-room": "^2.0.1", "libp2p-websockets": "^0.15.0", - "uint8arrays": "^1.1.0" + "uint8arrays": "^2.0.5" }, "devDependencies": { "execa": "^4.0.3", diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json index 05f36072d4..e59f6e8222 100644 --- a/examples/custom-ipfs-repo/package.json +++ b/examples/custom-ipfs-repo/package.json @@ -12,7 +12,7 @@ "dependencies": { "datastore-fs": "^2.0.0", "ipfs": "^0.53.2", - "ipfs-repo": "^7.0.0", + "ipfs-repo": "^8.0.0", "it-all": "^1.0.4" }, "devDependencies": { diff --git a/examples/custom-ipld-formats/package.json b/examples/custom-ipld-formats/package.json index a592b45e05..32da95edb9 100644 --- a/examples/custom-ipld-formats/package.json +++ b/examples/custom-ipld-formats/package.json @@ -17,6 +17,6 @@ "ipfs-http-client": "^48.2.2", "multicodec": "^2.0.1", "multihashing-async": "^2.0.1", - "uint8arrays": "^1.1.0" + "uint8arrays": "^2.0.5" } } diff --git a/examples/ipfs-101/package.json b/examples/ipfs-101/package.json index 0e17798210..041bc7be08 100644 --- a/examples/ipfs-101/package.json +++ b/examples/ipfs-101/package.json @@ -12,7 +12,7 @@ "dependencies": { "ipfs": "^0.53.2", "it-all": "^1.0.4", - "uint8arrays": "^1.1.0" + "uint8arrays": "^2.0.5" }, "devDependencies": { "test-ipfs-example": "^2.0.3" diff --git a/examples/run-in-electron/package.json b/examples/run-in-electron/package.json index ac4285f8d8..2ed49984ef 100644 --- a/examples/run-in-electron/package.json +++ b/examples/run-in-electron/package.json @@ -16,8 +16,8 @@ "author": "David Dias ", "license": "MIT", "devDependencies": { - "electron": "^6.0.0", - "electron-rebuild": "^1.8.4", + "electron": "^11.2.1", + "electron-rebuild": "^2.3.4", "ipfs": "^0.53.2", "test-ipfs-example": "^2.0.3" }, diff --git a/examples/test-ipfs-example/package.json b/examples/test-ipfs-example/package.json index a55564fcf7..bc2c230c67 100644 --- a/examples/test-ipfs-example/package.json +++ b/examples/test-ipfs-example/package.json @@ -12,7 +12,7 @@ "fs-extra": "^9.0.1", "http-server": "^0.12.3", "nightwatch": "^1.2.4", - "uint8arrays": "^1.1.0", + "uint8arrays": "^2.0.5", "which": "^2.0.1" } } diff --git a/examples/types-use-ipfs-from-ts/package.json b/examples/types-use-ipfs-from-ts/package.json index 135cf92baf..8adcf740e8 100644 --- a/examples/types-use-ipfs-from-ts/package.json +++ b/examples/types-use-ipfs-from-ts/package.json @@ -5,7 +5,7 @@ "ipfs": "^0.53.2" }, "devDependencies": { - "typescript": "4.0.x" + "typescript": "4.1.x" }, "scripts": { "test": "tsc --noEmit" diff --git a/examples/types-use-ipfs-from-typed-js/package.json b/examples/types-use-ipfs-from-typed-js/package.json index f2202be3de..8a0f468943 100644 --- a/examples/types-use-ipfs-from-typed-js/package.json +++ b/examples/types-use-ipfs-from-typed-js/package.json @@ -5,7 +5,7 @@ "ipfs": "^0.53.2" }, "devDependencies": { - "typescript": "4.0.x" + "typescript": "4.1.x" }, "scripts": { "test": "tsc --noEmit" diff --git a/package.json b/package.json index 9c6e169908..6c25d50c11 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "JavaScript implementation of the IPFS specification", "scripts": { - "postinstall": "lerna bootstrap && npm run build -- --scope=ipfs-grpc-protocol", + "postinstall": "lerna bootstrap", "link": "lerna link", "reset": "lerna run clean && rimraf packages/*/node_modules node_modules", "test": "lerna run test", @@ -23,11 +23,10 @@ "test:interface:message-port-client": "lerna run test:interface:message-port-client", "coverage": "lerna run coverage", "build": "lerna run build", - "build:types": "lerna run build:types", "clean": "lerna run clean", "lint": "lerna run lint", "dep-check": "lerna run dep-check", - "configure-examples": "run-s release:pre:add-examples release:pre:add-hoisted-modules release:pre:reinstall", + "configure-examples": "run-s release:pre:add-examples release:pre:add-hoisted-modules release:pre:reinstall && npm run build -- --scope={ipfs-core,ipfs,ipfs-http-client,ipfs-message-port-*}", "release": "run-s release:pre:* release:publish docker:release release:post:*", "release:pre:non-dirty-repo": "git diff --quiet", "release:pre:update-contributors": "aegir release --lint=false --test=false --bump=false --build=false --changelog=false --commit=false --tag=false --push=false --ghrelease=false --docs=false --publish=false", diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index bcb622e919..c78a0b8d2b 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -30,7 +30,7 @@ ], "license": "MIT", "dependencies": { - "aegir": "^29.2.2", + "aegir": "^30.3.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", @@ -40,7 +40,7 @@ "err-code": "^2.0.3", "ipfs-unixfs": "^2.0.3", "ipfs-unixfs-importer": "^5.0.0", - "ipfs-utils": "^5.0.0", + "ipfs-utils": "^6.0.0", "ipld-block": "^0.11.0", "ipld-dag-cbor": "^0.17.0", "ipld-dag-pb": "^0.20.0", @@ -51,6 +51,7 @@ "it-buffer-stream": "^1.0.5", "it-concat": "^1.0.1", "it-drain": "^1.0.3", + "it-first": "^1.0.4", "it-last": "^1.0.4", "it-map": "^1.0.4", "it-pushable": "^1.4.0", @@ -64,7 +65,7 @@ "p-map": "^4.0.0", "peer-id": "^0.14.1", "readable-stream": "^3.4.0", - "uint8arrays": "^1.1.0" + "uint8arrays": "^2.0.5" }, "contributors": [ "Alan Shaw ", diff --git a/packages/interface-ipfs-core/src/add.js b/packages/interface-ipfs-core/src/add.js index 19625a8331..4be482f5ac 100644 --- a/packages/interface-ipfs-core/src/add.js +++ b/packages/interface-ipfs-core/src/add.js @@ -346,7 +346,7 @@ module.exports = (common, options) => { }) it('should not add from an invalid url', () => { - return expect(ipfs.add(urlSource('123http://invalid'))).to.eventually.be.rejected() + return expect(() => ipfs.add(urlSource('123http://invalid'))).to.throw() }) it('should respect raw leaves when file is smaller than one block and no metadata is present', async () => { diff --git a/packages/interface-ipfs-core/src/files/write.js b/packages/interface-ipfs-core/src/files/write.js index 3c34ec6d9a..d35e0ed9d7 100644 --- a/packages/interface-ipfs-core/src/files/write.js +++ b/packages/interface-ipfs-core/src/files/write.js @@ -452,7 +452,7 @@ module.exports = (common, options) => { const actualBytes = uint8ArrayConcat(await all(ipfs.files.read(fileName))) - for (var i = 0; i < newDataStream.length; i++) { + for (let i = 0; i < newDataStream.length; i++) { if (newDataStream[i] !== actualBytes[i]) { if (initialStream[i] === actualBytes[i]) { throw new Error(`Bytes at index ${i} were not overwritten - expected ${newDataStream[i]} actual ${initialStream[i]}`) diff --git a/packages/interface-ipfs-core/src/pin/utils.js b/packages/interface-ipfs-core/src/pin/utils.js index faf17c706f..f774eff459 100644 --- a/packages/interface-ipfs-core/src/pin/utils.js +++ b/packages/interface-ipfs-core/src/pin/utils.js @@ -6,6 +6,7 @@ const CID = require('cids') const drain = require('it-drain') const map = require('it-map') const fromString = require('uint8arrays/from-string') +const first = require('it-first') const pinTypes = { direct: 'direct', @@ -93,10 +94,9 @@ const expectNotPinned = (ipfs, cid, type = pinTypes.all) => { async function isPinnedWithType (ipfs, cid, type) { try { - for await (const _ of ipfs.pin.ls({ paths: cid, type })) { // eslint-disable-line no-unused-vars - return true - } - return false + const res = await first(ipfs.pin.ls({ paths: cid, type })) + + return Boolean(res) } catch (err) { return false } diff --git a/packages/interface-ipfs-core/src/pubsub/subscribe.js b/packages/interface-ipfs-core/src/pubsub/subscribe.js index 0e3f098e1a..7416a34809 100644 --- a/packages/interface-ipfs-core/src/pubsub/subscribe.js +++ b/packages/interface-ipfs-core/src/pubsub/subscribe.js @@ -12,6 +12,7 @@ const delay = require('delay') const AbortController = require('native-abort-controller') const { isWebWorker, isNode } = require('ipfs-utils/src/env') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') +const first = require('it-first') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -68,14 +69,12 @@ module.exports = (common, options) => { await ipfs1.pubsub.publish(topic, uint8ArrayFromString('hi')) - for await (const msg of msgStream) { - expect(uint8ArrayToString(msg.data)).to.equal('hi') - expect(msg).to.have.property('seqno') - expect(msg.seqno).to.be.an.instanceof(Uint8Array) - expect(msg.topicIDs[0]).to.eq(topic) - expect(msg).to.have.property('from', ipfs1.peerId.id) - break - } + const msg = await first(msgStream) + expect(uint8ArrayToString(msg.data)).to.equal('hi') + expect(msg).to.have.property('seqno') + expect(msg.seqno).to.be.an.instanceof(Uint8Array) + expect(msg.topicIDs[0]).to.eq(topic) + expect(msg).to.have.property('from', ipfs1.peerId.id) }) it('should subscribe to one topic with options', async () => { diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index ecb5c54aa7..3ce9a2b2a4 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -108,13 +108,15 @@ module.exports = (common, options) => { it('should list peers only once even if they have multiple addresses', async () => { // TODO: Change to port 0, needs: https://github.com/ipfs/interface-ipfs-core/issues/152 - const config = getConfig(isBrowser && common.opts.type !== 'go' ? [ - '/ip4/127.0.0.1/tcp/14578/ws/p2p-webrtc-star', - '/ip4/127.0.0.1/tcp/14579/ws/p2p-webrtc-star' - ] : [ - '/ip4/127.0.0.1/tcp/26545/ws', - '/ip4/127.0.0.1/tcp/26546/ws' - ]) + const config = getConfig(isBrowser && common.opts.type !== 'go' + ? [ + '/ip4/127.0.0.1/tcp/14578/ws/p2p-webrtc-star', + '/ip4/127.0.0.1/tcp/14579/ws/p2p-webrtc-star' + ] + : [ + '/ip4/127.0.0.1/tcp/26545/ws', + '/ip4/127.0.0.1/tcp/26546/ws' + ]) const nodeA = (await common.spawn({ type: 'proc', ipfsOptions })).api const nodeB = (await common.spawn({ diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index 8f4aed67a8..b32fee20ab 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -20,13 +20,12 @@ }, "scripts": { "lint": "aegir lint", - "build": "npm run build:types", - "build:types": "tsc --build", + "prepare": "aegir build --no-bundle", "test": "npm run test:node", "test:node": "aegir test -t node", "coverage": "nyc --reporter=text --reporter=lcov npm run test:node", "clean": "rimraf ./dist", - "dep-check": "aegir dep-check -i @types/yargs -i typescript -i cid-tool" + "dep-check": "aegir dep-check -i @types/yargs -i cid-tool" }, "dependencies": { "bignumber.js": "^9.0.0", @@ -41,8 +40,8 @@ "ipfs-core-utils": "^0.6.1", "ipfs-daemon": "^0.4.2", "ipfs-http-client": "^48.2.2", - "ipfs-repo": "^7.0.0", - "ipfs-utils": "^5.0.0", + "ipfs-repo": "^8.0.0", + "ipfs-utils": "^6.0.0", "ipld-dag-cbor": "^0.17.0", "ipld-dag-pb": "^0.20.0", "it-all": "^1.0.4", @@ -63,18 +62,17 @@ "progress": "^2.0.3", "stream-to-it": "^0.2.2", "streaming-iterables": "^5.0.2", - "uint8arrays": "^1.1.0", + "uint8arrays": "^2.0.5", "yargs": "^16.0.3" }, "devDependencies": { - "@types/yargs": "^15.0.9", - "aegir": "^29.2.2", + "@types/yargs": "^16.0.0", + "aegir": "^30.3.0", "nanoid": "^3.1.12", "ncp": "^2.0.0", "rimraf": "^3.0.2", "sinon": "^9.0.3", "string-argv": "^0.3.1", - "temp-write": "^4.0.0", - "typescript": "4.0.x" + "temp-write": "^4.0.0" } } diff --git a/packages/ipfs-cli/src/commands/add.js b/packages/ipfs-cli/src/commands/add.js index f3513fdf68..49de636cbf 100644 --- a/packages/ipfs-cli/src/commands/add.js +++ b/packages/ipfs-cli/src/commands/add.js @@ -14,7 +14,7 @@ const { } = require('../utils') const { cidToString } = require('ipfs-core-utils/src/cid') const globSource = require('ipfs-utils/src/files/glob-source') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') async function getTotalBytes (paths) { const sizes = await Promise.all(paths.map(p => getFolderSize(p))) @@ -255,10 +255,10 @@ module.exports = { mtime }) : { - content: getStdin(), - mode, - mtime - } // Pipe to ipfs.add tagging with mode and mtime + content: getStdin(), + mode, + mtime + } // Pipe to ipfs.add tagging with mode and mtime let finalCid diff --git a/packages/ipfs-cli/src/commands/bitswap/stat.js b/packages/ipfs-cli/src/commands/bitswap/stat.js index 93bca712aa..20e6b741ec 100644 --- a/packages/ipfs-cli/src/commands/bitswap/stat.js +++ b/packages/ipfs-cli/src/commands/bitswap/stat.js @@ -3,7 +3,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') const prettyBytes = require('pretty-bytes') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'stat', diff --git a/packages/ipfs-cli/src/commands/bitswap/unwant.js b/packages/ipfs-cli/src/commands/bitswap/unwant.js index 474cf6e206..129cedc91c 100644 --- a/packages/ipfs-cli/src/commands/bitswap/unwant.js +++ b/packages/ipfs-cli/src/commands/bitswap/unwant.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'unwant ', diff --git a/packages/ipfs-cli/src/commands/bitswap/wantlist.js b/packages/ipfs-cli/src/commands/bitswap/wantlist.js index 4e9c014a17..0bd73d73ca 100644 --- a/packages/ipfs-cli/src/commands/bitswap/wantlist.js +++ b/packages/ipfs-cli/src/commands/bitswap/wantlist.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'wantlist [peer]', diff --git a/packages/ipfs-cli/src/commands/block/get.js b/packages/ipfs-cli/src/commands/block/get.js index 70f5f664fd..a521ba83c8 100644 --- a/packages/ipfs-cli/src/commands/block/get.js +++ b/packages/ipfs-cli/src/commands/block/get.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const uint8ArrayToString = require('uint8arrays/to-string') module.exports = { diff --git a/packages/ipfs-cli/src/commands/block/put.js b/packages/ipfs-cli/src/commands/block/put.js index fb2e0c656a..1fc6f9875f 100644 --- a/packages/ipfs-cli/src/commands/block/put.js +++ b/packages/ipfs-cli/src/commands/block/put.js @@ -4,7 +4,7 @@ const fs = require('fs') const multibase = require('multibase') const concat = require('it-concat') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'put [block]', diff --git a/packages/ipfs-cli/src/commands/block/rm.js b/packages/ipfs-cli/src/commands/block/rm.js index 6f5f32ccb7..4fcd0867a1 100644 --- a/packages/ipfs-cli/src/commands/block/rm.js +++ b/packages/ipfs-cli/src/commands/block/rm.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'rm ', diff --git a/packages/ipfs-cli/src/commands/block/stat.js b/packages/ipfs-cli/src/commands/block/stat.js index f1032023b4..75badcdc03 100644 --- a/packages/ipfs-cli/src/commands/block/stat.js +++ b/packages/ipfs-cli/src/commands/block/stat.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'stat ', diff --git a/packages/ipfs-cli/src/commands/bootstrap/add.js b/packages/ipfs-cli/src/commands/bootstrap/add.js index b43b45a298..eda65fca1f 100644 --- a/packages/ipfs-cli/src/commands/bootstrap/add.js +++ b/packages/ipfs-cli/src/commands/bootstrap/add.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'add []', diff --git a/packages/ipfs-cli/src/commands/bootstrap/list.js b/packages/ipfs-cli/src/commands/bootstrap/list.js index 6a5342e8dc..f4660867f3 100644 --- a/packages/ipfs-cli/src/commands/bootstrap/list.js +++ b/packages/ipfs-cli/src/commands/bootstrap/list.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'list', diff --git a/packages/ipfs-cli/src/commands/bootstrap/rm.js b/packages/ipfs-cli/src/commands/bootstrap/rm.js index 0b3d59e3e8..72a691cc5b 100644 --- a/packages/ipfs-cli/src/commands/bootstrap/rm.js +++ b/packages/ipfs-cli/src/commands/bootstrap/rm.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'rm []', diff --git a/packages/ipfs-cli/src/commands/cat.js b/packages/ipfs-cli/src/commands/cat.js index 2465182ffb..03eb51d745 100644 --- a/packages/ipfs-cli/src/commands/cat.js +++ b/packages/ipfs-cli/src/commands/cat.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'cat ', diff --git a/packages/ipfs-cli/src/commands/config.js b/packages/ipfs-cli/src/commands/config.js index fc9514dad3..7d557dc450 100644 --- a/packages/ipfs-cli/src/commands/config.js +++ b/packages/ipfs-cli/src/commands/config.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'config [value]', diff --git a/packages/ipfs-cli/src/commands/config/profile/apply.js b/packages/ipfs-cli/src/commands/config/profile/apply.js index 38d6882a74..c90458af1b 100644 --- a/packages/ipfs-cli/src/commands/config/profile/apply.js +++ b/packages/ipfs-cli/src/commands/config/profile/apply.js @@ -1,7 +1,7 @@ 'use strict' const JSONDiff = require('jsondiffpatch') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'apply ', diff --git a/packages/ipfs-cli/src/commands/config/profile/ls.js b/packages/ipfs-cli/src/commands/config/profile/ls.js index 1ed768e99e..b5490f34fc 100644 --- a/packages/ipfs-cli/src/commands/config/profile/ls.js +++ b/packages/ipfs-cli/src/commands/config/profile/ls.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'ls', diff --git a/packages/ipfs-cli/src/commands/config/replace.js b/packages/ipfs-cli/src/commands/config/replace.js index 4fd5ea956e..5e39099e92 100644 --- a/packages/ipfs-cli/src/commands/config/replace.js +++ b/packages/ipfs-cli/src/commands/config/replace.js @@ -2,7 +2,7 @@ const path = require('path') const fs = require('fs') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'replace ', @@ -20,7 +20,8 @@ module.exports = { const filePath = path.resolve(process.cwd(), file) const config = isDaemon - ? filePath : JSON.parse(fs.readFileSync(filePath, 'utf8')) + ? filePath + : JSON.parse(fs.readFileSync(filePath, 'utf8')) return ipfs.config.replace(config, { timeout diff --git a/packages/ipfs-cli/src/commands/config/show.js b/packages/ipfs-cli/src/commands/config/show.js index ef79a61741..4c9614ca4b 100644 --- a/packages/ipfs-cli/src/commands/config/show.js +++ b/packages/ipfs-cli/src/commands/config/show.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'show', diff --git a/packages/ipfs-cli/src/commands/dag/get.js b/packages/ipfs-cli/src/commands/dag/get.js index 06a5fa6371..92f1cdf10b 100644 --- a/packages/ipfs-cli/src/commands/dag/get.js +++ b/packages/ipfs-cli/src/commands/dag/get.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const toCidAndPath = require('ipfs-core-utils/src/to-cid-and-path') const uint8ArrayToString = require('uint8arrays/to-string') const { cidToString } = require('ipfs-core-utils/src/cid') diff --git a/packages/ipfs-cli/src/commands/dag/put.js b/packages/ipfs-cli/src/commands/dag/put.js index 1bcabfbd91..40aa9629e6 100644 --- a/packages/ipfs-cli/src/commands/dag/put.js +++ b/packages/ipfs-cli/src/commands/dag/put.js @@ -7,7 +7,7 @@ const dagPB = require('ipld-dag-pb') const concat = require('it-concat') const CID = require('cids') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const uint8ArrayToString = require('uint8arrays/to-string') const inputDecoders = { diff --git a/packages/ipfs-cli/src/commands/dag/resolve.js b/packages/ipfs-cli/src/commands/dag/resolve.js index 5433893b85..2bec53ab52 100644 --- a/packages/ipfs-cli/src/commands/dag/resolve.js +++ b/packages/ipfs-cli/src/commands/dag/resolve.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'resolve ', diff --git a/packages/ipfs-cli/src/commands/dht/find-peer.js b/packages/ipfs-cli/src/commands/dht/find-peer.js index 6151e5b936..1aa6e8afd9 100644 --- a/packages/ipfs-cli/src/commands/dht/find-peer.js +++ b/packages/ipfs-cli/src/commands/dht/find-peer.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'findpeer ', diff --git a/packages/ipfs-cli/src/commands/dht/find-providers.js b/packages/ipfs-cli/src/commands/dht/find-providers.js index 79ebce2b87..a51d8fa3f8 100644 --- a/packages/ipfs-cli/src/commands/dht/find-providers.js +++ b/packages/ipfs-cli/src/commands/dht/find-providers.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'findprovs ', diff --git a/packages/ipfs-cli/src/commands/dht/get.js b/packages/ipfs-cli/src/commands/dht/get.js index 0fd90f3009..2e146f938b 100644 --- a/packages/ipfs-cli/src/commands/dht/get.js +++ b/packages/ipfs-cli/src/commands/dht/get.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'get ', diff --git a/packages/ipfs-cli/src/commands/dht/provide.js b/packages/ipfs-cli/src/commands/dht/provide.js index 31d20dcd41..2a9314dfd7 100644 --- a/packages/ipfs-cli/src/commands/dht/provide.js +++ b/packages/ipfs-cli/src/commands/dht/provide.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'provide ', diff --git a/packages/ipfs-cli/src/commands/dht/put.js b/packages/ipfs-cli/src/commands/dht/put.js index da3b2624e6..fb62c783c2 100644 --- a/packages/ipfs-cli/src/commands/dht/put.js +++ b/packages/ipfs-cli/src/commands/dht/put.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'put ', diff --git a/packages/ipfs-cli/src/commands/dht/query.js b/packages/ipfs-cli/src/commands/dht/query.js index a0cef2a411..6bc9c6ab26 100644 --- a/packages/ipfs-cli/src/commands/dht/query.js +++ b/packages/ipfs-cli/src/commands/dht/query.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'query ', diff --git a/packages/ipfs-cli/src/commands/dns.js b/packages/ipfs-cli/src/commands/dns.js index 99461032a2..ac70670b0c 100644 --- a/packages/ipfs-cli/src/commands/dns.js +++ b/packages/ipfs-cli/src/commands/dns.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../utils') diff --git a/packages/ipfs-cli/src/commands/files/chmod.js b/packages/ipfs-cli/src/commands/files/chmod.js index 6baddde91a..7cc3959c08 100644 --- a/packages/ipfs-cli/src/commands/files/chmod.js +++ b/packages/ipfs-cli/src/commands/files/chmod.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'chmod [mode] [path]', diff --git a/packages/ipfs-cli/src/commands/files/cp.js b/packages/ipfs-cli/src/commands/files/cp.js index 77c9a2f595..080ec0faef 100644 --- a/packages/ipfs-cli/src/commands/files/cp.js +++ b/packages/ipfs-cli/src/commands/files/cp.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'cp ', diff --git a/packages/ipfs-cli/src/commands/files/flush.js b/packages/ipfs-cli/src/commands/files/flush.js index 89915e9e35..856bd9eabe 100644 --- a/packages/ipfs-cli/src/commands/files/flush.js +++ b/packages/ipfs-cli/src/commands/files/flush.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'flush [path]', diff --git a/packages/ipfs-cli/src/commands/files/ls.js b/packages/ipfs-cli/src/commands/files/ls.js index ea4a668bde..1c399c0a0a 100644 --- a/packages/ipfs-cli/src/commands/files/ls.js +++ b/packages/ipfs-cli/src/commands/files/ls.js @@ -6,7 +6,7 @@ const { } = require('../../utils') const formatMode = require('ipfs-core-utils/src/files/format-mode') const formatMtime = require('ipfs-core-utils/src/files/format-mtime') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'ls [path]', diff --git a/packages/ipfs-cli/src/commands/files/mkdir.js b/packages/ipfs-cli/src/commands/files/mkdir.js index def58ed781..3dcfa25c2f 100644 --- a/packages/ipfs-cli/src/commands/files/mkdir.js +++ b/packages/ipfs-cli/src/commands/files/mkdir.js @@ -7,7 +7,7 @@ const { coerceMtime, coerceMtimeNsecs } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'mkdir ', diff --git a/packages/ipfs-cli/src/commands/files/mv.js b/packages/ipfs-cli/src/commands/files/mv.js index 9f6fa2957d..c9134ad852 100644 --- a/packages/ipfs-cli/src/commands/files/mv.js +++ b/packages/ipfs-cli/src/commands/files/mv.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'mv ', diff --git a/packages/ipfs-cli/src/commands/files/read.js b/packages/ipfs-cli/src/commands/files/read.js index 7e44484a80..eff2776ab0 100644 --- a/packages/ipfs-cli/src/commands/files/read.js +++ b/packages/ipfs-cli/src/commands/files/read.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'read ', diff --git a/packages/ipfs-cli/src/commands/files/rm.js b/packages/ipfs-cli/src/commands/files/rm.js index 6a13f51666..fee89655ec 100644 --- a/packages/ipfs-cli/src/commands/files/rm.js +++ b/packages/ipfs-cli/src/commands/files/rm.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'rm ', diff --git a/packages/ipfs-cli/src/commands/files/stat.js b/packages/ipfs-cli/src/commands/files/stat.js index 177d6c8a13..e1833882c3 100644 --- a/packages/ipfs-cli/src/commands/files/stat.js +++ b/packages/ipfs-cli/src/commands/files/stat.js @@ -5,7 +5,7 @@ const { } = require('../../utils') const formatMode = require('ipfs-core-utils/src/files/format-mode') const formatMtime = require('ipfs-core-utils/src/files/format-mtime') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'stat [path]', diff --git a/packages/ipfs-cli/src/commands/files/touch.js b/packages/ipfs-cli/src/commands/files/touch.js index 1ac5de6560..d311a7f4f4 100644 --- a/packages/ipfs-cli/src/commands/files/touch.js +++ b/packages/ipfs-cli/src/commands/files/touch.js @@ -6,7 +6,7 @@ const { coerceMtime, coerceMtimeNsecs } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'touch [path]', diff --git a/packages/ipfs-cli/src/commands/files/write.js b/packages/ipfs-cli/src/commands/files/write.js index 054c2126b1..7cca614770 100644 --- a/packages/ipfs-cli/src/commands/files/write.js +++ b/packages/ipfs-cli/src/commands/files/write.js @@ -7,7 +7,7 @@ const { coerceMtime, coerceMtimeNsecs } = require('../../utils') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'write ', diff --git a/packages/ipfs-cli/src/commands/get.js b/packages/ipfs-cli/src/commands/get.js index eca186aa2e..db703b19b6 100644 --- a/packages/ipfs-cli/src/commands/get.js +++ b/packages/ipfs-cli/src/commands/get.js @@ -5,7 +5,7 @@ const path = require('path') const toIterable = require('stream-to-it') const { pipe } = require('it-pipe') const { map } = require('streaming-iterables') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../utils') diff --git a/packages/ipfs-cli/src/commands/id.js b/packages/ipfs-cli/src/commands/id.js index b4868227a2..56cb71a638 100644 --- a/packages/ipfs-cli/src/commands/id.js +++ b/packages/ipfs-cli/src/commands/id.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'id', diff --git a/packages/ipfs-cli/src/commands/key/export.js b/packages/ipfs-cli/src/commands/key/export.js index 1c43877318..203fba92cd 100644 --- a/packages/ipfs-cli/src/commands/key/export.js +++ b/packages/ipfs-cli/src/commands/key/export.js @@ -1,7 +1,7 @@ 'use strict' const fs = require('fs') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'export ', diff --git a/packages/ipfs-cli/src/commands/key/gen.js b/packages/ipfs-cli/src/commands/key/gen.js index 6b43444563..f57ec66a88 100644 --- a/packages/ipfs-cli/src/commands/key/gen.js +++ b/packages/ipfs-cli/src/commands/key/gen.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../utils') diff --git a/packages/ipfs-cli/src/commands/key/import.js b/packages/ipfs-cli/src/commands/key/import.js index 7cbc6a0e21..f71a9a8903 100644 --- a/packages/ipfs-cli/src/commands/key/import.js +++ b/packages/ipfs-cli/src/commands/key/import.js @@ -1,7 +1,7 @@ 'use strict' const fs = require('fs') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'import ', diff --git a/packages/ipfs-cli/src/commands/key/list.js b/packages/ipfs-cli/src/commands/key/list.js index 5a946d5932..e07e0ac615 100644 --- a/packages/ipfs-cli/src/commands/key/list.js +++ b/packages/ipfs-cli/src/commands/key/list.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../utils') diff --git a/packages/ipfs-cli/src/commands/key/rename.js b/packages/ipfs-cli/src/commands/key/rename.js index 11c293790f..4b3bc8bc0e 100644 --- a/packages/ipfs-cli/src/commands/key/rename.js +++ b/packages/ipfs-cli/src/commands/key/rename.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../utils') diff --git a/packages/ipfs-cli/src/commands/key/rm.js b/packages/ipfs-cli/src/commands/key/rm.js index 08d155e4d1..b9de77ae45 100644 --- a/packages/ipfs-cli/src/commands/key/rm.js +++ b/packages/ipfs-cli/src/commands/key/rm.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../utils') diff --git a/packages/ipfs-cli/src/commands/ls.js b/packages/ipfs-cli/src/commands/ls.js index ce0c661cbf..032bdbce41 100644 --- a/packages/ipfs-cli/src/commands/ls.js +++ b/packages/ipfs-cli/src/commands/ls.js @@ -5,7 +5,7 @@ const { rightpad, stripControlCharacters } = require('../utils') const { cidToString } = require('ipfs-core-utils/src/cid') const formatMode = require('ipfs-core-utils/src/files/format-mode') const formatMtime = require('ipfs-core-utils/src/files/format-mtime') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'ls ', diff --git a/packages/ipfs-cli/src/commands/name/publish.js b/packages/ipfs-cli/src/commands/name/publish.js index f163b3f7f6..4a1f377823 100644 --- a/packages/ipfs-cli/src/commands/name/publish.js +++ b/packages/ipfs-cli/src/commands/name/publish.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../utils') diff --git a/packages/ipfs-cli/src/commands/name/pubsub/cancel.js b/packages/ipfs-cli/src/commands/name/pubsub/cancel.js index fc874e7770..335e8beb51 100644 --- a/packages/ipfs-cli/src/commands/name/pubsub/cancel.js +++ b/packages/ipfs-cli/src/commands/name/pubsub/cancel.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'cancel ', diff --git a/packages/ipfs-cli/src/commands/name/pubsub/state.js b/packages/ipfs-cli/src/commands/name/pubsub/state.js index 14d73a63ac..f864b42dc7 100644 --- a/packages/ipfs-cli/src/commands/name/pubsub/state.js +++ b/packages/ipfs-cli/src/commands/name/pubsub/state.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'state', diff --git a/packages/ipfs-cli/src/commands/name/pubsub/subs.js b/packages/ipfs-cli/src/commands/name/pubsub/subs.js index 22ca105a48..60d05bf6e1 100644 --- a/packages/ipfs-cli/src/commands/name/pubsub/subs.js +++ b/packages/ipfs-cli/src/commands/name/pubsub/subs.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../../utils') diff --git a/packages/ipfs-cli/src/commands/name/resolve.js b/packages/ipfs-cli/src/commands/name/resolve.js index e0fc274865..797874a3b5 100644 --- a/packages/ipfs-cli/src/commands/name/resolve.js +++ b/packages/ipfs-cli/src/commands/name/resolve.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'resolve []', diff --git a/packages/ipfs-cli/src/commands/object/data.js b/packages/ipfs-cli/src/commands/object/data.js index 48aee8038c..36a5da2715 100644 --- a/packages/ipfs-cli/src/commands/object/data.js +++ b/packages/ipfs-cli/src/commands/object/data.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'data ', diff --git a/packages/ipfs-cli/src/commands/object/get.js b/packages/ipfs-cli/src/commands/object/get.js index e6c000517d..7ded234cdd 100644 --- a/packages/ipfs-cli/src/commands/object/get.js +++ b/packages/ipfs-cli/src/commands/object/get.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const uint8ArrayToString = require('uint8arrays/to-string') const { stripControlCharacters diff --git a/packages/ipfs-cli/src/commands/object/links.js b/packages/ipfs-cli/src/commands/object/links.js index ae86b852a2..c24e18d93e 100644 --- a/packages/ipfs-cli/src/commands/object/links.js +++ b/packages/ipfs-cli/src/commands/object/links.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') const { stripControlCharacters } = require('../../utils') diff --git a/packages/ipfs-cli/src/commands/object/new.js b/packages/ipfs-cli/src/commands/object/new.js index 89c2833d11..2a10f093c9 100644 --- a/packages/ipfs-cli/src/commands/object/new.js +++ b/packages/ipfs-cli/src/commands/object/new.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('ipfs-core-utils/src/cid') -const parseDuration = require('parse-duration').default +const { default: parseDuration } = require('parse-duration') module.exports = { command: 'new [