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

Commit

Permalink
refactor: no separate boot procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed Dec 10, 2019
1 parent 4f9ba62 commit d8e82b7
Show file tree
Hide file tree
Showing 26 changed files with 556 additions and 1,286 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
],
"main": "src/core/index.js",
"browser": {
"./src/core/components/init-assets.js": false,
"./src/core/runtime/init-assets-nodejs.js": "./src/core/runtime/init-assets-browser.js",
"./src/core/runtime/add-from-fs-nodejs.js": "./src/core/runtime/add-from-fs-browser.js",
"./src/core/runtime/config-nodejs.js": "./src/core/runtime/config-browser.js",
Expand All @@ -26,7 +25,8 @@
"./src/core/runtime/repo-nodejs.js": "./src/core/runtime/repo-browser.js",
"./src/core/runtime/ipld-nodejs.js": "./src/core/runtime/ipld-browser.js",
"./test/utils/create-repo-nodejs.js": "./test/utils/create-repo-browser.js",
"stream": "readable-stream"
"stream": "readable-stream",
"ipfs-utils/src/files/glob-source": false
},
"browser-all-ipld-formats": {
"./src/core/runtime/ipld-browser.js": "./src/core/runtime/ipld-browser-all.js"
Expand Down Expand Up @@ -101,15 +101,15 @@
"ipfs-bitswap": "^0.26.0",
"ipfs-block": "~0.8.1",
"ipfs-block-service": "~0.16.0",
"ipfs-http-client": "^40.0.1",
"ipfs-http-client": "github:ipfs/js-ipfs-http-client#refactor/async-iterables2",
"ipfs-http-response": "~0.4.0",
"ipfs-mfs": "^0.13.2",
"ipfs-multipart": "^0.2.0",
"ipfs-repo": "^0.30.0",
"ipfs-unixfs": "~0.1.16",
"ipfs-unixfs-exporter": "^0.38.0",
"ipfs-unixfs-importer": "^0.40.0",
"ipfs-utils": "~0.4.0",
"ipfs-utils": "^0.5.0",
"ipld": "~0.25.0",
"ipld-bitcoin": "~0.3.0",
"ipld-dag-cbor": "~0.15.0",
Expand Down Expand Up @@ -206,9 +206,9 @@
"execa": "^3.0.0",
"form-data": "^3.0.0",
"hat": "0.0.3",
"interface-ipfs-core": "^0.124.1",
"interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#refactor/async-iterables",
"ipfs-interop": "^0.1.1",
"ipfsd-ctl": "^0.47.2",
"ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#fix/do-not-call-shutdown-twice",
"libp2p-websocket-star": "~0.10.2",
"lodash": "^4.17.15",
"ncp": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = {
let finalHash

try {
for await (const file of ipfs._addAsyncIterator(source, options)) {
for await (const file of ipfs.add(source, options)) {
if (argv.silent) {
continue
}
Expand All @@ -184,7 +184,7 @@ module.exports = {
bar.terminate()
}

// Tweak the error message and add more relevant infor for the CLI
// Tweak the error message and add more relevant info for the CLI
if (err.code === 'ERR_DIR_NON_RECURSIVE') {
err.message = `'${err.path}' is a directory, use the '-r' flag to specify directories`
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = {
const IPFS = require('../../core')
const Repo = require('ipfs-repo')

const node = new IPFS({
const node = await IPFS.create({
repo: new Repo(path),
init: false,
start: false,
Expand Down
4 changes: 1 addition & 3 deletions src/cli/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ class Daemon {

// start the daemon
const ipfsOpts = Object.assign({}, { init: true, start: true, libp2p }, this._options)
const ipfs = await IPFS.create(ipfsOpts)

this._ipfs = ipfs
const ipfs = this._ipfs = await IPFS.create(ipfsOpts)

// start HTTP servers (if API or Gateway is enabled in options)
const httpApi = new HttpApi(ipfs, ipfsOpts)
Expand Down
10 changes: 5 additions & 5 deletions src/core/api-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module.exports = class ApiManager {
this._api = {}
this._onUndef = () => undefined
this.api = new Proxy({}, {
get (target, prop) {
return target[prop] === undefined
? this._onUndef(prop)
: target[prop]
}
get: (_, prop) => {
if (prop === 'then') return undefined // Not a promise!
return this._api[prop] === undefined ? this._onUndef(prop) : this._api[prop]
},
has: (_, prop) => prop in this._api
})
}

Expand Down
90 changes: 0 additions & 90 deletions src/core/boot.js

This file was deleted.

15 changes: 0 additions & 15 deletions src/core/components-ipfsx/index.js

This file was deleted.

Loading

0 comments on commit d8e82b7

Please sign in to comment.