diff --git a/.gitignore b/.gitignore index 123ae94..5b1fd19 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 649404b..f3303e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ - language: node_js node_js: - - "4.0" + - 4 + - 5 branches: only: @@ -19,4 +19,5 @@ before_script: - sh -e /etc/init.d/xvfb start script: - - npm test \ No newline at end of file + - npm run lint + - npm test diff --git a/.zuul.yml b/.zuul.yml deleted file mode 100644 index 96d9cfb..0000000 --- a/.zuul.yml +++ /dev/null @@ -1 +0,0 @@ -ui: tape diff --git a/README.md b/README.md index 39038d1..7f20113 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ peer-info JavaScript implementation [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -![Build Status](https://travis-ci.org/diasdavid/js-peer-info.svg?style=flat-square)](https://travis-ci.org/diasdavid/js-peer-info) ![](https://img.shields.io/badge/coverage-%3F-yellow.svg?style=flat-square) +[![Build Status](https://travis-ci.org/diasdavid/js-peer-info.svg?style=flat-square)](https://travis-ci.org/diasdavid/js-peer-info) [![Dependency Status](https://david-dm.org/diasdavid/js-peer-info.svg?style=flat-square)](https://david-dm.org/diasdavid/js-peer-info) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index b6cd170..0000000 --- a/karma.conf.js +++ /dev/null @@ -1,52 +0,0 @@ -module.exports = (config) => { - const path = require('path') - const nodeForgePath = path.resolve(__dirname, 'node_modules/peer-id/deps/forge.bundle.js') - - config.set({ - basePath: '', - frameworks: ['mocha'], - - files: [ - nodeForgePath, - 'tests/*-test.js' - ], - - preprocessors: { - 'tests/*': ['webpack'] - }, - - webpack: { - resolve: { - extensions: ['', '.js', '.json'] - }, - externals: { - fs: '{}', - 'node-forge': 'forge' - }, - node: { - Buffer: true - }, - module: { - loaders: [ - { test: /\.json$/, loader: 'json' } - ], - noParse: [] - } - }, - - webpackMiddleware: { - noInfo: true, - stats: { - colors: true - } - }, - reporters: ['spec'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: false, - browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'], - singleRun: true - }) -} - diff --git a/package.json b/package.json index c041b4d..bb7cded 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,16 @@ "name": "peer-info", "version": "0.6.0", "description": "IPFS Peer abstraction JavaScript implementation", - "main": "src/index.js", + "main": "lib/index.js", + "jsnext:main": "src/index.js", "scripts": { - "lint": "standard", - "test": "npm run test:node && npm run test:browser", - "test:node": "mocha tests/*-test.js", - "test:browser": "karma start karma.conf.js", - "coverage": "istanbul cover --print both -- _mocha tests/*-test.js" + "lint": "dignified-lint", + "build": "dignified-build", + "test": "dignified-test", + "test:node": "dignified-test node", + "test:browser": "dignified-test browser", + "release": "dignified-release", + "coverage": "istanbul cover --print both -- _mocha tests/*.spec.js" }, "repository": { "type": "git", @@ -33,21 +36,20 @@ "devDependencies": { "buffer-loader": "0.0.1", "chai": "^3.5.0", + "dignified.js": "^1.0.0", "istanbul": "^0.4.2", - "json-loader": "^0.5.4", - "karma": "^0.13.19", - "karma-chrome-launcher": "^0.2.2", - "karma-cli": "^0.1.2", - "karma-firefox-launcher": "^0.1.7", - "karma-mocha": "^0.2.1", - "karma-spec-reporter": "0.0.24", - "karma-webpack": "^1.7.0", - "mocha": "^2.4.5", "multiaddr": "^1.1.1", "peer-id": "^0.6.0", - "pre-commit": "^1.1.2", - "standard": "^6.0.7", - "webpack": "^1.12.14" + "pre-commit": "^1.1.2" }, - "dependencies": {} + "dependencies": {}, + "dignified": { + "webpack": { + "resolve": { + "alias": { + "node-forge": "../deps/forge.bundle.js" + } + } + } + } } diff --git a/src/index.js b/src/index.js index f1d9990..179b5f6 100644 --- a/src/index.js +++ b/src/index.js @@ -1,11 +1,10 @@ -/* - * Peer represents a peer on the IPFS network - */ +'use strict' const Id = require('peer-id') exports = module.exports = Peer +// Peer represents a peer on the IPFS network function Peer (peerId) { if (!(this instanceof Peer)) { return new Peer(peerId) diff --git a/tests/peer-info-test.js b/test/index.spec.js similarity index 98% rename from tests/peer-info-test.js rename to test/index.spec.js index 6dbc4f1..ae5623e 100644 --- a/tests/peer-info-test.js +++ b/test/index.spec.js @@ -1,11 +1,12 @@ /* eslint-env mocha */ +'use strict' const expect = require('chai').expect const Id = require('peer-id') const Multiaddr = require('multiaddr') const PeerInfo = require('../src') -describe('peer-info', function (done) { +describe('peer-info', function () { this.timeout(10000) it('create with Id', (done) => {