Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update deps and remove protons #153

Merged
merged 10 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
}
}
}
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ts/message/rpc*
26 changes: 13 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn lint
- run: yarn prebuild
- run: yarn aegir dep-check
- run: npm install
- run: npm run lint
- run: npm run prebuild
- run: npx aegir dep-check
test-node:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node: [12]
node: [14]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: yarn
- run: yarn prebuild
- run: npx nyc --reporter=lcov aegir test -t node -- --bail
- run: npm install
- run: npm run prebuild
- run: npx aegir test -t node --cov --bail
- uses: codecov/codecov-action@v1
test-chrome:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn prebuild
- run: npm install
- run: npm run prebuild
- run: npx aegir test -t browser -t webworker --bail
test-firefox:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn prebuild
- run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless
- run: npm install
- run: npm run prebuild
- run: npx aegir test -t browser -t webworker --bail -- --browser firefox
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
"types": "src/index.d.ts",
"scripts": {
"lint": "eslint --ext .ts ts",
"release": "aegir release",
"prebuild": "tsc",
"build": "aegir build",
"release": "aegir release --no-types",
"prebuild": "tsc && cp -R ts/message src",
"build": "npm run build:proto && npm run build:proto-types && npm run build:types",
"build:proto": "pbjs -t static-module --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o ts/message/rpc.js ./ts/message/rpc.proto",
"build:proto-types": "pbts -o ts/message/rpc.d.ts ts/message/rpc.js",
"build:types": "aegir build --no-types",
"prepare": "tsc",
"pretest": "tsc",
"test": "aegir test",
"test:node": "aegir test --target node",
Expand All @@ -40,22 +44,23 @@
"denque": "^1.4.1",
"err-code": "^2.0.0",
"it-pipe": "^1.0.1",
"libp2p-interfaces": "^0.8.0",
"libp2p-interfaces": "^0.10.0",
"peer-id": "^0.14.0",
"protons": "^2.0.0",
"protobufjs": "^6.10.2",
"time-cache": "^0.3.0",
"uint8arrays": "^1.1.0"
"uint8arrays": "^2.1.4"
},
"devDependencies": {
"@types/chai": "^4.2.3",
"@types/mocha": "^7.0.2",
"@types/mocha": "^8.2.2",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
"aegir": "^28.0.0",
"aegir": "^33.0.0",
"benchmark": "^2.1.4",
"buffer": "^6.0.3",
"chai": "^4.2.0",
"chai-spies": "^1.0.0",
"delay": "^4.3.0",
"delay": "^5.0.0",
"detect-node": "^2.0.4",
"dirty-chai": "^2.0.1",
"eslint": "^7.1.0",
Expand All @@ -65,25 +70,21 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"it-pair": "^1.0.0",
"karma-mocha-webworker": "^1.3.0",
"libp2p": "^0.30.0",
"libp2p-floodsub": "^0.24.1",
"libp2p": "^0.31.0-rc.0",
"libp2p-floodsub": "^0.25.0",
"libp2p-mplex": "^0.10.0",
"libp2p-noise": "^2.0.0",
"libp2p-websockets": "^0.14.0",
"libp2p-websockets": "^0.15.5",
"lodash": "^4.17.15",
"mocha": "^7.1.1",
"multiaddr": "^8.0.0",
"multiaddr": "^9.0.0",
"os": "^0.1.1",
"p-retry": "^4.2.0",
"p-times": "^2.1.0",
"p-wait-for": "^3.1.0",
"promisify-es6": "^1.0.3",
"sinon": "^9.0.2",
"sinon": "^10.0.1",
"typescript": "4.0.x"
},
"peerDependencies": {
"libp2p": "^0.30.0"
},
"contributors": [
"Cayman <[email protected]>",
"Vasco Santos <[email protected]>",
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')
8 changes: 6 additions & 2 deletions test/2-nodes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ describe('2 nodes', () => {
expectSet(nodes[1].topics.get(topic), [nodes[0].peerId.toB58String()])

expect(changedPeerId.toB58String()).to.equal(first(nodes[0].peers).id.toB58String())
expect(changedSubs).to.be.eql([{ topicID: topic, subscribe: true }])
expect(changedSubs).to.have.lengthOf(1)
expect(changedSubs[0].topicID).to.equal(topic)
expect(changedSubs[0].subscribe).to.equal(true)

// await heartbeats
await Promise.all([
Expand Down Expand Up @@ -204,7 +206,9 @@ describe('2 nodes', () => {
expect(nodes[1].peers.size).to.equal(1)
expectSet(nodes[1].topics.get(topic), [])
expect(changedPeerId.toB58String()).to.equal(first(nodes[1].peers).id.toB58String())
expect(changedSubs).to.be.eql([{ topicID: topic, subscribe: false }])
expect(changedSubs).to.have.lengthOf(1)
expect(changedSubs[0].topicID).to.equal(topic)
expect(changedSubs[0].subscribe).to.equal(false)
})

it('Publish to a topic after unsubscribe', async () => {
Expand Down
8 changes: 6 additions & 2 deletions test/floodsub.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ describe('gossipsub fallbacks to floodsub', () => {
expectSet(nodeFs.topics.get(topic), [nodeGs.peerId.toB58String()])

expect(changedPeerId.toB58String()).to.equal(first(nodeGs.peers).id.toB58String())
expect(changedSubs).to.be.eql([{ topicID: topic, subscribe: true }])
expect(changedSubs).to.have.lengthOf(1)
expect(changedSubs[0].topicID).to.equal(topic)
expect(changedSubs[0].subscribe).to.equal(true)
})
})

Expand Down Expand Up @@ -242,7 +244,9 @@ describe('gossipsub fallbacks to floodsub', () => {
expect(nodeFs.peers.size).to.equal(1)
expectSet(nodeFs.topics.get(topic), [])
expect(changedPeerId.toB58String()).to.equal(first(nodeFs.peers).id.toB58String())
expect(changedSubs).to.be.eql([{ topicID: topic, subscribe: false }])
expect(changedSubs).to.have.lengthOf(1)
expect(changedSubs[0].topicID).to.equal(topic)
expect(changedSubs[0].subscribe).to.equal(false)
})

it('Publish to a topic after unsubscribe', async () => {
Expand Down
Loading