I have a similar question to this, but not quite the same.I would like for the user of my app to install it with whatever dependencies are needed for the way he would want to use it. So, for example, if they want to persist to MongoDB, then only Mongo-related libraries will be installed, but if they want to persist to Redis, then only Redis-related libraries will be installed. I don't want to make them download and install libraries they won't be using.I know I can do that for development purposes with devDependencies, but this goes farther than that. As the answer in the question above says, this is more closely related to Python's setuptools extras_require and Clojure's leiningen profiles. Anything like that in npm? I really feel like devDependencies should be a dev profile of a more versatile way of specifying dependencies.
Optional dependencies in npm?
node.js;dependencies
The codependency module may be what you're looking for, or anything that does something similar to:declare optional dependencies in package.json that aren't automatically installed by npm install, say optionalPeerDependenciesa custom require-style function that knows about optionalPeerDependencies and does the right thing, including throwing/warning when nothing is found that fulfills a required class of modules (e.g. neither redis, nor mongo, nor mysql, etc. are installed).document the expectation that consumers of this module install at least 1 of the optional peer modulesOne variation would be if the module's core functionality works without any optional dependencies (e.g. plugin pattern), no error/warning when nothing is found that fulfills a peer dependency.Another variation is doing the list above while accounting for production versus development dependencies, i.e. an analog for dependencies and devDependencies.Perhaps combined with an on-demand require such that optional modules are required lazily, e.g.:exports = {    Core : require('./core'),    get redis(){ return require('./redis'); },    get mongo(){ return require('./mongo'); }}