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

Use dignified.js #12

Merged
merged 2 commits into from
Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

dist
lib
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use_sudo: false
language: node_js
node_js:
- "iojs"
- 4
- 5

branches:
only:
Expand All @@ -10,4 +12,5 @@ before_install:
- npm i -g npm
# Workaround for a permissions issue with Travis virtual machine images
script:
- npm run lint
- npm test
2 changes: 2 additions & 0 deletions examples/level1-swarm/node-1.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

var Swarm = require('libp2p-swarm')
var tcp = require('libp2p-tcp')
var multiaddr = require('multiaddr')
Expand Down
2 changes: 2 additions & 0 deletions examples/level1-swarm/node-2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

var Swarm = require('libp2p-swarm')
var tcp = require('libp2p-tcp')
var multiaddr = require('multiaddr')
Expand Down
22 changes: 15 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"name": "libp2p",
"version": "0.1.1",
"description": "Node.js implementation of libp2p",
"main": "src/index.js",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "dignified-lint",
"build": "dignified-build",
"test": "dignified-test",
"test:node": "dignified-test node",
"test:browser": "dignified-test browser",
"release": "dignified-release"
},
"repository": {
"type": "git",
Expand All @@ -16,23 +22,25 @@
"engines": {
"node": "^4.0.0"
},
"pre-commit": [],
"pre-commit": [
"lint",
"test"
],
"author": "David Dias <daviddias@ipfs.io>",
"license": "MIT",
"bugs": {
"url": "https://github.com/diasdavid/js-libp2p/issues"
},
"homepage": "https://github.com/diasdavid/js-libp2p",
"devDependencies": {
"code": "^1.5.0",
"lab": "^5.17.0",
"chai": "^3.5.0",
"dignified.js": "^1.0.0",
"libp2p-spdy": "^0.1.0",
"libp2p-swarm": "^0.5.5",
"libp2p-tcp": "^0.1.2",
"multiaddr": "^1.1.1",
"peer-id": "^0.4.0",
"peer-info": "^0.4.0",
"pre-commit": "^1.1.1",
"standard": "^5.3.1"
"pre-commit": "^1.1.1"
}
}
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

exports = module.exports = Libp2p

function Libp2p (swarm, peerRouting, recordStore) {
Expand Down
19 changes: 19 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const Swarm = require('libp2p-swarm')
const Id = require('peer-id')
const Peer = require('peer-info')

const Node = require('../src')

describe('libp2p', () => {
it('can be instantiated', () => {
const peer = new Peer(Id.create(), [])
const swarm = new Swarm(peer)
const node = new Node(swarm)

expect(node.swarm).to.be.eql(swarm)
})
})