From 350103f3837c224b2202f8abadf82e796e2af44c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 5 Dec 2018 19:51:18 +0000 Subject: [PATCH] feat: clean repo and bundle size reduction --- .npmignore | 28 ---------------------------- .travis.yml | 32 -------------------------------- appveyor.yml | 29 ----------------------------- circle.yml | 15 --------------- package.json | 33 +++++++++++++++------------------ src/index.js | 2 +- src/multiaddr-set.js | 4 ++-- 7 files changed, 18 insertions(+), 125 deletions(-) delete mode 100644 .npmignore delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 circle.yml diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 9e7af1f..0000000 --- a/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history - -test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5102ee5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories. -sudo: false -language: node_js - -matrix: - include: - - node_js: 6 - env: CXX=g++-4.8 - - node_js: 8 - env: CXX=g++-4.8 - # - node_js: stable - # env: CXX=g++-4.8 - -script: - - npm run lint - - npm run test - - npm run coverage - -before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - -after_success: - - npm run coverage-publish - -addons: - firefox: 'latest' - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 046bf91..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories. -version: "{build}" - -environment: - matrix: - - nodejs_version: "6" - - nodejs_version: "8" - -matrix: - fast_finish: true - -install: - # Install Node.js - - ps: Install-Product node $env:nodejs_version - - # Upgrade npm - - npm install -g npm - - # Output our current versions for debugging - - node --version - - npm --version - - # Install our package dependencies - - npm install - -test_script: - - npm run test:node - -build: off diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 0009693..0000000 --- a/circle.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories. -machine: - node: - version: stable - -dependencies: - pre: - - google-chrome --version - - curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - - sudo dpkg -i google-chrome.deb || true - - sudo apt-get update - - sudo apt-get install -f - - sudo apt-get install --only-upgrade lsb-base - - sudo dpkg -i google-chrome.deb - - google-chrome --version diff --git a/package.json b/package.json index 0917122..f6b0cec 100644 --- a/package.json +++ b/package.json @@ -14,39 +14,36 @@ "release-minor": "aegir release --type minor", "release-major": "aegir release --type major", "coverage": "aegir coverage", - "coverage-publish": "aegir coverage --provider coveralls" - }, - "repository": { - "type": "git", - "url": "https://github.com/libp2p/js-peer-info.git" + "coverage-publish": "aegir coverage --provider coveralls", + "size": "bundlesize -f dist/index.min.js -s 212kB" }, + "files": [ + "src", + "dist" + ], + "repository": "github:libp2p/js-peer-info", "keywords": [ "IPFS" ], "engines": { - "node": ">=6.0.0", - "npm": ">=3.0.0" + "node": ">=10.0.0", + "npm": ">=6.0.0" }, "license": "MIT", - "bugs": { - "url": "https://github.com/libp2p/js-peer-info/issues" - }, + "bugs": "https://github.com/libp2p/js-peer-info/issues", "homepage": "https://github.com/libp2p/js-peer-info", - "pre-push": [ - "lint", - "test" - ], "devDependencies": { - "aegir": "^17.1.1", + "aegir": "ipfs/aegir#fix/babel", "buffer-loader": "0.1.0", + "bundlesize": "~0.17.0", "chai": "^4.2.0", "dirty-chai": "^2.0.1" }, "dependencies": { - "multiaddr": "^5.0.2", "mafmt": "^6.0.2", - "lodash.uniqby": "^4.7.0", - "peer-id": "~0.12.0" + "multiaddr": "multiformats/js-multiaddr#feat/bundle-size", + "peer-id": "libp2p/js-peer-id#feat/bundle-size", + "unique-by": "^1.0.0" }, "contributors": [ "Arnaud ", diff --git a/src/index.js b/src/index.js index 4706128..1df9a92 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ 'use strict' const PeerId = require('peer-id') -const ensureMultiaddr = require('./utils').ensureMultiaddr +const { ensureMultiaddr } = require('./utils') const MultiaddrSet = require('./multiaddr-set') const assert = require('assert') diff --git a/src/multiaddr-set.js b/src/multiaddr-set.js index 8235556..75b282d 100644 --- a/src/multiaddr-set.js +++ b/src/multiaddr-set.js @@ -1,7 +1,7 @@ 'use strict' -const ensureMultiaddr = require('./utils').ensureMultiaddr -const uniqBy = require('lodash.uniqby') +const { ensureMultiaddr } = require('./utils') +const uniqBy = require('unique-by') // Because JavaScript doesn't let you overload the compare in Set().. class MultiaddrSet {