From b3deb356f1910924757c9159f5f1a2ff06f8b80c Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Wed, 21 Aug 2019 10:23:06 +0200 Subject: [PATCH] fix: reference files directly to avoid npm install failures (#408) --- .aegir.js | 2 +- package.json | 6 ------ src/circuit/package.json | 5 ----- src/connection-manager/package.json | 5 ----- src/identify/package.json | 5 ----- src/index.js | 6 +++--- src/ping/package.json | 5 ----- src/pnet/package.json | 5 ----- src/switch/connection/index.js | 4 ++-- src/switch/connection/manager.js | 4 ++-- src/switch/index.js | 2 +- src/switch/package.json | 5 ----- src/switch/utils.js | 2 +- test/circuit-relay.node.js | 2 +- test/connection-manager/utils/create-libp2p-node.js | 2 +- test/identify/basic.spec.js | 2 +- test/identify/dialer.spec.js | 4 ++-- test/identify/listener.spec.js | 4 ++-- test/ping/test-ping.js | 4 ++-- test/pnet/pnet.spec.js | 2 +- test/promisify.node.js | 2 +- test/switch/connection.node.js | 6 +++--- test/switch/constructor.spec.js | 2 +- test/switch/dial-fsm.node.js | 4 ++-- test/switch/dialSelf.spec.js | 2 +- test/switch/dialer.spec.js | 8 ++++---- test/switch/identify.node.js | 4 ++-- test/switch/limit-dialer.node.js | 2 +- test/switch/pnet.node.js | 4 ++-- test/switch/secio.node.js | 2 +- test/switch/stats.node.js | 2 +- test/switch/stream-muxers.node.js | 2 +- test/switch/swarm-muxing+webrtc-star.browser.js | 2 +- test/switch/swarm-muxing+websockets.browser.js | 2 +- test/switch/swarm-muxing.node.js | 2 +- test/switch/swarm-no-muxing.node.js | 2 +- test/switch/switch.spec.js | 2 +- test/switch/t-webrtc-star.browser.js | 2 +- test/switch/transport-manager.spec.js | 2 +- test/switch/transports.browser.js | 2 +- test/switch/transports.node.js | 2 +- 41 files changed, 49 insertions(+), 85 deletions(-) delete mode 100644 src/circuit/package.json delete mode 100644 src/connection-manager/package.json delete mode 100644 src/identify/package.json delete mode 100644 src/ping/package.json delete mode 100644 src/pnet/package.json delete mode 100644 src/switch/package.json diff --git a/.aegir.js b/.aegir.js index aef17a8def..d562f4be70 100644 --- a/.aegir.js +++ b/.aegir.js @@ -10,7 +10,7 @@ const PeerBook = require('peer-book') const PeerId = require('peer-id') const PeerInfo = require('peer-info') const path = require('path') -const Switch = require('libp2p-switch') +const Switch = require('./src/switch') const WebSockets = require('libp2p-websockets') const Node = require('./test/utils/bundle-nodejs.js') diff --git a/package.json b/package.json index 9a96683aff..c3e55b0d41 100644 --- a/package.json +++ b/package.json @@ -53,13 +53,7 @@ "hashlru": "^2.3.0", "interface-connection": "~0.3.3", "latency-monitor": "~0.2.1", - "libp2p-circuit": "./src/circuit", - "libp2p-connection-manager": "./src/connection-manager", "libp2p-crypto": "~0.16.1", - "libp2p-identify": "./src/identify", - "libp2p-ping": "./src/ping", - "libp2p-pnet": "./src/pnet", - "libp2p-switch": "./src/switch", "libp2p-websockets": "^0.12.2", "mafmt": "^6.0.7", "moving-average": "^1.0.0", diff --git a/src/circuit/package.json b/src/circuit/package.json deleted file mode 100644 index e025615f93..0000000000 --- a/src/circuit/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "libp2p-circuit", - "description": "JavaScript implementation of circuit/switch relaying", - "main": "./index.js" -} diff --git a/src/connection-manager/package.json b/src/connection-manager/package.json deleted file mode 100644 index cd28440662..0000000000 --- a/src/connection-manager/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "libp2p-connection-manager", - "description": "JS Libp2p Connection Manager", - "main": "./index.js" -} diff --git a/src/identify/package.json b/src/identify/package.json deleted file mode 100644 index 62f2db5cab..0000000000 --- a/src/identify/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "libp2p-identify", - "description": "libp2p Identify Protocol", - "main": "./index.js" -} diff --git a/src/index.js b/src/index.js index 7d49efb484..62815a9ee3 100644 --- a/src/index.js +++ b/src/index.js @@ -15,10 +15,10 @@ const nextTick = require('async/nextTick') const PeerBook = require('peer-book') const PeerInfo = require('peer-info') -const Switch = require('libp2p-switch') -const Ping = require('libp2p-ping') +const Switch = require('./switch') +const Ping = require('./ping') const WebSockets = require('libp2p-websockets') -const ConnectionManager = require('libp2p-connection-manager') +const ConnectionManager = require('./connection-manager') const { emitFirst } = require('./util') const peerRouting = require('./peer-routing') diff --git a/src/ping/package.json b/src/ping/package.json deleted file mode 100644 index fb529ccbc0..0000000000 --- a/src/ping/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "libp2p-ping", - "description": "libp2p Ping protocol implementation", - "main": "./index.js" -} diff --git a/src/pnet/package.json b/src/pnet/package.json deleted file mode 100644 index 37a61479ba..0000000000 --- a/src/pnet/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "libp2p-pnet", - "description": "Private Network protection implementation", - "main": "./index.js" -} diff --git a/src/switch/connection/index.js b/src/switch/connection/index.js index b4f21a4642..efdea3d071 100644 --- a/src/switch/connection/index.js +++ b/src/switch/connection/index.js @@ -1,13 +1,13 @@ 'use strict' const FSM = require('fsm-event') -const Circuit = require('libp2p-circuit') +const Circuit = require('../../circuit') const multistream = require('multistream-select') const withIs = require('class-is') const BaseConnection = require('./base') const parallel = require('async/parallel') const nextTick = require('async/nextTick') -const identify = require('libp2p-identify') +const identify = require('../../identify') const errCode = require('err-code') const { msHandle, msSelect, identifyDialer } = require('../utils') diff --git a/src/switch/connection/manager.js b/src/switch/connection/manager.js index 9f74d23a70..2654757d8b 100644 --- a/src/switch/connection/manager.js +++ b/src/switch/connection/manager.js @@ -1,6 +1,6 @@ 'use strict' -const identify = require('libp2p-identify') +const identify = require('../../identify') const multistream = require('multistream-select') const debug = require('debug') const log = debug('libp2p:switch:conn-manager') @@ -8,7 +8,7 @@ const once = require('once') const ConnectionFSM = require('../connection') const { msHandle, msSelect, identifyDialer } = require('../utils') -const Circuit = require('libp2p-circuit') +const Circuit = require('../../circuit') const plaintext = require('../plaintext') diff --git a/src/switch/index.js b/src/switch/index.js index 81d944a66d..d7b3ef6761 100644 --- a/src/switch/index.js +++ b/src/switch/index.js @@ -5,7 +5,7 @@ const EventEmitter = require('events').EventEmitter const each = require('async/each') const eachSeries = require('async/eachSeries') const series = require('async/series') -const Circuit = require('libp2p-circuit') +const Circuit = require('../circuit') const TransportManager = require('./transport') const ConnectionManager = require('./connection/manager') const { getPeerInfo } = require('../get-peer-info') diff --git a/src/switch/package.json b/src/switch/package.json deleted file mode 100644 index 485ec52f31..0000000000 --- a/src/switch/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "libp2p-switch", - "description": "libp2p switch implementation in JavaScript", - "main": "./index.js" -} diff --git a/src/switch/utils.js b/src/switch/utils.js index 55e049432b..797c4db754 100644 --- a/src/switch/utils.js +++ b/src/switch/utils.js @@ -1,6 +1,6 @@ 'use strict' -const Identify = require('libp2p-identify') +const Identify = require('../identify') /** * For a given multistream, registers to handle the given connection diff --git a/test/circuit-relay.node.js b/test/circuit-relay.node.js index 4469b15e1d..e93f1d7dc8 100644 --- a/test/circuit-relay.node.js +++ b/test/circuit-relay.node.js @@ -8,7 +8,7 @@ const sinon = require('sinon') const waterfall = require('async/waterfall') const series = require('async/series') const parallel = require('async/parallel') -const Circuit = require('libp2p-circuit') +const Circuit = require('../src/circuit') const multiaddr = require('multiaddr') const createNode = require('./utils/create-node') diff --git a/test/connection-manager/utils/create-libp2p-node.js b/test/connection-manager/utils/create-libp2p-node.js index a1675224ce..0fcdab894c 100644 --- a/test/connection-manager/utils/create-libp2p-node.js +++ b/test/connection-manager/utils/create-libp2p-node.js @@ -8,7 +8,7 @@ const waterfall = require('async/waterfall') const PeerInfo = require('peer-info') const PeerId = require('peer-id') -const ConnManager = require('libp2p-connection-manager') +const ConnManager = require('../../../src/connection-manager') class Node extends libp2p { constructor (peerInfo) { diff --git a/test/identify/basic.spec.js b/test/identify/basic.spec.js index 14a2f8f1e5..6fb95dbf11 100644 --- a/test/identify/basic.spec.js +++ b/test/identify/basic.spec.js @@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) -const identify = require('libp2p-identify') +const identify = require('../../src/identify') describe('basic', () => { it('multicodec', () => { diff --git a/test/identify/dialer.spec.js b/test/identify/dialer.spec.js index dfce43ad97..31bd036ed4 100644 --- a/test/identify/dialer.spec.js +++ b/test/identify/dialer.spec.js @@ -12,8 +12,8 @@ const PeerInfo = require('peer-info') const lp = require('pull-length-prefixed') const multiaddr = require('multiaddr') -const msg = require('libp2p-identify').message -const identify = require('libp2p-identify') +const identify = require('../../src/identify') +const msg = identify.message describe('identify.dialer', () => { let original diff --git a/test/identify/listener.spec.js b/test/identify/listener.spec.js index c941d275f9..ac4b3abc4c 100644 --- a/test/identify/listener.spec.js +++ b/test/identify/listener.spec.js @@ -12,8 +12,8 @@ const PeerInfo = require('peer-info') const lp = require('pull-length-prefixed') const multiaddr = require('multiaddr') -const msg = require('libp2p-identify').message -const identify = require('libp2p-identify') +const identify = require('../../src/identify') +const msg = identify.message describe('identify.listener', () => { let info diff --git a/test/ping/test-ping.js b/test/ping/test-ping.js index b175231980..0dc1f9e10f 100644 --- a/test/ping/test-ping.js +++ b/test/ping/test-ping.js @@ -8,12 +8,12 @@ chai.use(dirtyChai) const PeerInfo = require('peer-info') const PeerBook = require('peer-book') -const Swarm = require('libp2p-switch') +const Swarm = require('../../src/switch') const TCP = require('libp2p-tcp') const series = require('async/series') const parallel = require('async/parallel') -const Ping = require('libp2p-ping') +const Ping = require('../../src/ping') describe('libp2p ping', () => { let swarmA diff --git a/test/pnet/pnet.spec.js b/test/pnet/pnet.spec.js index cdc35b51d5..c7f254fa4e 100644 --- a/test/pnet/pnet.spec.js +++ b/test/pnet/pnet.spec.js @@ -12,7 +12,7 @@ const Connection = require('interface-connection').Connection const pair = require('pull-pair/duplex') const pull = require('pull-stream') -const Protector = require('libp2p-pnet') +const Protector = require('../../src/pnet') const Errors = Protector.errors const generate = Protector.generate diff --git a/test/promisify.node.js b/test/promisify.node.js index 5a62e0d5b8..16868a4a58 100644 --- a/test/promisify.node.js +++ b/test/promisify.node.js @@ -16,7 +16,7 @@ const createNode = promisify(require('./utils/create-node')) const { createPeerInfo } = require('./utils/create-node') const Node = require('./utils/bundle-nodejs') const pull = require('pull-stream') -const Ping = require('libp2p-ping') +const Ping = require('../src/ping') /** * As libp2p is currently promisified, when extending libp2p, diff --git a/test/switch/connection.node.js b/test/switch/connection.node.js index 05a0ff9182..f8447c0cec 100644 --- a/test/switch/connection.node.js +++ b/test/switch/connection.node.js @@ -13,14 +13,14 @@ const secio = require('libp2p-secio') const pull = require('pull-stream') const multiplex = require('pull-mplex') const spdy = require('libp2p-spdy') -const Protector = require('libp2p-pnet') +const Protector = require('../../src/pnet') const generatePSK = Protector.generate const psk = Buffer.alloc(95) generatePSK(psk) -const ConnectionFSM = require('libp2p-switch/connection') -const Switch = require('libp2p-switch') +const ConnectionFSM = require('../../src/switch/connection') +const Switch = require('../../src/switch') const createInfos = require('./utils').createInfos describe('ConnectionFSM', () => { diff --git a/test/switch/constructor.spec.js b/test/switch/constructor.spec.js index 8dbb12b86e..7d932aeb68 100644 --- a/test/switch/constructor.spec.js +++ b/test/switch/constructor.spec.js @@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('create Switch instance', () => { it('throws on missing peerInfo', () => { diff --git a/test/switch/dial-fsm.node.js b/test/switch/dial-fsm.node.js index 5a9ebb86b0..78faf6dc4d 100644 --- a/test/switch/dial-fsm.node.js +++ b/test/switch/dial-fsm.node.js @@ -16,11 +16,11 @@ const TCP = require('libp2p-tcp') const secio = require('libp2p-secio') const multiplex = require('pull-mplex') const pull = require('pull-stream') -const identify = require('libp2p-identify') +const identify = require('../../src/identify') const utils = require('./utils') const createInfos = utils.createInfos -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('dialFSM', () => { let switchA diff --git a/test/switch/dialSelf.spec.js b/test/switch/dialSelf.spec.js index cbb9b9922e..4a1ab6913c 100644 --- a/test/switch/dialSelf.spec.js +++ b/test/switch/dialSelf.spec.js @@ -13,7 +13,7 @@ const Duplex = require('pull-pair/duplex') const utils = require('./utils') const createInfos = utils.createInfos -const Swarm = require('libp2p-switch') +const Swarm = require('../../src/switch') class MockTransport extends EventEmitter { constructor () { diff --git a/test/switch/dialer.spec.js b/test/switch/dialer.spec.js index 16248bdfa0..95bba64ee4 100644 --- a/test/switch/dialer.spec.js +++ b/test/switch/dialer.spec.js @@ -9,10 +9,10 @@ chai.use(dirtyChai) const sinon = require('sinon') const PeerBook = require('peer-book') -const Queue = require('libp2p-switch/dialer/queue') -const QueueManager = require('libp2p-switch/dialer/queueManager') -const Switch = require('libp2p-switch') -const { PRIORITY_HIGH, PRIORITY_LOW } = require('libp2p-switch/constants') +const Queue = require('../../src/switch/dialer/queue') +const QueueManager = require('../../src/switch/dialer/queueManager') +const Switch = require('../../src/switch') +const { PRIORITY_HIGH, PRIORITY_LOW } = require('../../src/switch/constants') const utils = require('./utils') const createInfos = utils.createInfos diff --git a/test/switch/identify.node.js b/test/switch/identify.node.js index 3da83a3bf5..4585de55cf 100644 --- a/test/switch/identify.node.js +++ b/test/switch/identify.node.js @@ -12,13 +12,13 @@ const pull = require('pull-stream') const secio = require('libp2p-secio') const PeerInfo = require('peer-info') const PeerBook = require('peer-book') -const identify = require('libp2p-identify') +const identify = require('../../src/identify') const lp = require('pull-length-prefixed') const sinon = require('sinon') const utils = require('./utils') const createInfos = utils.createInfos -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Identify', () => { let switchA diff --git a/test/switch/limit-dialer.node.js b/test/switch/limit-dialer.node.js index 01b4c97c6e..e6395400d9 100644 --- a/test/switch/limit-dialer.node.js +++ b/test/switch/limit-dialer.node.js @@ -9,7 +9,7 @@ const multiaddr = require('multiaddr') const pull = require('pull-stream') const nextTick = require('async/nextTick') -const LimitDialer = require('libp2p-switch/limit-dialer') +const LimitDialer = require('../../src/switch/limit-dialer') const utils = require('./utils') describe('LimitDialer', () => { diff --git a/test/switch/pnet.node.js b/test/switch/pnet.node.js index e670addb88..2bc1c6450f 100644 --- a/test/switch/pnet.node.js +++ b/test/switch/pnet.node.js @@ -11,12 +11,12 @@ const multiplex = require('pull-mplex') const pull = require('pull-stream') const PeerBook = require('peer-book') const secio = require('libp2p-secio') -const Protector = require('libp2p-pnet') +const Protector = require('../../src/pnet') const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') const generatePSK = Protector.generate diff --git a/test/switch/secio.node.js b/test/switch/secio.node.js index 7731cef9a9..3e9080d66e 100644 --- a/test/switch/secio.node.js +++ b/test/switch/secio.node.js @@ -15,7 +15,7 @@ const PeerBook = require('peer-book') const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('SECIO', () => { let switchA diff --git a/test/switch/stats.node.js b/test/switch/stats.node.js index f57935569f..e9852ebee1 100644 --- a/test/switch/stats.node.js +++ b/test/switch/stats.node.js @@ -18,7 +18,7 @@ const PeerBook = require('peer-book') const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Stats', () => { const setup = (cb) => { diff --git a/test/switch/stream-muxers.node.js b/test/switch/stream-muxers.node.js index 48330b2e68..faf7409fc4 100644 --- a/test/switch/stream-muxers.node.js +++ b/test/switch/stream-muxers.node.js @@ -18,7 +18,7 @@ const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Stream Multiplexing', () => { [ diff --git a/test/switch/swarm-muxing+webrtc-star.browser.js b/test/switch/swarm-muxing+webrtc-star.browser.js index 3235430f35..e5fe9e9390 100644 --- a/test/switch/swarm-muxing+webrtc-star.browser.js +++ b/test/switch/swarm-muxing+webrtc-star.browser.js @@ -17,7 +17,7 @@ const PeerBook = require('peer-book') const tryEcho = require('./utils').tryEcho const sinon = require('sinon') -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Switch (webrtc-star)', () => { let switch1 diff --git a/test/switch/swarm-muxing+websockets.browser.js b/test/switch/swarm-muxing+websockets.browser.js index c14adc03f7..fcf46f8705 100644 --- a/test/switch/swarm-muxing+websockets.browser.js +++ b/test/switch/swarm-muxing+websockets.browser.js @@ -15,7 +15,7 @@ const spdy = require('libp2p-spdy') const PeerBook = require('peer-book') const tryEcho = require('./utils').tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Switch (WebSockets)', () => { [ diff --git a/test/switch/swarm-muxing.node.js b/test/switch/swarm-muxing.node.js index 32b282c6d8..8ca774e5e8 100644 --- a/test/switch/swarm-muxing.node.js +++ b/test/switch/swarm-muxing.node.js @@ -19,7 +19,7 @@ const PeerBook = require('peer-book') const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Switch (everything all together)', () => { [pMplex, spdy, mplex].forEach(muxer => { diff --git a/test/switch/swarm-no-muxing.node.js b/test/switch/swarm-no-muxing.node.js index d55bedd532..ef9a2dc969 100644 --- a/test/switch/swarm-no-muxing.node.js +++ b/test/switch/swarm-no-muxing.node.js @@ -14,7 +14,7 @@ const PeerBook = require('peer-book') const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Switch (no Stream Multiplexing)', () => { let switchA diff --git a/test/switch/switch.spec.js b/test/switch/switch.spec.js index e3387df608..142d40fca9 100644 --- a/test/switch/switch.spec.js +++ b/test/switch/switch.spec.js @@ -6,7 +6,7 @@ const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Switch', () => { describe('.availableTransports', () => { diff --git a/test/switch/t-webrtc-star.browser.js b/test/switch/t-webrtc-star.browser.js index c01fb8fcdb..0bfa843127 100644 --- a/test/switch/t-webrtc-star.browser.js +++ b/test/switch/t-webrtc-star.browser.js @@ -13,7 +13,7 @@ const pull = require('pull-stream') const PeerBook = require('peer-book') const tryEcho = require('./utils').tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('transport - webrtc-star', () => { let switch1 diff --git a/test/switch/transport-manager.spec.js b/test/switch/transport-manager.spec.js index 97827d2bb4..a2e61a17e6 100644 --- a/test/switch/transport-manager.spec.js +++ b/test/switch/transport-manager.spec.js @@ -9,7 +9,7 @@ const Multiaddr = require('multiaddr') const PeerInfo = require('peer-info') const sinon = require('sinon') -const TransportManager = require('libp2p-switch/transport') +const TransportManager = require('../../src/switch/transport') describe('Transport Manager', () => { afterEach(() => { diff --git a/test/switch/transports.browser.js b/test/switch/transports.browser.js index fc3e4104ec..735921e719 100644 --- a/test/switch/transports.browser.js +++ b/test/switch/transports.browser.js @@ -12,7 +12,7 @@ const PeerBook = require('peer-book') const WebSockets = require('libp2p-websockets') const tryEcho = require('./utils').tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('Transports', () => { describe('WebSockets', () => { diff --git a/test/switch/transports.node.js b/test/switch/transports.node.js index 9989a163e1..f9e464c03d 100644 --- a/test/switch/transports.node.js +++ b/test/switch/transports.node.js @@ -15,7 +15,7 @@ const PeerBook = require('peer-book') const utils = require('./utils') const createInfos = utils.createInfos const tryEcho = utils.tryEcho -const Switch = require('libp2p-switch') +const Switch = require('../../src/switch') describe('transports', () => { [