From 4559a5156603526ce48430c96e2bcd86eaa804f0 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Fri, 9 Apr 2021 17:44:35 +0200 Subject: [PATCH 1/2] chore: update deps --- .github/workflows/main.yml | 47 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 42 ---------------------------------- README.md | 3 +-- package.json | 15 ++++-------- src/index.js | 4 ++-- test/bootstrap.spec.js | 11 +++++---- 6 files changed, 62 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2ef53e8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,47 @@ +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 + 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 + - 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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 44b3ebc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: node_js -cache: npm - -stages: - - check - - test - - cov - -node_js: - - '10' - -os: - - linux - - osx - - windows - -script: npx nyc -s npm run test:node -- --bail -after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov - -jobs: - include: - - stage: check - script: - - npx aegir dep-check - - npm run lint - - - stage: test - name: chrome - addons: - chrome: stable - script: - - npx aegir test -t browser -t webworker - - - stage: test - name: firefox - addons: - firefox: latest - script: - - npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless - -notifications: - email: false diff --git a/README.md b/README.md index ece1747..b736803 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,7 @@ js-libp2p-bootstrap [![](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-bootstrap.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-bootstrap) [![](https://img.shields.io/travis/libp2p/js-libp2p-bootstrap.svg?style=flat-square)](https://travis-ci.com/libp2p/js-libp2p-bootstrap) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) -![](https://img.shields.io/badge/npm-%3E%3D6.0.0-orange.svg?style=flat-square) -![](https://img.shields.io/badge/Node.js-%3E%3D10.0.0-orange.svg?style=flat-square) +![](https://img.shields.io/badge/Node.js-%3E%3D14.0.0-orange.svg?style=flat-square) > JavaScript libp2p Implementation of the railing process of a Node through a bootstrap peer list diff --git a/package.json b/package.json index d789b96..6e8f66b 100644 --- a/package.json +++ b/package.json @@ -24,25 +24,20 @@ "homepage": "https://github.com/libp2p/js-libp2p-bootstrap", "repository": "github:libp2p/js-libp2p-bootstrap", "engines": { - "node": ">=6.0.0", - "npm": ">=3.0.0" + "node": ">=14.0.0" }, "types": "dist/src/index.d.ts", "devDependencies": { "@types/debug": "^4.1.5", - "aegir": "^30.3.0", - "libp2p-interfaces": "^0.4.0" + "aegir": "^33.0.0", + "libp2p-interfaces": "^0.9.0" }, "dependencies": { - "debug": "^4.1.1", + "debug": "^4.3.1", "mafmt": "^8.0.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "peer-id": "^0.14.0" }, - "pre-push": [ - "lint", - "test" - ], "contributors": [ "David Dias ", "Vasco Santos ", diff --git a/src/index.js b/src/index.js index 4c1d2b3..6486eaa 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ 'use strict' const PeerId = require('peer-id') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const mafmt = require('mafmt') const { EventEmitter } = require('events') const debug = require('debug') @@ -59,7 +59,7 @@ class Bootstrap extends EventEmitter { return log.error('Invalid multiaddr') } - const ma = multiaddr(candidate) + const ma = new Multiaddr(candidate) const peerId = PeerId.createFromB58String(ma.getPeerId()) diff --git a/test/bootstrap.spec.js b/test/bootstrap.spec.js index ce2916d..6528ebf 100644 --- a/test/bootstrap.spec.js +++ b/test/bootstrap.spec.js @@ -21,7 +21,7 @@ describe('bootstrap', () => { throw new Error('should throw if no peer list is provided') }) - it('find the other peer', function () { + it('find the other peer', async function () { this.timeout(5 * 1000) const r = new Bootstrap({ list: peerList, @@ -30,10 +30,12 @@ describe('bootstrap', () => { const p = new Promise((resolve) => r.once('peer', resolve)) r.start() - return p + + await p + r.stop() }) - it('not fail on malformed peers in peer list', function () { + it('not fail on malformed peers in peer list', async function () { this.timeout(5 * 1000) const r = new Bootstrap({ @@ -53,7 +55,8 @@ describe('bootstrap', () => { r.start() - return p + await p + r.stop() }) it('stop emitting events when stop() called', async function () { From 7f5efd01e53488be0cbfd78227f8fd5bbc6ce8c0 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Sun, 11 Apr 2021 19:24:57 +0200 Subject: [PATCH 2/2] chore: update mafmt --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e8f66b..e5179eb 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "debug": "^4.3.1", - "mafmt": "^8.0.0", + "mafmt": "^9.0.0", "multiaddr": "^9.0.1", "peer-id": "^0.14.0" },