From 10ccd58f16ac534a2cade1100e8bdf350e16340a Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Wed, 9 May 2018 13:44:32 -0700 Subject: [PATCH 1/7] fix: upgrade datastores for node 10 move the responsibility of levelup browser support to datastore-level License: MIT Signed-off-by: Jacob Heun --- package.json | 7 ++----- src/default-options-browser.js | 10 ++-------- test/options-test.js | 6 ------ 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 60e5881a..f982f53d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "browser": { "rimraf": false, "datastore-fs": "datastore-level", - "leveldown": "level-js", "./src/lock.js": "./src/lock-memory.js", "./src/default-options.js": "./src/default-options-browser.js" }, @@ -59,13 +58,11 @@ "big.js": "^5.0.3", "cids": "~0.5.3", "datastore-core": "~0.4.0", - "datastore-fs": "~0.4.2", - "datastore-level": "~0.7.0", + "datastore-fs": "github:ipfs/js-datastore-fs#fix/node10", + "datastore-level": "github:ipfs/js-datastore-level#fix/node10", "debug": "^3.1.0", "interface-datastore": "~0.4.2", "ipfs-block": "~0.7.1", - "level-js": "timkuijsten/level.js#idbunwrapper", - "leveldown": "^1.7.2", "lock-me": "^1.0.3", "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", diff --git a/src/default-options-browser.js b/src/default-options-browser.js index c9c85b1f..9a848d4b 100644 --- a/src/default-options-browser.js +++ b/src/default-options-browser.js @@ -11,19 +11,13 @@ module.exports = { }, storageBackendOptions: { root: { - db: require('level-js'), extension: '' }, blocks: { - sharding: false, - db: require('level-js') + sharding: false }, keys: { - sharding: false, - db: require('level-js') - }, - datastore: { - db: require('level-js') + sharding: false } } } diff --git a/test/options-test.js b/test/options-test.js index 6598210f..b7afb606 100644 --- a/test/options-test.js +++ b/test/options-test.js @@ -86,15 +86,9 @@ function expectedRepoOptions () { } if (process.browser) { - options.storageBackendOptions.root.db = require('leveldown') - options.storageBackendOptions.keys.db = require('leveldown') options.storageBackendOptions.keys.sharding = false - options.storageBackendOptions.blocks.db = require('leveldown') delete options.storageBackendOptions.blocks.extension options.storageBackendOptions.blocks.sharding = false - options.storageBackendOptions.datastore = { - db: require('leveldown') - } } return options } From 1454ddafeec74ee27b9ebcab6c890922ec4e1e2b Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Wed, 9 May 2018 14:19:07 -0700 Subject: [PATCH 2/7] chore: add node 10 to jenkins License: MIT Signed-off-by: Jacob Heun chore: use 10.0 instead of 10.1 License: MIT Signed-off-by: Jacob Heun --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index c1e3f2cd..61bebff4 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -1 +1 @@ -javascript() +javascript(['nodejs_versions': ['10.0.0']]) From ee53f7854076d154f45509423b164d223f41ebed Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Mon, 14 May 2018 08:48:15 -0700 Subject: [PATCH 3/7] chore: update jenkins overrides License: MIT Signed-off-by: Jacob Heun --- ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 61bebff4..2ad674e5 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -1 +1 @@ -javascript(['nodejs_versions': ['10.0.0']]) +javascript(['nodejs_versions': ['8.11.1','9.2.0','10.0.0']]) From 2f5184608ac216e56c7237e3e6a26a3a757e7a69 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Tue, 15 May 2018 15:15:56 -0700 Subject: [PATCH 4/7] fix: keep initialized errors separate from unknowns License: MIT Signed-off-by: Jacob Heun --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index a7096078..be6ca9ad 100644 --- a/src/index.js +++ b/src/index.js @@ -212,14 +212,14 @@ class IpfsRepo { }, (err, res) => { log('init', err, res) - if (err) { + if (err && !res.config) { return callback(Object.assign(new Error('repo is not initialized yet'), { code: 'ERR_REPO_NOT_INITIALIZED', path: this.path })) } - callback() + callback(err) } ) } From 2c3b0cf4d1cc05d2543a6a9917b7f5a01a05cba4 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Thu, 17 May 2018 14:40:11 -0700 Subject: [PATCH 5/7] refactor: move error code to an exported constant --- src/errors/index.js | 3 +++ src/index.js | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/errors/index.js diff --git a/src/errors/index.js b/src/errors/index.js new file mode 100644 index 00000000..3e0f3647 --- /dev/null +++ b/src/errors/index.js @@ -0,0 +1,3 @@ +'use strict' + +exports.ERR_REPO_NOT_INITIALIZED = 'ERR_REPO_NOT_INITIALIZED' diff --git a/src/index.js b/src/index.js index be6ca9ad..c7fcba72 100644 --- a/src/index.js +++ b/src/index.js @@ -16,6 +16,7 @@ const config = require('./config') const apiAddr = require('./api-addr') const blockstore = require('./blockstore') const defaultOptions = require('./default-options') +const ERRORS = require('./errors') const log = debug('repo') @@ -215,7 +216,7 @@ class IpfsRepo { if (err && !res.config) { return callback(Object.assign(new Error('repo is not initialized yet'), { - code: 'ERR_REPO_NOT_INITIALIZED', + code: ERRORS.ERR_REPO_NOT_INITIALIZED, path: this.path })) } @@ -355,7 +356,9 @@ function ignoringAlreadyOpened (cb) { } function ignoringNotFound (cb) { - return ignoringIf((err) => err.message.startsWith('ENOENT'), cb) + return ignoringIf((err) => { + return err && (err.code === ERRORS.ERR_REPO_NOT_INITIALIZED || err.message.startsWith('ENOENT')) + }, cb) } function buildOptions (_options) { From fa9c7a62140de6851343d732d73212fb00498473 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Tue, 22 May 2018 00:13:22 +0200 Subject: [PATCH 6/7] chore: update deps License: MIT Signed-off-by: Jacob Heun --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f982f53d..6ecaa226 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "debug": "^3.1.0", "interface-datastore": "~0.4.2", "ipfs-block": "~0.7.1", - "lock-me": "^1.0.3", + "lock-me": "github:jacobheun/lock-me#fix/windows", "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", "lodash.set": "^4.3.2", From c0bba88c27bd6b1da0a0238d97081356d2b16a83 Mon Sep 17 00:00:00 2001 From: David Dias Date: Tue, 29 May 2018 15:51:09 +0100 Subject: [PATCH 7/7] chore: update deps --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6ecaa226..c4545534 100644 --- a/package.json +++ b/package.json @@ -58,12 +58,12 @@ "big.js": "^5.0.3", "cids": "~0.5.3", "datastore-core": "~0.4.0", - "datastore-fs": "github:ipfs/js-datastore-fs#fix/node10", - "datastore-level": "github:ipfs/js-datastore-level#fix/node10", + "datastore-fs": "~0.5.0", + "datastore-level": "~0.8.0", "debug": "^3.1.0", "interface-datastore": "~0.4.2", "ipfs-block": "~0.7.1", - "lock-me": "github:jacobheun/lock-me#fix/windows", + "lock-me": "^1.0.4", "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", "lodash.set": "^4.3.2",