Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: reduce bundle size (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias authored and vasco-santos committed Mar 18, 2019
1 parent 28bcdf8 commit f79eeb2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
bundlesize: { maxSize: '191kB' }
}

6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ node_js:
os:
- linux
- osx
- windows

script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov

jobs:
include:
- os: windows
filter_secrets: false
cache: false

- stage: check
script:
- npx aegir build --bundlesize
- npx aegir commitlint --travis
- npx aegir dep-check
- npm run lint
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Build Status](https://travis-ci.org/libp2p/js-libp2p-kad-dht.svg?style=flat-square)](https://travis-ci.org/libp2p/js-libp2p-kad-dht)
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-kad-dht/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-kad-dht?branch=master)
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-kad-dht.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-kad-dht)
[![Bundle Size](https://flat.badgen.net/bundlephobia/minzip/libp2p-kad-dht)](https://bundlephobia.com/result?p=libp2p-kad-dht)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-kad-dht",
"dependencies": {
"@nodeutils/defaults-deep": "^1.1.0",
"async": "^2.6.2",
"base32.js": "~0.1.0",
"chai-checkmark": "^1.0.1",
Expand All @@ -50,6 +49,7 @@
"k-bucket": "^5.0.0",
"libp2p-crypto": "~0.16.0",
"libp2p-record": "~0.6.2",
"merge-options": "^1.0.1",
"multihashes": "~0.4.14",
"multihashing-async": "~0.5.2",
"peer-id": "~0.12.2",
Expand All @@ -59,7 +59,7 @@
"pull-length-prefixed": "^1.3.1",
"pull-stream": "^3.6.9",
"varint": "^5.0.0",
"xor-distance": "^1.0.0"
"xor-distance": "^2.0.0"
},
"devDependencies": {
"aegir": "^18.1.1",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Providers = require('./providers')
const Message = require('./message')
const RandomWalk = require('./random-walk')
const assert = require('assert')
const defaultsDeep = require('@nodeutils/defaults-deep')
const mergeOptions = require('merge-options')

/**
* A DHT implementation modeled after Kademlia with S/Kademlia modifications.
Expand Down Expand Up @@ -58,7 +58,7 @@ class KadDHT extends EventEmitter {
options = options || {}
options.validators = options.validators || {}
options.selectors = options.selectors || {}
options.randomWalk = defaultsDeep(options.randomWalk, c.defaultRandomWalk)
options.randomWalk = mergeOptions(c.defaultRandomWalk, options.randomWalk)

/**
* Local reference to the libp2p-switch instance
Expand Down

0 comments on commit f79eeb2

Please sign in to comment.