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

Commit a418a52

Browse files
authored
chore: upgrade deps with new typedefs (#3550)
Upgrades to new version with types - 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 - Switches to named exports BREAKING CHANGE: all core api methods now have types, some method signatures have changed, named exports are now used by the http, grpc and ipfs client modules
1 parent a192944 commit a418a52

File tree

689 files changed

+10773
-7815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

689 files changed

+10773
-7815
lines changed

.github/workflows/bundlesize.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ jobs:
1010
runs-on: ubuntu-latest # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
1111
strategy:
1212
matrix:
13+
node-version: [15.x]
1314
project:
14-
- packages/ipfs-core-utils
15+
- packages/ipfs
1516
- packages/ipfs-core
17+
- packages/ipfs-client
18+
- packages/ipfs-grpc-client
1619
- packages/ipfs-http-client
17-
- packages/ipfs
1820
- packages/ipfs-message-port-client
1921
steps:
2022
- uses: actions/checkout@v2
21-
- run: npm install
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
- uses: actions/checkout@v2
28+
- run: npm install -g @mapbox/node-pre-gyp && npm install
2229
- name: Bundlesize ${{ matrix.project }}
23-
uses: ipfs/aegir/actions/bundle-size@v31.0.4
30+
uses: ipfs/aegir/actions/bundle-size@v32.1.0
2431
with:
2532
project: ${{ matrix.project }}
2633
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/typecheck.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ jobs:
1111
matrix:
1212
node-version: [14.x]
1313
project:
14-
- packages/ipfs-core-utils
15-
- packages/ipfs-core
16-
- packages/ipfs-http-client
1714
- packages/ipfs
1815
- packages/ipfs-cli
19-
- packages/ipfs-http-server
16+
- packages/ipfs-client
17+
- packages/ipfs-core
18+
- packages/ipfs-core-types
19+
- packages/ipfs-core-utils
20+
- packages/ipfs-daemon
21+
- packages/ipfs-grpc-client
22+
- packages/ipfs-grpc-server
23+
- packages/ipfs-http-client
2024
- packages/ipfs-http-gateway
25+
- packages/ipfs-http-server
26+
- packages/ipfs-message-port-client
2127
- packages/ipfs-message-port-protocol
2228
- packages/ipfs-message-port-server
23-
- packages/ipfs-message-port-client
2429
steps:
2530
- uses: actions/checkout@v2
2631
- name: Use Node.js ${{ matrix.node-version }}
@@ -29,6 +34,8 @@ jobs:
2934
node-version: ${{ matrix.node-version }}
3035
- name: Install dependencies
3136
run: npm install
37+
- name: Build types
38+
run: npm run build
3239
- name: Typecheck ${{ matrix.project }}
3340
uses: gozala/[email protected]
3441
with:

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ coverage
1111
tests_output
1212
cache
1313
.cache
14+
.parcel-cache
1415

1516
# Dependency directory
1617
node_modules
@@ -19,6 +20,8 @@ node_modules
1920
dist
2021
build
2122
bundle.js
23+
tsconfig-types.aegir.json
24+
.tsbuildinfo
2225

2326
# Deployment files
2427
.npmrc

.travis.yml

+29-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
language: node_js
22
dist: bionic
33

4+
cache:
5+
# https://travis-ci.community/t/npm-cache-on-windows-supplies-incorrect-dependency-versions/11335
6+
npm: false
7+
48
services:
59
- xvfb
610

@@ -32,27 +36,27 @@ env:
3236
addons:
3337
apt:
3438
packages:
35-
# These are required to run webkit
36-
- libwoff1
37-
- libopus0
38-
- libwebp6
39-
- libwebpdemux2
40-
- libenchant1c2a
41-
- libgudev-1.0-0
42-
- libsecret-1-0
43-
- libhyphen0
44-
- libgdk-pixbuf2.0-0
45-
- libegl1
46-
- libgles2
47-
- libevent-2.1-6
48-
- libnotify4
49-
- libxslt1.1
50-
- libvpx5
51-
# gstreamer and plugins to support video playback in WebKit.
52-
- gstreamer1.0-gl
53-
- gstreamer1.0-plugins-base
54-
- gstreamer1.0-plugins-good
55-
- gstreamer1.0-plugins-bad
39+
# # These are required to run webkit
40+
# - libwoff1
41+
# - libopus0
42+
# - libwebp6
43+
# - libwebpdemux2
44+
# - libenchant1c2a
45+
# - libgudev-1.0-0
46+
# - libsecret-1-0
47+
# - libhyphen0
48+
# - libgdk-pixbuf2.0-0
49+
# - libegl1
50+
# - libgles2
51+
# - libevent-2.1-6
52+
# - libnotify4
53+
# - libxslt1.1
54+
# - libvpx5
55+
# # gstreamer and plugins to support video playback in WebKit.
56+
# - gstreamer1.0-gl
57+
# - gstreamer1.0-plugins-base
58+
# - gstreamer1.0-plugins-good
59+
# - gstreamer1.0-plugins-bad
5660
# This is required to run chromium
5761
- libgbm1
5862
chrome: stable
@@ -165,10 +169,10 @@ jobs:
165169
script:
166170
- npm run test:interface:core -- $RUN_SINCE -- -- --bail -t browser -- --browser firefox
167171

168-
- stage: test
169-
name: js-ipfs interface tests - firefox webworker
170-
script:
171-
- npm run test:interface:core -- $RUN_SINCE -- -- --bail -t webworker --timeout 60000 -- --browser firefox
172+
#- stage: test
173+
# name: js-ipfs interface tests - firefox webworker
174+
# script:
175+
# - npm run test:interface:core -- $RUN_SINCE -- -- --bail -t webworker --timeout 60000 -- --browser firefox
172176

173177
- stage: test
174178
name: js-ipfs interface tests - electron main

docs/core-api/BITSWAP.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ The returned object contains the following keys:
160160
- `provideBufLen` is an integer.
161161
- `wantlist` (array of [CID][cid]s)
162162
- `peers` (array of peer IDs represented by CIDs)
163-
- `blocksReceived` is a [BigNumber Int][1]
164-
- `dataReceived` is a [BigNumber Int][1]
165-
- `blocksSent` is a [BigNumber Int][1]
166-
- `dataSent` is a [BigNumber Int][1]
167-
- `dupBlksReceived` is a [BigNumber Int][1]
168-
- `dupDataReceived` is a [BigNumber Int][1]
163+
- `blocksReceived` is a [BigInt][1]
164+
- `dataReceived` is a [BigInt][1]
165+
- `blocksSent` is a [BigInt][1]
166+
- `dataSent` is a [BigInt][1]
167+
- `dupBlksReceived` is a [BigInt][1]
168+
- `dupDataReceived` is a [BigInt][1]
169169

170170
### Example
171171

@@ -190,7 +190,7 @@ console.log(stats)
190190

191191
A great source of [examples][] can be found in the tests for this API.
192192

193-
[1]: https://github.com/MikeMcl/bignumber.js/
193+
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
194194
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/bitswap
195195
[cid]: https://www.npmjs.com/package/cids
196196
[peerid]: https://www.npmjs.com/package/peer-id

docs/core-api/FILES.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ _Explore the Mutable File System through interactive coding challenges in our [P
6565
- [Options](#options-9)
6666
- [Returns](#returns-9)
6767
- [Example](#example-9)
68-
- [`ipfs.files.rm(...paths, [options])`](#ipfsfilesrmpaths-options)
68+
- [`ipfs.files.rm(path, [options])`](#ipfsfilesrmpath-options)
6969
- [Parameters](#parameters-10)
7070
- [Options](#options-10)
7171
- [Returns](#returns-10)
@@ -637,7 +637,7 @@ await ipfs.files.cp('/src-file', '/dst-file')
637637
await ipfs.files.cp('/src-dir', '/dst-dir')
638638

639639
// To copy multiple files to a directory
640-
await ipfs.files.cp('/src-file1', '/src-file2', '/dst-dir')
640+
await ipfs.files.cp(['/src-file1', '/src-file2'], '/dst-dir')
641641
```
642642

643643
#### Notes
@@ -784,7 +784,7 @@ await ipfs.files.touch('/path/to/file.txt', {
784784
})
785785
```
786786

787-
### `ipfs.files.rm(...paths, [options])`
787+
### `ipfs.files.rm(path, [options])`
788788

789789
> Remove a file or directory.
790790
@@ -820,7 +820,7 @@ An optional object which may have the following keys:
820820
await ipfs.files.rm('/my/beautiful/file.txt')
821821

822822
// To remove multiple files
823-
await ipfs.files.rm('/my/beautiful/file.txt', '/my/other/file.txt')
823+
await ipfs.files.rm(['/my/beautiful/file.txt', '/my/other/file.txt'])
824824

825825
// To remove a directory
826826
await ipfs.files.rm('/my/beautiful/directory', { recursive: true })
@@ -946,7 +946,7 @@ await ipfs.files.mv('/src-file', '/dst-file')
946946

947947
await ipfs.files.mv('/src-dir', '/dst-dir')
948948

949-
await ipfs.files.mv('/src-file1', '/src-file2', '/dst-dir')
949+
await ipfs.files.mv(['/src-file1', '/src-file2'], '/dst-dir')
950950
```
951951

952952
#### Notes

docs/core-api/REPO.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ An optional object which may have the following keys:
8080

8181
the returned object has the following keys:
8282

83-
- `numObjects` is a [BigNumber Int][1].
84-
- `repoSize` is a [BigNumber Int][1], in bytes.
83+
- `numObjects` is a [BigInt][1].
84+
- `repoSize` is a [BigInt][1], in bytes.
8585
- `repoPath` is a string.
8686
- `version` is a string.
87-
- `storageMax` is a [BigNumber Int][1].
87+
- `storageMax` is a [BigInt][1].
8888

8989
### Example
9090

@@ -135,6 +135,6 @@ console.log(version)
135135
// "6"
136136
```
137137

138-
[1]: https://github.com/MikeMcl/bignumber.js/
138+
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
139139
[cid]: https://www.npmjs.com/package/cids
140140
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

docs/core-api/STATS.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ An optional object which may have the following keys:
4949

5050
Each yielded object contains the following keys:
5151

52-
- `totalIn` - is a [BigNumber Int][bigNumber], in bytes.
53-
- `totalOut` - is a [BigNumber Int][bigNumber], in bytes.
54-
- `rateIn` - is a [BigNumber Int][bigNumber], in bytes.
55-
- `rateOut` - is a [BigNumber Int][bigNumber], in bytes.
52+
- `totalIn` - is a [BigInt][bigNumber], in bytes.
53+
- `totalOut` - is a [BigInt][bigNumber], in bytes.
54+
- `rateIn` - is a [BigInt][bigNumber], in bytes.
55+
- `rateOut` - is a [BigInt][bigNumber], in bytes.
5656

5757
### Example
5858

5959
```JavaScript
6060
for await (const stats of ipfs.stats.bw()) {
6161
console.log(stats)
6262
}
63-
// { totalIn: BigNumber {...},
64-
// totalOut: BigNumber {...},
65-
// rateIn: BigNumber {...},
66-
// rateOut: BigNumber {...} }
63+
// { totalIn: BigInt {...},
64+
// totalOut: BigInt {...},
65+
// rateIn: BigInt {...},
66+
// rateOut: BigInt {...} }
6767
```
6868

6969
A great source of [examples][] can be found in the tests for this API.
7070

71-
[bigNumber]: https://github.com/MikeMcl/bignumber.js/
71+
[bigNumber]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
7272
[examples]: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/stats
7373
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
7474
[cid]: https://www.npmjs.com/package/cids

examples/browser-browserify/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', async () => {
2525
async function display (cid) {
2626
for await (const data of node.cat(cid)) {
2727
document.getElementById('cid').innerText = cid
28-
document.getElementById('content').innerText = data
28+
document.getElementById('content').innerText = new TextDecoder().decode(data)
2929
document.getElementById('output').setAttribute('style', 'display: block')
3030
}
3131
}

examples/browser-create-react-app/package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ipfs-css": "^0.13.1",
99
"react": "^16.8.6",
1010
"react-dom": "^16.8.6",
11-
"react-scripts": "^3.2.0",
11+
"react-scripts": "^4.0.3",
1212
"tachyons": "^4.11.1"
1313
},
1414
"devDependencies": {
@@ -26,9 +26,6 @@
2626
"extends": "react-app"
2727
},
2828
"browserslist": [
29-
">0.2%",
30-
"not dead",
31-
"not ie <= 11",
32-
"not op_mini all"
29+
"last 2 versions and not dead and > 2%"
3330
]
3431
}

examples/browser-http-client-upload-file/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"scripts": {
77
"clean": "rimraf ./dist",
8-
"build": "parcel build index.html --public-url '.'",
8+
"build": "parcel build index.html --no-scope-hoist",
99
"start": "parcel index.html",
1010
"test": "test-ipfs-example"
1111
},
@@ -19,7 +19,7 @@
1919
},
2020
"devDependencies": {
2121
"ipfs": "^0.54.4",
22-
"parcel-bundler": "^1.12.4",
22+
"parcel": "next",
2323
"react": "^16.8.6",
2424
"react-dom": "^16.8.6",
2525
"rimraf": "^3.0.2",

examples/browser-http-client-upload-file/src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict'
33

44
const React = require('react')
5-
const ipfsClient = require('ipfs-http-client')
5+
const { create: ipfsClient } = require('ipfs-http-client')
66

77
class App extends React.Component {
88
constructor () {

examples/browser-ipns-publish/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"main": "index.js",
77
"scripts": {
8-
"build": "parcel build index.html --public-url ./",
8+
"build": "parcel build index.html --no-scope-hoist",
99
"start": "parcel index.html",
1010
"test": "test-ipfs-example"
1111
},
@@ -15,8 +15,8 @@
1515
"human-crypto-keys": "^0.1.4",
1616
"ipfs": "^0.54.4",
1717
"ipfs-http-client": "^49.0.4",
18-
"ipfs-utils": "^6.0.1",
19-
"ipns": "^0.8.0",
18+
"ipfs-utils": "^6.0.4",
19+
"ipns": "^0.10.0",
2020
"it-last": "^1.0.4",
2121
"p-retry": "^4.2.0",
2222
"uint8arrays": "^2.1.3"
@@ -27,9 +27,9 @@
2727
"devDependencies": {
2828
"delay": "^4.4.0",
2929
"execa": "^5.0.0",
30-
"ipfsd-ctl": "^7.2.0",
30+
"ipfsd-ctl": "^8.0.0",
3131
"go-ipfs": "0.8.0",
32-
"parcel-bundler": "^1.12.4",
32+
"parcel": "next",
3333
"path": "^0.12.7",
3434
"test-ipfs-example": "^3.0.0"
3535
},

examples/browser-mfs/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"author": "",
1414
"license": "ISC",
1515
"devDependencies": {
16-
"html-webpack-plugin": "^3.2.0",
16+
"html-webpack-plugin": "^5.3.1",
1717
"http-server": "^0.12.3",
18+
"node-polyfill-webpack-plugin": "^1.0.3",
1819
"rimraf": "^3.0.2",
19-
"terser-webpack-plugin": "^1.2.1",
2020
"test-ipfs-example": "^3.0.0",
21-
"webpack": "^4.43.0",
22-
"webpack-cli": "^3.3.11"
21+
"webpack": "^5.28.0",
22+
"webpack-cli": "^4.5.0"
2323
},
2424
"dependencies": {
2525
"ipfs": "^0.54.4",

0 commit comments

Comments
 (0)