Make `level` dependency installation optional
See original GitHub issueFirst thanks for this module, I use it a lot and it’s great work!
Is your feature request related to a problem? Please describe.
level
uses leveldown
which is a native module. Installing this native module is slow and can more than double the time required by npm install
on a project. Considering the code provides alternative stores such as files and in-memory, there should be a way to opt-out of installing this native module.
I am not 100% sure but I am assuming stores are used to cache results between different runs (correct me if I’m wrong). If so I think faster read/writes or smaller cache size are nice-to-have, but I am not sure this justifies doubling the time required by npm install
.
Describe the solution you’d like Any solution works, but one that might work would be:
- try to
require('level')
. If this throws, userequire('level-js')
instead - replace
level
bylevel-js
inpackage.json
dependencies
I.e. to use the native module, level
must be manually installed by users.
Describe alternatives you’ve considered
optionalDependencies
do not work here because they are still installed and are meant for a different purpose.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
It makes sense to make separate levelDB package for checking big repos. I think I will do that
Just for information purpose: I’ve tried each store on a medium-size repository and got the following average times: 20 seconds for
level
and 15 seconds for bothmemory
andfiles
.Another perk for
memory
is that it does not create.jscpd
folder, although that’s not a huge issue (just need to add it to.gitignore
).