Skip to content

Commit a06dc87

Browse files
authored
Merge pull request #12 from dignifiedquire/dignified
Use dignified.js
2 parents 815a85d + a6652f2 commit a06dc87

File tree

7 files changed

+47
-8
lines changed

7 files changed

+47
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ build/Release
2525
# Dependency directory
2626
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2727
node_modules
28+
29+
dist
30+
lib

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
use_sudo: false
12
language: node_js
23
node_js:
3-
- "iojs"
4+
- 4
5+
- 5
46

57
branches:
68
only:
@@ -10,4 +12,5 @@ before_install:
1012
- npm i -g npm
1113
# Workaround for a permissions issue with Travis virtual machine images
1214
script:
15+
- npm run lint
1316
- npm test

examples/level1-swarm/node-1.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
var Swarm = require('libp2p-swarm')
24
var tcp = require('libp2p-tcp')
35
var multiaddr = require('multiaddr')

examples/level1-swarm/node-2.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
var Swarm = require('libp2p-swarm')
24
var tcp = require('libp2p-tcp')
35
var multiaddr = require('multiaddr')

package.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
"name": "libp2p",
33
"version": "0.1.1",
44
"description": "Node.js implementation of libp2p",
5-
"main": "src/index.js",
5+
"main": "lib/index.js",
6+
"jsnext:main": "src/index.js",
67
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"lint": "dignified-lint",
9+
"build": "dignified-build",
10+
"test": "dignified-test",
11+
"test:node": "dignified-test node",
12+
"test:browser": "dignified-test browser",
13+
"release": "dignified-release"
814
},
915
"repository": {
1016
"type": "git",
@@ -16,23 +22,25 @@
1622
"engines": {
1723
"node": "^4.0.0"
1824
},
19-
"pre-commit": [],
25+
"pre-commit": [
26+
"lint",
27+
"test"
28+
],
2029
"author": "David Dias <[email protected]>",
2130
"license": "MIT",
2231
"bugs": {
2332
"url": "https://github.com/diasdavid/js-libp2p/issues"
2433
},
2534
"homepage": "https://github.com/diasdavid/js-libp2p",
2635
"devDependencies": {
27-
"code": "^1.5.0",
28-
"lab": "^5.17.0",
36+
"chai": "^3.5.0",
37+
"dignified.js": "^1.0.0",
2938
"libp2p-spdy": "^0.1.0",
3039
"libp2p-swarm": "^0.5.5",
3140
"libp2p-tcp": "^0.1.2",
3241
"multiaddr": "^1.1.1",
3342
"peer-id": "^0.4.0",
3443
"peer-info": "^0.4.0",
35-
"pre-commit": "^1.1.1",
36-
"standard": "^5.3.1"
44+
"pre-commit": "^1.1.1"
3745
}
3846
}

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
exports = module.exports = Libp2p
24

35
function Libp2p (swarm, peerRouting, recordStore) {

test/index.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* eslint-env mocha */
2+
'use strict'
3+
4+
const expect = require('chai').expect
5+
const Swarm = require('libp2p-swarm')
6+
const Id = require('peer-id')
7+
const Peer = require('peer-info')
8+
9+
const Node = require('../src')
10+
11+
describe('libp2p', () => {
12+
it('can be instantiated', () => {
13+
const peer = new Peer(Id.create(), [])
14+
const swarm = new Swarm(peer)
15+
const node = new Node(swarm)
16+
17+
expect(node.swarm).to.be.eql(swarm)
18+
})
19+
})

0 commit comments

Comments
 (0)