Hi and thanks for this module,
I use the downloadDir options in my code, so my home folder stays clean of .mongodb-binaries. However the postinstall script is not aware of that and downloads in my home folder. Shouldn't the downloading of binaries after npm install be optional ? (I mean opt-in instead of opt-out)
Am I missing something ?
Cheers
@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 :)
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.
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.
Disabling downloading via MONGOMS_DISABLE_POSTINSTALL env variable is less evil.
Ok then isn't there a more appropriate place to download them (more local to the project) ?
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.
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.
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.
@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.
@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 ?
:tada: This issue has been resolved in version 2.7.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Most helpful comment
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.