Skip to content

Commit

Permalink
feat: let js-ipfs create a repo for itself, no need to import ipfs-repo
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed May 14, 2018
1 parent 825f74a commit 42597c1
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 94 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"hapi": "^16.6.2",
"hat": "0.0.3",
"ipfs-api": "^21.0.0",
"ipfs-repo": "~0.20.0",
"joi": "^13.1.2",
"lodash.clone": "^4.5.0",
"lodash.defaults": "^4.2.0",
Expand Down
4 changes: 1 addition & 3 deletions src/ipfsd-in-proc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const multiaddr = require('multiaddr')
const defaultsDeep = require('lodash.defaultsdeep')
const createRepo = require('./utils/repo/create-nodejs')
const defaults = require('lodash.defaults')
const waterfall = require('async/waterfall')
const debug = require('debug')
Expand Down Expand Up @@ -31,7 +30,6 @@ class Node extends EventEmitter {

this.opts.args = this.opts.args || []
this.path = this.opts.repoPath
this.repo = createRepo(this.path)
this.disposable = this.opts.disposable
this.clean = true
this._apiAddr = null
Expand Down Expand Up @@ -64,7 +62,7 @@ class Node extends EventEmitter {
})

this.exec = new IPFS({
repo: this.repo,
repo: this.path,
init: false,
start: false,
pass: this.opts.pass,
Expand Down
28 changes: 0 additions & 28 deletions src/utils/repo/create-browser.js

This file was deleted.

41 changes: 0 additions & 41 deletions src/utils/repo/create-nodejs.js

This file was deleted.

21 changes: 0 additions & 21 deletions test/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const path = require('path')
const flatten = require('../src/utils/flatten')
const tempDir = require('../src/utils/tmp-dir')
const findIpfsExecutable = require('../src/utils/find-ipfs-executable')
const createRepo = require('../src/utils/repo/create-nodejs')

const IPFSRepo = require('ipfs-repo')

Expand Down Expand Up @@ -63,25 +62,5 @@ describe('utils', () => {
expect(fs.existsSync(execPath)).to.be.ok()
})
})

describe('.createRepo', () => {
let repo = null
let repoPath = tempDir()

it('should create repo', () => {
repo = createRepo(repoPath)
expect(repo).to.exist()
expect(repo).to.be.instanceOf(IPFSRepo)
expect(fs.existsSync(repoPath)).to.be.ok()
})

it('should cleanup repo', (done) => {
repo.teardown((err) => {
expect(err).to.not.exist()
expect(!fs.existsSync(repoPath)).to.be.ok()
done()
})
})
})
}
})

0 comments on commit 42597c1

Please sign in to comment.