Use dignified.js

This commit is contained in:
dignifiedquire 2016-03-22 17:01:46 +01:00
parent f62023f8a7
commit ab76788771
9 changed files with 24 additions and 75843 deletions

3
.gitignore vendored
View File

@ -25,3 +25,6 @@ build/Release
# Dependency directory # Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules node_modules
lib
dist

75722
dist/peer-id.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,61 +0,0 @@
module.exports = (config) => {
const path = require('path')
const node_modules_dir = path.join(__dirname, 'node_modules')
const deps = [
'deps/forge.bundle.js'
]
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'tests/test.js'
],
preprocessors: {
'tests/*': ['webpack']
},
webpack: {
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.json'],
alias: { 'node-forge': path.resolve(__dirname, 'deps/forge.bundle.js') }
},
externals: {
fs: '{}'
},
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
})
deps.forEach((dep) => {
const depPath = path.resolve(node_modules_dir, dep)
config.webpack.module.noParse.push(depPath)
})
}

View File

@ -4,18 +4,13 @@
"description": "IPFS Peer Id implementation in Node.js", "description": "IPFS Peer Id implementation in Node.js",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"lint": "standard", "lint": "dignified-lint",
"test": "npm run test:node && npm run test:browser", "build": "dignified-build",
"test:node": "mocha tests/test.js", "test": "dignified-test",
"test:browser": "karma start karma.conf.js", "test:node": "dignified-test node",
"coverage": "istanbul cover --print both -- _mocha tests/test.js", "test:browser": "dignified-test browser",
"dist": "webpack" "release": "dignified-release",
}, "coverage": "istanbul cover --print both -- _mocha tests/test.js"
"standard": {
"ignore": [
"dist",
"deps"
]
}, },
"keywords": [ "keywords": [
"IPFS" "IPFS"
@ -34,22 +29,11 @@
}, },
"homepage": "https://github.com/diasdavid/js-peer-id", "homepage": "https://github.com/diasdavid/js-peer-id",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.0",
"buffer-loader": "0.0.1", "buffer-loader": "0.0.1",
"chai": "^3.5.0", "chai": "^3.5.0",
"dignified.js": "github:dignifiedquire/dignified.js",
"istanbul": "^0.4.2", "istanbul": "^0.4.2",
"json-loader": "^0.5.4", "pre-commit": "^1.1.1"
"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",
"pre-commit": "^1.1.1",
"standard": "^6.0.7",
"webpack": "^1.12.14"
}, },
"dependencies": { "dependencies": {
"bs58": "^3.0.0", "bs58": "^3.0.0",
@ -60,5 +44,14 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/diasdavid/js-peer-id.git" "url": "https://github.com/diasdavid/js-peer-id.git"
},
"dignified": {
"webpack": {
"resolve": {
"alias": {
"node-forge": "../vendor/forge.bundle.js"
}
}
}
} }
} }

View File

@ -1,6 +1,7 @@
/* /*
* Id is an object representation of a peer Id. a peer Id is a multihash * Id is an object representation of a peer Id. a peer Id is a multihash
*/ */
'use strict'
const fs = require('fs') const fs = require('fs')
const multihashing = require('multihashing') const multihashing = require('multihashing')
@ -9,10 +10,8 @@ const forge = require('node-forge')
const protobuf = require('protocol-buffers') const protobuf = require('protocol-buffers')
const path = require('path') const path = require('path')
const isNode = !global.window
// protobuf read from file // protobuf read from file
const messages = isNode ? protobuf(fs.readFileSync(path.resolve(__dirname, 'pb/crypto.proto'))) : protobuf(require('buffer!./pb/crypto.proto')) const messages = protobuf(fs.readFileSync(path.resolve(__dirname, '../protos/crypto.proto')))
exports = module.exports = Id exports = module.exports = Id

View File

@ -1,5 +1,4 @@
/* globals describe, it */ /* eslint-env mocha */
'use strict' 'use strict'
const expect = require('chai').expect const expect = require('chai').expect
@ -70,4 +69,3 @@ describe('id', function (done) {
done() done()
}) })
}) })

View File

@ -1,29 +0,0 @@
var path = require('path')
module.exports = {
name: 'peerid',
context: __dirname,
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'peer-id.js',
libraryTarget: 'var',
library: 'PeerId'
},
resolve: {
extensions: ['', '.js', '.json'],
alias: { 'node-forge': path.resolve(__dirname, 'deps/forge.bundle.js') }
},
externals: {
fs: '{}'
},
node: {
Buffer: true
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json' }
],
noParse: []
}
}