Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

chore: update deps #114

Merged
merged 4 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* set up a libp2p instance for browser nodes to relay through
* before tests start
*/
const path = require('path')

const Libp2p = require('libp2p')
const PeerId = require('peer-id')
Expand Down Expand Up @@ -52,15 +53,20 @@ const after = async () => {
await libp2p.stop()
}

/** @type {import('aegir').Options["build"]["config"]} */
const esbuild = {
inject: [path.join(__dirname, './scripts/node-globals.js')]
}

/** @type {import('aegir').PartialOptions} */
module.exports = {
hooks: {
pre: before,
post: after
},
webpack: {
node: {
// this is needed until bcrypto stops using node buffers in browser code
Buffer: true
test: {
before,
after,
browser: {
config: {
buildConfig: esbuild
}
}
}
}
70 changes: 70 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: ci
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir lint
- run: npx aegir dep-check -- -i wrtc -i electron-webrtc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- run: npx aegir dep-check -- -i wrtc -i electron-webrtc
- run: npx aegir dep-check

No need to ignore wrtc and electron-webrtc

- run: npx aegir build --no-types
test-node:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node: [14, 15]
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npx nyc --reporter=lcov aegir test -t node -- --bail
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- run: npx nyc --reporter=lcov aegir test -t node -- --bail
- run: npx aegir test -t node --cov --bail

No need for nyc

- uses: codecov/codecov-action@v1
test-chrome:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir test -t browser -t webworker --bail
test-firefox:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless
- run: npx aegir test -t browser -t webworker --bail -- --browser firefox

Otherwise this will run on chromium

test-webkit:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: microsoft/playwright-github-action@v1
- run: npm install
- run: npx aegir test -t browser -t webworker --bail -- --browser webkit
test-electron-main:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx xvfb-maybe aegir test -t electron-main --bail
test-electron-renderer:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx xvfb-maybe aegir test -t electron-renderer --bail
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (typeof self !== 'undefined') {
self.Benchmark = Benchmark
}

const utils = require('../src/utils')
const { utils } = require('libp2p-interfaces/src/pubsub')

const suite = new Benchmark.Suite('utils')

Expand Down
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"test": "aegir test",
"test:node": "aegir test -t node",
"test:browser": "aegir test -t browser",
"build": "aegir build",
"build": "aegir build --no-types",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want types?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want types, but we are not adding types to all libp2p modules for the time being: libp2p/js-libp2p#659

We are focusing first on guarantee that libp2p provides types for the user surface area, which is essentially libp2p + libp2p-interfaces. Slowly, we should roll up the remaining modules, as some libp2p modules (including this) also need libp2p and libp2p-interfaces to have types, as libp2p is provided to the modules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, once I release interfaces I can add types here as this should be super fast

"docs": "aegir-docs",
"release": "aegir release --docs",
"release-minor": "aegir release --type minor --docs",
"release-major": "aegir release --type major --docs",
"release": "aegir release --docs --no-types",
"release-minor": "aegir release --no-types --type minor --docs",
"release-major": "aegir release --no-types --type major --docs",
"coverage": "aegir coverage",
"coverage-publish": "aegir coverage --provider coveralls"
},
Expand Down Expand Up @@ -42,24 +42,26 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
"devDependencies": {
"aegir": "^28.1.0",
"aegir": "^33.0.0",
"benchmark": "^2.1.4",
"chai": "^4.2.0",
"ipfs-utils": "^4.0.1",
"chai": "^4.3.4",
"ipfs-utils": "^6.0.6",
"it-pair": "^1.0.0",
"libp2p": "^0.30.0",
"libp2p-mplex": "^0.10.1",
"libp2p-noise": "^2.0.1",
"libp2p-websockets": "^0.14.0",
"multiaddr": "^8.1.1",
"libp2p-websockets": "^0.15.4",
"multiaddr": "^9.0.1",
"os": "^0.1.1",
"p-wait-for": "^3.1.0",
"peer-id": "^0.14.2",
"sinon": "^9.2.1"
"sinon": "^10.0.0"
},
"dependencies": {
"debug": "^4.2.0",
"libp2p-interfaces": "^0.8.1",
"libp2p-interfaces": "libp2p/js-libp2p-interfaces#chore/update-pubsub-interface",
"time-cache": "^0.3.0",
"uint8arrays": "^1.1.0"
"uint8arrays": "^2.1.4"
},
"peerDependencies": {
"libp2p": "^0.30.0"
Expand Down
1 change: 1 addition & 0 deletions scripts/node-globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const { Buffer } = require('buffer')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should include the "buffer" dependency too I guess

14 changes: 11 additions & 3 deletions test/utils/create-peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/

const Libp2p = require('libp2p')
const multiaddr = require('multiaddr')
const { Multiaddr } = require('multiaddr')
const PeerId = require('peer-id')

const WS = require('libp2p-websockets')
const filters = require('libp2p-websockets/src/filters')
const MPLEX = require('libp2p-mplex')
const { NOISE } = require('libp2p-noise')

Expand All @@ -21,6 +22,8 @@ const { isNode } = require('ipfs-utils/src/env')
const Peers = require('../fixtures/peers')
const RelayPeer = require('../fixtures/relay')

const transportKey = WS.prototype[Symbol.toStringTag]

const defaultConfig = {
modules: {
transport: [WS],
Expand All @@ -33,6 +36,11 @@ const defaultConfig = {
},
peerDiscovery: {
autoDial: false
},
transport: {
[transportKey]: {
filter: filters.all
}
}
}
}
Expand Down Expand Up @@ -109,10 +117,10 @@ async function createPeers ({ number = 1, started = true, seedAddressBook = true
function getListenAddress (peerId) {
if (isNode) {
// node
return multiaddr('/ip4/127.0.0.1/tcp/0/ws')
return new Multiaddr('/ip4/127.0.0.1/tcp/0/ws')
} else {
// browser
return multiaddr(`${RelayPeer.multiaddr}/p2p-circuit/p2p/${peerId.toB58String()}`)
return new Multiaddr(`${RelayPeer.multiaddr}/p2p-circuit/p2p/${peerId.toB58String()}`)
}
}

Expand Down