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

Commit df7e158

Browse files
committed
chore: upgrade all deps to typed versions
- 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
1 parent c47a633 commit df7e158

File tree

679 files changed

+10685
-7658
lines changed

Some content is hidden

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

679 files changed

+10685
-7658
lines changed

.github/workflows/bundlesize.yml

Lines changed: 11 additions & 4 deletions
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

Lines changed: 12 additions & 5 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 25 additions & 21 deletions
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

docs/core-api/FILES.md

Lines changed: 5 additions & 5 deletions
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

examples/browser-browserify/src/index.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 5 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 4 additions & 4 deletions
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",
Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,33 @@
11
'use strict'
22

33
const path = require('path')
4-
const TerserPlugin = require('terser-webpack-plugin')
4+
const webpack = require('webpack')
5+
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
56
const HtmlWebpackPlugin = require('html-webpack-plugin')
67

78
module.exports = {
8-
mode: 'development',
9-
devtool: 'source-map',
9+
devtool: 'eval',
1010
entry: [
1111
'./index.js'
1212
],
13+
output: {
14+
path: path.join(__dirname, 'dist'),
15+
filename: 'bundle.js'
16+
},
1317
plugins: [
1418
new HtmlWebpackPlugin({
1519
title: 'IPFS MFS example',
1620
template: 'index.html'
21+
}),
22+
// fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib'
23+
new NodePolyfillPlugin(),
24+
// Note: stream-browserify has assumption about `Buffer` global in its
25+
// dependencies causing runtime errors. This is a workaround to provide
26+
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
27+
// is fixed.
28+
new webpack.ProvidePlugin({
29+
Buffer: ['buffer', 'Buffer'],
30+
process: 'process/browser'
1731
})
18-
],
19-
optimization: {
20-
minimizer: [
21-
new TerserPlugin({
22-
terserOptions: {
23-
parse: {
24-
// we want terser to parse ecma 8 code. However, we don't want it
25-
// to apply any minfication steps that turns valid ecma 5 code
26-
// into invalid ecma 5 code. This is why the 'compress' and 'output'
27-
// sections only apply transformations that are ecma 5 safe
28-
// https://github.com/facebook/create-react-app/pull/4234
29-
ecma: 8
30-
},
31-
compress: {
32-
ecma: 5,
33-
warnings: false
34-
},
35-
mangle: {
36-
safari10: true
37-
},
38-
output: {
39-
ecma: 5,
40-
comments: false
41-
}
42-
},
43-
// Use multi-process parallel running to improve the build speed
44-
// Default number of concurrent runs: os.cpus().length - 1
45-
parallel: true,
46-
// Enable file caching
47-
cache: true,
48-
sourceMap: true
49-
})
50-
]
51-
},
52-
output: {
53-
path: path.join(__dirname, 'dist'),
54-
filename: 'bundle.js'
55-
},
56-
node: {
57-
fs: 'empty'
58-
}
32+
]
5933
}

examples/browser-parceljs/.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)