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

Commit

Permalink
fix: no more dep on ipfs-nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jul 7, 2017
1 parent 50fc179 commit 551fc4c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,27 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
"devDependencies": {
"aegir": "^11.0.1",
"aegir": "^11.0.2",
"benchmark": "^2.1.4",
"chai": "^3.5.0",
"dirty-chai": "^1.2.2",
"libp2p-ipfs-nodejs": "~0.25.0",
"chai": "^4.0.2",
"dirty-chai": "^2.0.0",
"libp2p": "^0.10.0",
"libp2p-secio": "^0.6.8",
"libp2p-spdy": "^0.10.6",
"libp2p-tcp": "^0.10.1",
"lodash.times": "^4.3.2",
"multiaddr": "^2.3.0",
"peer-id": "~0.8.7",
"peer-info": "~0.9.2",
"pre-commit": "^1.2.2"
},
"dependencies": {
"async": "^2.4.0",
"debug": "^2.6.6",
"async": "^2.5.0",
"debug": "^2.6.8",
"length-prefixed-stream": "^1.5.1",
"libp2p-crypto": "~0.8.8",
"lodash.values": "^4.3.0",
"pull-pushable": "^2.0.1",
"pull-pushable": "^2.1.1",
"time-cache": "~0.3.0"
},
"contributors": [
Expand All @@ -71,4 +74,4 @@
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",
"wanderer <mjbecze@gmail.com>"
]
}
}
24 changes: 24 additions & 0 deletions test/nodejs-bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict'

const TCP = require('libp2p-tcp')
const spdy = require('libp2p-spdy')
const secio = require('libp2p-secio')
const libp2p = require('libp2p')

class Node extends libp2p {
constructor (peerInfo, peerBook, options) {
options = options || {}

const modules = {
transport: [new TCP()],
connection: {
muxer: spdy,
crypto: [ secio ]
}
}

super(modules, peerInfo, peerBook, options)
}
}

module.exports = Node
14 changes: 3 additions & 11 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const multiaddr = require('multiaddr')
const Node = require('libp2p-ipfs-nodejs')
const Node = require('./nodejs-bundle')
const waterfall = require('async/waterfall')
const expect = require('chai').expect

Expand All @@ -18,16 +17,9 @@ exports.createNode = (maddr, callback) => {
(cb) => PeerId.create({ bits: 1024 }, cb),
(id, cb) => PeerInfo.create(id, cb),
(peer, cb) => {
peer.multiaddrs.add(multiaddr(maddr))
peer.multiaddrs.add(maddr)
cb(null, new Node(peer))
},
(node, cb) => {
node.start((err) => {
if (err) {
return cb(err)
}
cb(null, node)
})
}
(node, cb) => node.start((err) => cb(err, node))
], callback)
}

0 comments on commit 551fc4c

Please sign in to comment.