question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make `level` dependency installation optional

See original GitHub issue

First 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, use require('level-js') instead
  • replace level by level-js in package.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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kucherenkocommented, Feb 21, 2019

It makes sense to make separate levelDB package for checking big repos. I think I will do that

1reaction
ehmickycommented, Feb 22, 2019

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 both memory and files.

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven – Optional Dependencies and Dependency Exclusions
This section discusses optional dependencies and dependency exclusions. This will help users to understand what they are and when and how to use...
Read more >
Optional Dependency in Maven | Baeldung
As we're going to see we can include the <optional> element with a value of true to make any Maven dependency optional.
Read more >
Optional dependency groups omitting package requirements
Creating a lite or production group which removes dependencies which are installed by default to aid development. For example uvicorn has a ...
Read more >
How to Install and Correct Dependencies Issues in Ubuntu
This command updates all of our software including any dependencies. The second command will list all software packages it wants to install/ ...
Read more >
How can I install a package without installing its dependencies?
By default, apt-get install installs all dependencies at the “depends” or “recommends” level. Pass the --no-install-recommends option to tell it ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found