mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-04-25 06:22:24 +00:00
Use dignified.js
This commit is contained in:
parent
f62023f8a7
commit
ab76788771
3
.gitignore
vendored
3
.gitignore
vendored
@ -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
|
||||
|
||||
lib
|
||||
dist
|
75722
dist/peer-id.js
vendored
75722
dist/peer-id.js
vendored
File diff suppressed because one or more lines are too long
@ -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)
|
||||
})
|
||||
}
|
43
package.json
43
package.json
@ -4,18 +4,13 @@
|
||||
"description": "IPFS Peer Id implementation in Node.js",
|
||||
"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",
|
||||
"dist": "webpack"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"dist",
|
||||
"deps"
|
||||
]
|
||||
"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/test.js"
|
||||
},
|
||||
"keywords": [
|
||||
"IPFS"
|
||||
@ -34,22 +29,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/diasdavid/js-peer-id",
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.0",
|
||||
"buffer-loader": "0.0.1",
|
||||
"chai": "^3.5.0",
|
||||
"dignified.js": "github:dignifiedquire/dignified.js",
|
||||
"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",
|
||||
"pre-commit": "^1.1.1",
|
||||
"standard": "^6.0.7",
|
||||
"webpack": "^1.12.14"
|
||||
"pre-commit": "^1.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"bs58": "^3.0.0",
|
||||
@ -60,5 +44,14 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/diasdavid/js-peer-id.git"
|
||||
},
|
||||
"dignified": {
|
||||
"webpack": {
|
||||
"resolve": {
|
||||
"alias": {
|
||||
"node-forge": "../vendor/forge.bundle.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Id is an object representation of a peer Id. a peer Id is a multihash
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const multihashing = require('multihashing')
|
||||
@ -9,10 +10,8 @@ const forge = require('node-forge')
|
||||
const protobuf = require('protocol-buffers')
|
||||
const path = require('path')
|
||||
|
||||
const isNode = !global.window
|
||||
|
||||
// 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
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* globals describe, it */
|
||||
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const expect = require('chai').expect
|
||||
@ -70,4 +69,3 @@ describe('id', function (done) {
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -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: []
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user