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 27, 2021
1 parent c47a633 commit df7e158
Show file tree
Hide file tree
Showing 679 changed files with 10,685 additions and 7,658 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/bundlesize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ jobs:
runs-on: ubuntu-latest # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
strategy:
matrix:
node-version: [15.x]
project:
- packages/ipfs-core-utils
- packages/ipfs
- packages/ipfs-core
- packages/ipfs-client
- packages/ipfs-grpc-client
- packages/ipfs-http-client
- packages/ipfs
- packages/ipfs-message-port-client
steps:
- uses: actions/checkout@v2
- run: npm install
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v2
- run: npm install -g @mapbox/node-pre-gyp && npm install
- name: Bundlesize ${{ matrix.project }}
uses: ipfs/aegir/actions/bundle-size@v31.0.4
uses: ipfs/aegir/actions/bundle-size@v32.1.0
with:
project: ${{ matrix.project }}
github_token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 12 additions & 5 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ jobs:
matrix:
node-version: [14.x]
project:
- packages/ipfs-core-utils
- packages/ipfs-core
- packages/ipfs-http-client
- packages/ipfs
- packages/ipfs-cli
- packages/ipfs-http-server
- packages/ipfs-client
- packages/ipfs-core
- packages/ipfs-core-types
- packages/ipfs-core-utils
- packages/ipfs-daemon
- packages/ipfs-grpc-client
- packages/ipfs-grpc-server
- packages/ipfs-http-client
- packages/ipfs-http-gateway
- packages/ipfs-http-server
- packages/ipfs-message-port-client
- packages/ipfs-message-port-protocol
- packages/ipfs-message-port-server
- packages/ipfs-message-port-client
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -29,6 +34,8 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Build types
run: npm run build
- name: Typecheck ${{ matrix.project }}
uses: gozala/typescript-error-reporter-action@v1.0.8
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ coverage
tests_output
cache
.cache
.parcel-cache

# Dependency directory
node_modules
Expand All @@ -19,6 +20,8 @@ node_modules
dist
build
bundle.js
tsconfig-types.aegir.json
.tsbuildinfo

# Deployment files
.npmrc
Expand Down
46 changes: 25 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
language: node_js
dist: bionic

cache:
# https://travis-ci.community/t/npm-cache-on-windows-supplies-incorrect-dependency-versions/11335
npm: false

services:
- xvfb

Expand Down Expand Up @@ -32,27 +36,27 @@ env:
addons:
apt:
packages:
# These are required to run webkit
- libwoff1
- libopus0
- libwebp6
- libwebpdemux2
- libenchant1c2a
- libgudev-1.0-0
- libsecret-1-0
- libhyphen0
- libgdk-pixbuf2.0-0
- libegl1
- libgles2
- libevent-2.1-6
- libnotify4
- libxslt1.1
- libvpx5
# gstreamer and plugins to support video playback in WebKit.
- gstreamer1.0-gl
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad
# # These are required to run webkit
# - libwoff1
# - libopus0
# - libwebp6
# - libwebpdemux2
# - libenchant1c2a
# - libgudev-1.0-0
# - libsecret-1-0
# - libhyphen0
# - libgdk-pixbuf2.0-0
# - libegl1
# - libgles2
# - libevent-2.1-6
# - libnotify4
# - libxslt1.1
# - libvpx5
# # gstreamer and plugins to support video playback in WebKit.
# - gstreamer1.0-gl
# - gstreamer1.0-plugins-base
# - gstreamer1.0-plugins-good
# - gstreamer1.0-plugins-bad
# This is required to run chromium
- libgbm1
chrome: stable
Expand Down
10 changes: 5 additions & 5 deletions docs/core-api/FILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ _Explore the Mutable File System through interactive coding challenges in our [P
- [Options](#options-9)
- [Returns](#returns-9)
- [Example](#example-9)
- [`ipfs.files.rm(...paths, [options])`](#ipfsfilesrmpaths-options)
- [`ipfs.files.rm(path, [options])`](#ipfsfilesrmpath-options)
- [Parameters](#parameters-10)
- [Options](#options-10)
- [Returns](#returns-10)
Expand Down Expand Up @@ -637,7 +637,7 @@ await ipfs.files.cp('/src-file', '/dst-file')
await ipfs.files.cp('/src-dir', '/dst-dir')

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

#### Notes
Expand Down Expand Up @@ -784,7 +784,7 @@ await ipfs.files.touch('/path/to/file.txt', {
})
```

### `ipfs.files.rm(...paths, [options])`
### `ipfs.files.rm(path, [options])`

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

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

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

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

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

#### Notes
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
7 changes: 2 additions & 5 deletions examples/browser-create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ipfs-css": "^0.13.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "^3.2.0",
"react-scripts": "^4.0.3",
"tachyons": "^4.11.1"
},
"devDependencies": {
Expand All @@ -26,9 +26,6 @@
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
"last 2 versions and not dead and > 2%"
]
}
4 changes: 2 additions & 2 deletions examples/browser-http-client-upload-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"clean": "rimraf ./dist",
"build": "parcel build index.html --public-url '.'",
"build": "parcel build index.html --no-scope-hoist",
"start": "parcel index.html",
"test": "test-ipfs-example"
},
Expand All @@ -19,7 +19,7 @@
},
"devDependencies": {
"ipfs": "^0.54.4",
"parcel-bundler": "^1.12.4",
"parcel": "next",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"rimraf": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-http-client-upload-file/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict'

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

class App extends React.Component {
constructor () {
Expand Down
10 changes: 5 additions & 5 deletions examples/browser-ipns-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"main": "index.js",
"scripts": {
"build": "parcel build index.html --public-url ./",
"build": "parcel build index.html --no-scope-hoist",
"start": "parcel index.html",
"test": "test-ipfs-example"
},
Expand All @@ -15,8 +15,8 @@
"human-crypto-keys": "^0.1.4",
"ipfs": "^0.54.4",
"ipfs-http-client": "^49.0.4",
"ipfs-utils": "^6.0.1",
"ipns": "^0.8.0",
"ipfs-utils": "^6.0.4",
"ipns": "^0.10.0",
"it-last": "^1.0.4",
"p-retry": "^4.2.0",
"uint8arrays": "^2.1.3"
Expand All @@ -27,9 +27,9 @@
"devDependencies": {
"delay": "^4.4.0",
"execa": "^5.0.0",
"ipfsd-ctl": "^7.2.0",
"ipfsd-ctl": "^8.0.0",
"go-ipfs": "0.8.0",
"parcel-bundler": "^1.12.4",
"parcel": "next",
"path": "^0.12.7",
"test-ipfs-example": "^3.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions examples/browser-mfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"author": "",
"license": "ISC",
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
"html-webpack-plugin": "^5.3.1",
"http-server": "^0.12.3",
"node-polyfill-webpack-plugin": "^1.0.3",
"rimraf": "^3.0.2",
"terser-webpack-plugin": "^1.2.1",
"test-ipfs-example": "^3.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
"webpack": "^5.28.0",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"ipfs": "^0.54.4",
Expand Down
62 changes: 18 additions & 44 deletions examples/browser-mfs/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,33 @@
'use strict'

const path = require('path')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
mode: 'development',
devtool: 'source-map',
devtool: 'eval',
entry: [
'./index.js'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
title: 'IPFS MFS example',
template: 'index.html'
}),
// fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib'
new NodePolyfillPlugin(),
// Note: stream-browserify has assumption about `Buffer` global in its
// dependencies causing runtime errors. This is a workaround to provide
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
// is fixed.
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser'
})
],
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
parse: {
// we want terser to parse ecma 8 code. However, we don't want it
// to apply any minfication steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe
// https://github.com/facebook/create-react-app/pull/4234
ecma: 8
},
compress: {
ecma: 5,
warnings: false
},
mangle: {
safari10: true
},
output: {
ecma: 5,
comments: false
}
},
// Use multi-process parallel running to improve the build speed
// Default number of concurrent runs: os.cpus().length - 1
parallel: true,
// Enable file caching
cache: true,
sourceMap: true
})
]
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
node: {
fs: 'empty'
}
]
}
4 changes: 0 additions & 4 deletions examples/browser-parceljs/.babelrc

This file was deleted.

Loading

0 comments on commit df7e158

Please sign in to comment.