Skip to content

Commit

Permalink
chore: removed unused and add missing deps (#3395)
Browse files Browse the repository at this point in the history
Removes all unused dependencies, adds missing ones.

Also runs prod & unused dep checks in CI.
  • Loading branch information
achingbrain authored Nov 16, 2020
1 parent e1a9712 commit c281053
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 66 deletions.
43 changes: 3 additions & 40 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict'

const { createServer } = require('ipfsd-ctl')
const EchoServer = require('aegir/utils/echo-server')


const server = createServer({
host: '127.0.0.1',
Expand All @@ -13,50 +11,15 @@ const server = createServer({
ipfsBin: require('go-ipfs').path()
})

let echoServer = new EchoServer()

module.exports = {
bundlesize: { maxSize: '83kB' },
karma: {
files: [{
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
watched: false,
served: true,
included: false
}],
browserNoActivityTimeout: 210 * 1000,
singleRun: true
},
hooks: {
node: {
pre: async () => {
await echoServer.start()
return {
env: {
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
}
}
},
post: () => echoServer.stop()
},
browser: {
pre: async () => {

await Promise.all([
server.start(),
echoServer.start()
])
return {
env: {
ECHO_SERVER: `http://${echoServer.host}:${echoServer.port}`
}
}
await server.start()
},
post: () => {
return Promise.all([
server.stop(),
echoServer.stop()
])
post: async () => {
await server.stop()
}
}
}
Expand Down
24 changes: 10 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
"url": "git+https://github.com/ipfs/js-ipfs.git"
},
"scripts": {
"test": "cross-env ECHO_SERVER_PORT=37490 aegir test",
"test:node": "cross-env ECHO_SERVER_PORT=37491 aegir test -t node",
"test:browser": "cross-env ECHO_SERVER_PORT=37492 aegir test -t browser",
"test:webworker": "cross-env ECHO_SERVER_PORT=37493 aegir test -t webworker",
"test:electron-main": "cross-env ECHO_SERVER_PORT=37494 aegir test -t electron-main",
"test:electron-renderer": "cross-env ECHO_SERVER_PORT=37495 aegir test -t electron-renderer",
"test:chrome": "cross-env ECHO_SERVER_PORT=37496 aegir test -t browser -t webworker -- --browsers ChromeHeadless",
"test:firefox": "cross-env ECHO_SERVER_PORT=37497 aegir test -t browser -t webworker -- --browsers FirefoxHeadless",
"test": "aegir test",
"test:node": "aegir test -t node",
"test:browser": "aegir test -t browser",
"test:webworker": "aegir test -t webworker",
"test:electron-main": "aegir test -t electron-main",
"test:electron-renderer": "aegir test -t electron-renderer",
"test:chrome": "aegir test -t browser -t webworker -- --browsers ChromeHeadless",
"test:firefox": "aegir test -t browser -t webworker -- --browsers FirefoxHeadless",
"lint": "aegir lint",
"build": "npm run build:js && npm run build:types",
"build:js": "aegir build",
"build:types": "tsc --build",
"coverage": "npx nyc -r html npm run test:node -- --bail",
"clean": "rm -rf ./dist",
"dep-check": "aegir dep-check"
"dep-check": "aegir dep-check -i typescript -i ipfs-core"
},
"dependencies": {
"any-signal": "^2.0.0",
Expand All @@ -64,7 +64,6 @@
"it-last": "^1.0.4",
"it-map": "^1.0.4",
"it-tar": "^1.2.2",
"it-to-buffer": "^1.0.2",
"it-to-stream": "^0.1.2",
"merge-options": "^2.0.0",
"multiaddr": "^8.0.0",
Expand All @@ -78,15 +77,12 @@
"uint8arrays": "^1.1.0"
},
"devDependencies": {
"aegir": "^28.0.0",
"cross-env": "^7.0.0",
"aegir": "^28.2.0",
"go-ipfs": "^0.7.0",
"interface-ipfs-core": "^0.142.0",
"ipfs-core": "^0.2.0",
"ipfsd-ctl": "^7.0.2",
"it-all": "^1.0.4",
"it-concat": "^1.0.1",
"it-pipe": "^1.1.0",
"nock": "^13.0.2",
"typescript": "^4.0.3"
},
Expand Down
6 changes: 1 addition & 5 deletions src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const toCamel = require('./lib/object-to-camel')
const configure = require('./lib/configure')
const toUrlSearchParams = require('./lib/to-url-search-params')
const pkg = require('../package.json')

module.exports = configure(api => {
/**
Expand All @@ -17,10 +16,7 @@ module.exports = configure(api => {
headers: options.headers
})

const data = toCamel(await res.json())
data['ipfs-http-client'] = pkg.version

return data
return toCamel(await res.json())
}

return version
Expand Down
9 changes: 2 additions & 7 deletions test/get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
'use strict'

const { expect } = require('aegir/utils/chai')
const loadFixture = require('aegir/fixtures')
const all = require('it-all')
const concat = require('it-concat')

Expand All @@ -13,13 +12,9 @@ const f = require('./utils/factory')()
describe('.get (specific go-ipfs features)', function () {
this.timeout(60 * 1000)

function fixture (path) {
return loadFixture(path, 'interface-ipfs-core')
}

const smallFile = {
cid: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',
data: fixture('test/fixtures/testfile.txt')
cid: 'Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD',
data: 'hello world'
}

let ipfs
Expand Down

0 comments on commit c281053

Please sign in to comment.