-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make LevelDOWN an optional dependency #119
Conversation
@rvagg npm installs peer deps automatically if one isn't already there |
@Raynos aye, you're right! So ignoring the peerDependencies dep, I'd still like discussion about detaching LevelUP from LevelDOWN. |
@rvagg +1 for me. I want to to implement the leveldown API for indexeddb again at some point. The problem with leveldown as a peer dep is I dont want levelup to have binary dependencies when used with indexeddb. |
I guess if we can't pin version with Of course we could introduce a third package that does the bundling, or push the LevelUP stuff into the third package and expose it here along with the LevelDOWN dependency. Perhaps that's getting a bit out of hand though. |
@rvagg we could fix peer deps to not auto install it. |
@domenic do you have thoughts on changing |
@rvagg we can just peer depend on abstract leveldown. This at least means we can match the versions of leveldown & abstract leveldown |
Also! If leveldown peer deps on abstract leveldown then we get an npm error if the versions of leveldown & levelup you use dont work together! |
Yeah, there were some musings on "optionalPeerDependencies". Sounds like they're gathering support, hmm. |
@Raynos true, then we can just treat AbstractLevelDOWN as the API spec. Would like feedback from others' regarding usability and if you think this might create problems from people who just want to use leveldb and don't want to have to mess with understanding the dependencies required. |
Would AbstractLevelDOWN depend on LevelDOWN? If yes, we're not gaining anything, right? And if not, that won't help with the simple As soon as we have LevelJS this is a no-brainer, just depend LevelJS and use LevelDOWN only when installed (like with redis and hiredis). For now we can either:
I quite like the 2nd option. |
AbstractLevelDOWN would be a peerDependency for both LevelUP & LevelDOWN, so its version would define the LevelDOWN API version. When you |
The only sane way to do this is to republish levelup into a new module without leveldown, and then publish a levelup-down module (possibly changing names) or... publish levelup again, without leveldown. So, either have Heh, in a way, levelup is becoming a "template" and you inject an level-down parameter. |
@dominictarr that's what I propose |
whoa! these are competitive times for npm names, careful announcing something like that in public! |
There arn't many 5 letter names left. That is a sign! |
@rvagg haha you already took it :) |
tis here. So, it sounds like the way forward is to detach LevelDOWN from LevelUP and use this new package to bundle them together. Currently it's simply an And, I still like the idea of pinning AbstractLevelDOWN as a peerDependency to both LevelUP and LevelDOWN to keep them in sync. |
Consider this a discussion pull request.
We now have a
'db'
option on init that can swap out LevelDOWN with a suitable replacement (e.g. MemDOWN or other via Abstract LevelDOWN). We'll hopefully one day have pure JS implementation(s) of LevelDB available to swap in.So, it would be nice to not have to pull in a compiled dependency if you weren't going to need it.
This PR makes it an optional dependency but pins the version with a
'peerDependency'
. It would just add complication to install instructions because we'd have to instruct people tonpm install levelup leveldown
but hopefully the thrownError
would help with that.Thoughts?