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

Commit

Permalink
chore: upgrade all deps to typed versions
Browse files Browse the repository at this point in the history
- Uses default aegir ts config
- Fixes all ts errors
- Fully types core-api in ipfs-core-types package
- Makes ipfs-core implement types from ipfs-core-types package
- Removes duplicate types, ipfs-core-types as single source of type truth
- Reduces use of external APIs by internal components in ipfs-core
  • Loading branch information
achingbrain committed Mar 13, 2021
1 parent c47a633 commit e443160
Show file tree
Hide file tree
Showing 245 changed files with 4,362 additions and 4,497 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ node_modules
dist
build
bundle.js
tsconfig-types.aegir.json

# Deployment files
.npmrc
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-browserify/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', async () => {
async function display (cid) {
for await (const data of node.cat(cid)) {
document.getElementById('cid').innerText = cid
document.getElementById('content').innerText = data
document.getElementById('content').innerText = new TextDecoder().decode(data)
document.getElementById('output').setAttribute('style', 'display: block')
}
}
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 @@ -16,7 +16,7 @@
"ipfs": "^0.54.4",
"ipfs-http-client": "^49.0.4",
"ipfs-utils": "^6.0.1",
"ipns": "^0.8.0",
"ipns": "^0.10.0",
"it-last": "^1.0.4",
"p-retry": "^4.2.0",
"uint8arrays": "^2.1.3"
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 @@ -12,7 +12,7 @@
"dependencies": {
"datastore-fs": "^2.0.0",
"ipfs": "^0.54.4",
"ipfs-repo": "^8.0.0",
"ipfs-repo": "^9.0.0",
"it-all": "^1.0.4"
},
"devDependencies": {
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 @@ -16,7 +16,7 @@
"cids": "^1.1.5",
"ipfs": "^0.54.4",
"ipld-block": "^0.11.0",
"ipld-dag-pb": "^0.20.0",
"ipld-dag-pb": "^0.22.0",
"ipld-git": "^0.6.1",
"ipld-ethereum": "^5.0.1",
"multihashing-async": "^2.1.2"
Expand Down
18 changes: 9 additions & 9 deletions packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0",
"cids": "^1.1.5",
"delay": "^4.4.0",
"delay": "^5.0.0",
"dirty-chai": "^2.0.1",
"err-code": "^2.0.3",
"ipfs-unixfs": "^2.0.3",
"ipfs-unixfs-importer": "^5.0.0",
"err-code": "^3.0.1",
"ipfs-unixfs": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs?fix/declare-interface-types-in-d-ts",
"ipfs-unixfs-importer": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs-importer?fix/declare-interface-types-in-d-ts",
"ipfs-utils": "^6.0.1",
"ipld-block": "^0.11.0",
"ipld-dag-cbor": "^0.17.0",
"ipld-dag-pb": "^0.20.0",
"ipns": "^0.8.0",
"is-ipfs": "^2.0.0",
"ipld-dag-cbor": "^0.18.0",
"ipld-dag-pb": "^0.22.0",
"ipns": "^0.10.0",
"is-ipfs": "^4.0.0",
"iso-random-stream": "^1.1.1",
"it-all": "^1.0.4",
"it-buffer-stream": "^1.0.5",
"it-buffer-stream": "^2.0.0",
"it-concat": "^1.0.1",
"it-drain": "^1.0.3",
"it-first": "^1.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const all = require('it-all')
const drain = require('it-drain')
const { getDescribe, getIt, expect } = require('./utils/mocha')
const testTimeout = require('./utils/test-timeout')
const importer = require('ipfs-unixfs-importer')
const { importer } = require('ipfs-unixfs-importer')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
/**
Expand Down
6 changes: 3 additions & 3 deletions packages/interface-ipfs-core/src/dag/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const uint8ArrayFromString = require('uint8arrays/from-string')
const dagPB = require('ipld-dag-pb')
const DAGNode = dagPB.DAGNode
const dagCBOR = require('ipld-dag-cbor')
const importer = require('ipfs-unixfs-importer')
const Unixfs = require('ipfs-unixfs')
const { importer } = require('ipfs-unixfs-importer')
const { UnixFS } = require('ipfs-unixfs')
const all = require('it-all')
const CID = require('cids')
const { getDescribe, getIt, expect } = require('../utils/mocha')
Expand Down Expand Up @@ -193,7 +193,7 @@ module.exports = (common, options) => {
const cidv0 = cidv1.toV0()

const output = await ipfs.dag.get(cidv0)
expect(Unixfs.unmarshal(output.value.Data).data).to.eql(input)
expect(UnixFS.unmarshal(output.value.Data).data).to.eql(input)
})

it('should be able to get part of a dag-cbor node', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/interface-ipfs-core/src/files/cp.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module.exports = (common, options) => {
await ipfs.files.write(src1, [], {
create: true
})

await expect(ipfs.files.cp(src1, `${parent}/child`)).to.eventually.be.rejectedWith(Error)
.that.has.property('message').that.matches(/"identity"/)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/files/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = (common, options) => {
})

const stat2 = await ipfs.files.stat(testPath)
expect(stat2).to.have.nested.deep.property('mtime', expectedMtime)
expect(stat2).to.have.deep.nested.property('mtime', expectedMtime)
}

before(async () => { ipfs = (await common.spawn()).api })
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const last = require('it-last')
const map = require('it-map')
const { getDescribe, getIt, expect } = require('./utils/mocha')
const testTimeout = require('./utils/test-timeout')
const importer = require('ipfs-unixfs-importer')
const { importer } = require('ipfs-unixfs-importer')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/interface-ipfs-core/src/object/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const dagPB = require('ipld-dag-pb')
const DAGNode = dagPB.DAGNode
const { nanoid } = require('nanoid')
const { getDescribe, getIt, expect } = require('../utils/mocha')
const UnixFs = require('ipfs-unixfs')
const { UnixFS } = require('ipfs-unixfs')
const randomBytes = require('iso-random-stream/src/random')
const { asDAGLink } = require('./utils')
const testTimeout = require('../utils/test-timeout')
Expand Down Expand Up @@ -147,7 +147,7 @@ module.exports = (common, options) => {
})

const node = await ipfs.object.get(result.cid)
const meta = UnixFs.unmarshal(node.Data)
const meta = UnixFS.unmarshal(node.Data)

expect(meta.fileSize()).to.equal(data.length)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/refs-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const { fixtures } = require('./utils')
const { getDescribe, getIt, expect } = require('./utils/mocha')
const all = require('it-all')
const importer = require('ipfs-unixfs-importer')
const { importer } = require('ipfs-unixfs-importer')
const drain = require('it-drain')
const testTimeout = require('./utils/test-timeout')
const CID = require('cids')
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const dagPB = require('ipld-dag-pb')
const DAGNode = dagPB.DAGNode
const DAGLink = dagPB.DAGLink

const UnixFS = require('ipfs-unixfs')
const { UnixFS } = require('ipfs-unixfs')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/src/utils/is-shard-at-path.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const UnixFS = require('ipfs-unixfs')
const { UnixFS } = require('ipfs-unixfs')

module.exports = async (path, ipfs) => {
const stats = await ipfs.files.stat(path)
Expand Down
8 changes: 4 additions & 4 deletions packages/ipfs-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"cid-tool": "^1.0.0",
"cids": "^1.1.5",
"debug": "^4.1.1",
"err-code": "^2.0.3",
"err-code": "^3.0.1",
"execa": "^5.0.0",
"get-folder-size": "^2.0.1",
"ipfs-core": "^0.5.4",
"ipfs-core-utils": "^0.7.2",
"ipfs-daemon": "^0.5.4",
"ipfs-http-client": "^49.0.4",
"ipfs-repo": "^8.0.0",
"ipfs-repo": "^9.0.0",
"ipfs-utils": "^6.0.1",
"ipld-dag-cbor": "^0.17.0",
"ipld-dag-pb": "^0.20.0",
"ipld-dag-cbor": "^0.18.0",
"ipld-dag-pb": "^0.22.0",
"it-all": "^1.0.4",
"it-concat": "^1.0.1",
"it-first": "^1.0.4",
Expand Down
5 changes: 3 additions & 2 deletions packages/ipfs-cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../node_modules/aegir/src/config/tsconfig.aegir.json",
"compilerOptions": {
"outDir": "dist"
"outDir": "dist",
"importsNotUsedAsValues": "preserve"
},
"include": [
"src",
Expand Down
13 changes: 7 additions & 6 deletions packages/ipfs-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"extends": "../../tsconfig.json",
"extends": "../../node_modules/aegir/src/config/tsconfig.aegir.json",
"compilerOptions": {
"outDir": "dist"
"outDir": "dist",
"importsNotUsedAsValues": "preserve"
},
"include": [
"src",
"package.json"
],
"references": [
{
"path": "../ipfs-http-client"
},
{
"path": "../ipfs-grpc-client"
}
],
"include": [
"src",
"package.json"
]
}
3 changes: 2 additions & 1 deletion packages/ipfs-core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.3.1",
"description": "IPFS interface definitions used by implementations for API compatibility.",
"leadMaintainer": "Alex Potsides <alex@achingbrain.net>",
"types": "src/index.ts",
"types": "src/index.d.ts",
"homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core#readme",
"bugs": "https://github.com/ipfs/js-ipfs/issues",
"scripts": {
Expand All @@ -30,6 +30,7 @@
"dependencies": {
"cids": "^1.1.5",
"multiaddr": "^8.0.0",
"multibase": "^4.0.2",
"peer-id": "^0.14.1"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit e443160

Please sign in to comment.