Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 90e97a1

Browse files
committed
chore: tidy up linting
1 parent 0953f0d commit 90e97a1

File tree

30 files changed

+422
-223
lines changed

30 files changed

+422
-223
lines changed

packages/interface-ipfs-core/src/add-all.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const { isNode } = require('ipfs-utils/src/env')
1515
const { getDescribe, getIt, expect } = require('./utils/mocha')
1616
const testTimeout = require('./utils/test-timeout')
1717
const uint8ArrayFromString = require('uint8arrays/from-string')
18-
const pushable = require('it-pushable')
1918

2019
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
2120
/**

packages/ipfs-client/.aegir.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
'use strict'
2+
3+
const { createFactory } = require('ipfsd-ctl')
4+
5+
const factory = createFactory({
6+
type: 'js',
7+
test: true,
8+
disposable: true,
9+
ipfsHttpModule: require('../ipfs-http-client'),
10+
ipfsBin: require.resolve('../ipfs/src/cli.js')
11+
})
12+
13+
module.exports = {
14+
bundlesize: { maxSize: '81kB' },
15+
karma: {
16+
files: [{
17+
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
18+
watched: false,
19+
served: true,
20+
included: false
21+
}],
22+
browserNoActivityTimeout: 210 * 1000,
23+
singleRun: true
24+
},
25+
hooks: {
26+
pre: async () => {
27+
const node = await factory.spawn()
28+
29+
return {
30+
env: {
31+
GRPC_SERVER: node.grpcAddr,
32+
HTTP_SERVER: node.apiAddr
33+
}
34+
}
35+
},
36+
post: () => factory.clean()
37+
}
38+
}

packages/ipfs-client/README.md

Whitespace-only changes.

packages/ipfs-client/package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "ipfs-client",
3+
"version": "0.0.0",
4+
"description": "A client library to talk to local IPFS daemons",
5+
"keywords": [
6+
"ipfs"
7+
],
8+
"homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-client#readme",
9+
"bugs": "https://github.com/ipfs/js-ipfs/issues",
10+
"license": "(Apache-2.0 OR MIT)",
11+
"leadMaintainer": "Alex Potsides <[email protected]>",
12+
"files": [
13+
"src",
14+
"dist"
15+
],
16+
"main": "src/index.js",
17+
"typesVersions": {
18+
"*": {
19+
"*": [
20+
"dist/*"
21+
]
22+
}
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/ipfs/js-ipfs.git"
27+
},
28+
"scripts": {
29+
"test": "aegir test -f ./test/interface-client.js",
30+
"lint": "aegir lint",
31+
"build": "npm run build:js && npm run build:types",
32+
"build:js": "aegir build",
33+
"build:types": "tsc --build",
34+
"coverage": "npx nyc -r html npm run test:node -- --bail",
35+
"clean": "rm -rf ./dist",
36+
"dep-check": "aegir dep-check"
37+
},
38+
"dependencies": {
39+
"debug": "^4.1.1",
40+
"ipfs-grpc-client": "0.0.0",
41+
"ipfs-http-client": "^48.1.0"
42+
},
43+
"devDependencies": {
44+
"aegir": "^28.0.0",
45+
"cross-env": "^7.0.0",
46+
"ipfs-grpc-server": "0.0.0",
47+
"interface-ipfs-core": "^0.141.0",
48+
"typescript": "^4.0.3"
49+
}
50+
}

packages/ipfs-client/src/index.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use strict'
2+
3+
const httpClient = require('ipfs-http-client')
4+
const grpcClient = require('ipfs-grpc-client')
5+
const toUri = require('multiaddr-to-uri')
6+
const debug = require('debug')('ipfs:client')
7+
8+
module.exports = async function createClient (opts = {}) {
9+
opts = opts || {}
10+
11+
debug('ws', opts.grpc)
12+
debug('ht', opts.http)
13+
14+
opts.grpc = toUri(opts.grpc.replace(/\/ws$/, ''))
15+
opts.http = toUri(opts.http)
16+
17+
debug('ws', opts.grpc)
18+
debug('ht', opts.http)
19+
20+
const http = httpClient({
21+
...opts,
22+
url: opts.http
23+
})
24+
25+
const grpc = grpcClient({
26+
...opts,
27+
url: opts.grpc
28+
})
29+
30+
try {
31+
// call a cheap method to see if gRPC is supported
32+
await grpc.id()
33+
34+
// override supported methods, everything else falls back to HTTP
35+
return {
36+
...http,
37+
...grpc
38+
}
39+
} catch (err) {
40+
debug(err)
41+
}
42+
43+
return http
44+
}

packages/ipfs-client/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist"
5+
},
6+
"include": [
7+
"src",
8+
"package.json"
9+
]
10+
}

packages/ipfs-core-utils/src/files/normalise-input/utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ function isFileObject (obj) {
3535
const isReadableStream = (value) =>
3636
value && typeof value.getReader === 'function'
3737

38-
'use strict'
39-
4038
/**
4139
* @param {any} mtime
4240
* @returns {{secs:number, nsecs:number}|undefined}

packages/ipfs-core-utils/src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
'use strict'
2+
3+
/**
4+
* @template {any[]} ARGS
5+
* @template R
6+
* @typedef {(...args: ARGS) => R} Fn
7+
*/

packages/ipfs-core/.aegir.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let sigServerB
1515
let ipfsdServer
1616

1717
module.exports = {
18-
bundlesize: { maxSize: '523kB' },
18+
bundlesize: { maxSize: '560kB' },
1919
karma: {
2020
files: [{
2121
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',

packages/ipfs-grpc-client/.aegir.js

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,5 @@
11
'use strict'
22

3-
const { createFactory } = require('ipfsd-ctl')
4-
5-
const factory = createFactory({
6-
type: 'js',
7-
test: true,
8-
disposable: true,
9-
ipfsHttpModule: require('../ipfs-http-client'),
10-
ipfsBin: require.resolve('../ipfs/src/cli.js')
11-
})
12-
133
module.exports = {
14-
bundlesize: { maxSize: '81kB' },
15-
karma: {
16-
files: [{
17-
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
18-
watched: false,
19-
served: true,
20-
included: false
21-
}],
22-
browserNoActivityTimeout: 210 * 1000,
23-
singleRun: true
24-
},
25-
hooks: {
26-
pre: async () => {
27-
const node = await factory.spawn()
28-
29-
return {
30-
env: {
31-
GRPC_SERVER: node.grpcAddr,
32-
HTTP_SERVER: node.apiAddr
33-
}
34-
}
35-
},
36-
post: () => factory.clean()
37-
}
4+
bundlesize: { maxSize: '81kB' }
385
}

packages/ipfs-grpc-client/README.md

Whitespace-only changes.

packages/ipfs-grpc-client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"url": "git+https://github.com/ipfs/js-ipfs.git"
3030
},
3131
"scripts": {
32-
"test": "aegir test -f ./test/interface-grpc-client.js",
32+
"test": "aegir test",
3333
"lint": "aegir lint",
3434
"build": "npm run build:js && npm run build:types",
3535
"build:js": "aegir build",
@@ -44,11 +44,11 @@
4444
"@improbable-eng/grpc-web": "^0.13.0",
4545
"@improbable-eng/grpc-web-node-http-transport": "^0.13.0",
4646
"@types/google-protobuf": "^3.7.4",
47+
"debug": "^4.1.1",
4748
"err-code": "^2.0.3",
4849
"google-protobuf": "^3.13.0",
4950
"ipfs-core-utils": "^0.5.0",
5051
"ipfs-grpc-protocol": "0.0.0",
51-
"ipfs-http-client": "^48.0.0",
5252
"ipfs-utils": "^4.0.0",
5353
"it-pushable": "^1.4.0"
5454
},

0 commit comments

Comments
 (0)