-
Notifications
You must be signed in to change notification settings - Fork 15
fix: upgrade level libs to resolve node 10 failure #7
Conversation
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
It would be great if this could get merged as I'm seeing Level/leveldown#194 in js-ipfs which seems to have been resolved but the fix was released in a later version. |
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny issue otherwise LGTM
src/index.js
Outdated
})) | ||
// Default to leveldown db | ||
const database = opts && opts.db ? opts.db : require('leveldown') | ||
delete opts.db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs an existence check like the line above otherwise ReferenceError: opts is not defined
for null
/undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and a test? ;)
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
@alanshaw yes, thanks for pointing that out. I've added tests for default and override configuration. I've also added levedown to the interface test suites so we can ensure those pluggable databases are working properly with dependency upgrades. |
@alanshaw this should be good, can you take a look and approve if all looks good? This is being used in the js-ipfs node 10 fix which I have jenkins builds passing for https://github.com/ipfs/js-ipfs/pull/1358/files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me, but please add a note about who is responsible for shimming to the readme
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
@dignifiedquire thanks for pointing that out, I updated the readme to reference the shimming expectations. This should be good to merge now, once that's verified and it's re-approved. |
src/index.js
Outdated
database(path), | ||
Object.assign({}, opts, { | ||
compression: false, // same default as go | ||
valueEncoding: 'binary' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI levelup
v2 no longer includes encodings, so this valueEncoding
option will have no effect.
Instead, wrap database(path)
with encoding-down
. See UPGRADING.md for more.
License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
Thanks for pointing that out @vweevers, I've updated the code to reflect the levelup upgrading guide and tested this against ipfs-repo. Pending reviews, this should good to go. |
This upgrades the versions of leveldown, levelup and level-js to resolve a node 10.x build issue in ipfs-repo.
This also moves the responsibility of shiming leveldown with level-js for the browser. The version of level-js has been changed to match the current version in js-ipfs-repo.
I've run this against the ipfs-repo test suite, but still would like to run it against js-ipfs.
connects to ipfs/js-ipfs#1347
connects to ipfs/js-ipfs-repo#167
resolves #6