Coder Social home page Coder Social logo

Comments (12)

nodkz avatar nodkz commented on May 18, 2024 2

In some cases, mongod binary may download about 1 minute the first time.

Most developers don't know how to increase timeouts in test runners. And by default after 5 seconds tests halts.

So for making testing without additional configuration, I decide to download latest version on postinstall script. It allows starting testing with zero configuration.

from mongodb-memory-server.

guillaumervls avatar guillaumervls commented on May 18, 2024 1

@nodkz Just found this : https://www.npmjs.com/package/find-cache-dir (it's even more popular than
https://www.npmjs.com/package/pkg-conf)

Wouldn't it be even simpler to just use this instead of %HOME/.mongodb-binaries as the default ? Is would solve the problem of polluting the HOME folder and wouldn't require any config !

What do you think ?

from mongodb-memory-server.

AJRdev avatar AJRdev commented on May 18, 2024

@guillaumervls You should use the environnement variable MONGOMS_DOWNLOAD_DIR that specify a path where to download the mongodb binaries instead of the downloadDir option, because it will be used in the postinstall script as well :)

from mongodb-memory-server.

guillaumervls avatar guillaumervls commented on May 18, 2024

Yes I saw that, I find it weird that I'd have to add env vars to opt-out of this. It breaks the simple git clone + npm install... Switching this behavior from opt-out (MONGOMS_DISABLE_POSTINSTALL=1) to opt-in (with something like MONGOMS_ENABLE_POSTINSTALL=1) wouldn't be breaking anything (download of binaries has to be done at some time anyway), and wouldn't pollute home dir by default.

from mongodb-memory-server.

nodkz avatar nodkz commented on May 18, 2024

Disabling downloading via MONGOMS_DISABLE_POSTINSTALL env variable is less evil.

from mongodb-memory-server.

guillaumervls avatar guillaumervls commented on May 18, 2024

Ok then isn't there a more appropriate place to download them (more local to the project) ?

from mongodb-memory-server.

guillaumervls avatar guillaumervls commented on May 18, 2024

Or read a setting from package.json ? Setting an environment variable puts this responsibility on the users of the package using this lib, forcing them to use MONGOMS_DISABLE_POSTINSTALL=1 npm install. With a setting in package.json they could just npm install.

from mongodb-memory-server.

nodkz avatar nodkz commented on May 18, 2024

Sounds sweet if we can provide some vars via package.json or even .dot file.

Any proposal how it can be implemented? Need to use expierence from jest, babel, ts or any other implementation.

I feel your tension and dissapoinment about current ways of configuration. no one has raised this problem yet and you are the first! So let's solve this problem.

from mongodb-memory-server.

guillaumervls avatar guillaumervls commented on May 18, 2024

Cool ! From what I've seen popular modules like Husky, Babel, and Jest, use a package.json key matching their npm name (babel, husky, jest). Only ESLint uses eslintConfig. In our case it could be mongodb-memory-server.

IMHO, special config files like .babelrc should be used if they were so many config options that it could bloat package.json. It may not be necessary for the 7 options available here (the 7 MONGOMS_XXX env vars).

To implement this, I suggest the use of https://www.npmjs.com/package/pkg-conf which seems quite popular, and does exactly what we want.

from mongodb-memory-server.

nodkz avatar nodkz commented on May 18, 2024

@guillaumervls if you have free time you may implement this feature with mongodb-memory-server key in package.json.

My current bandwidth till the end of year does not allow to do it myself 😞

And I will be very glad if somebody takes care about this feature. 🙏
Thanks.

from mongodb-memory-server.

nodkz avatar nodkz commented on May 18, 2024

Implemented in https://github.com/nodkz/mongodb-memory-server/releases/tag/v2.7.0

from mongodb-memory-server.

nodkz avatar nodkz commented on May 18, 2024

🎉 This issue has been resolved in version 2.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from mongodb-memory-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.