diff --git a/conf/webpack.config.js b/conf/webpack.config.js index 16922bf..a9bfe79 100644 --- a/conf/webpack.config.js +++ b/conf/webpack.config.js @@ -22,15 +22,9 @@ export default (env, argv) => { target: 'web', externals: { fs: '{ existsSync: () => true }', - 'fs-shim': '{ existsSync: () => true }', mkdirp: '{}' }, plugins: [ - new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify(process.env.NODE_ENV) - } - }), new webpack.ProvidePlugin({ process: 'process/browser', Buffer: ['buffer', 'Buffer'] diff --git a/package.json b/package.json index 66de109..4396c2c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "dependencies": { "ipfs-pubsub-1on1": "next", "is-node": "^1.0.2", - "localstorage-down": "^0.6.7", "logplease": "^1.2.15", "multihashes": "^4.0.3", "orbit-db-access-controllers": "next", @@ -55,6 +54,7 @@ "go-ipfs": "^0.9.1", "ipfs": "^0.59.0", "ipfsd-ctl": "^10.0.3", + "localstorage-down": "^0.6.7", "localstorage-level-migration": "next", "markdown-toc": "^1.2.0", "mkdirp": "^1.0.4", diff --git a/test/access-controllers/utils/mem-store.js b/test/access-controllers/utils/mem-store.js index e9e1083..1713801 100644 --- a/test/access-controllers/utils/mem-store.js +++ b/test/access-controllers/utils/mem-store.js @@ -3,10 +3,6 @@ import mh from 'multihashes' const defaultHashAlg = 'sha2-256' -// 'use strict' - -// const ImmutableDB from './immutabledb-interface') - const createMultihash = (data, hashAlg) => { return new Promise((resolve, reject) => { multihashing(data, hashAlg || defaultHashAlg, (err, multihash) => { @@ -17,26 +13,16 @@ const createMultihash = (data, hashAlg) => { }) } -// const LRU from 'lru') -// const ImmutableDB from './immutabledb-interface') -// const createMultihash from './create-multihash') - -/* Memory store using an LRU cache */ export default class MemStore { constructor () { - this._store = {}// new LRU(1000) + this._store = {} } async put (value) { - const data = value// new Buffer(JSON.stringify(value)) + const data = value const hash = await createMultihash(data) - // console.log(this._store) - // this._store.set(hash, data) if (!this._store) this._store = {} - // console.log(this._store) - // console.log(hash, data) this._store[hash] = data - // return hash return { toJSON: () => { return { @@ -48,12 +34,6 @@ export default class MemStore { } async get (key) { - // if (data) { - // const value = JSON.parse(data) - // return value - // } - - // return data return { toJSON: () => { return { diff --git a/test/offline-mode.js b/test/offline-mode.js index bcac29c..fcd5770 100644 --- a/test/offline-mode.js +++ b/test/offline-mode.js @@ -6,7 +6,6 @@ import rmrf from 'rimraf' import OrbitDB from '../src/OrbitDB.js' import Identities from 'orbit-db-identity-provider' import Keystore from 'orbit-db-keystore' -import leveldown from 'leveldown' import storageAdapter from 'orbit-db-storage-adapter' // Include test utilities @@ -17,7 +16,7 @@ import { testAPIs, } from 'orbit-db-test-utils' -const storage = storageAdapter(leveldown) +const storage = storageAdapter() const dbPath1 = './orbitdb/tests/offline/db1' const dbPath2 = './orbitdb/tests/offline/db2' diff --git a/test/persistency.js b/test/persistency.js index 8ec404e..7b1a2a8 100644 --- a/test/persistency.js +++ b/test/persistency.js @@ -4,7 +4,6 @@ import rmrf from 'rimraf' import path from 'path' import OrbitDB from '../src/OrbitDB.js' import Cache from 'orbit-db-cache' -import localdown from 'localstorage-down' import Storage from 'orbit-db-storage-adapter' // Include test utilities @@ -22,11 +21,6 @@ const tests = [ title: 'Persistency', orbitDBConfig: { directory: path.join(dbPath, '1') } }, - // { - // title: 'Persistency with custom cache', - // type: "custom", - // orbitDBConfig: { directory: path.join(dbPath, '2') } - // } ] Object.keys(testAPIs).forEach(API => { @@ -41,12 +35,6 @@ Object.keys(testAPIs).forEach(API => { before(async () => { const options = Object.assign({}, test.orbitDBConfig) - if(test.type === "custom") { - const customStorage = Storage(localdown) - const customStore = await customStorage.createStore(dbPath) - options.cache = new Cache(customStore) - } - rmrf.sync(dbPath) ipfsd = await startIpfs(API, config.daemon1) ipfs = ipfsd.api diff --git a/test/set-identity.test.js b/test/set-identity.test.js index d273f36..4dcb782 100644 --- a/test/set-identity.test.js +++ b/test/set-identity.test.js @@ -4,7 +4,6 @@ import rmrf from 'rimraf' import OrbitDB from '../src/OrbitDB.js' import Identities from 'orbit-db-identity-provider' import Keystore from 'orbit-db-keystore' -import leveldown from 'leveldown' import storageAdapter from 'orbit-db-storage-adapter' // Include test utilities @@ -15,7 +14,7 @@ import { testAPIs, } from 'orbit-db-test-utils' -const storage = storageAdapter(leveldown) +const storage = storageAdapter() const keysPath = './orbitdb/identity/identitykeys' const dbPath = './orbitdb/tests/change-identity'