Require install enable you to automatically install packages when you require them. Very usefull for keeping your productivity high.
There is no performance lost (other than loading this package of course) because require-install at very first tries to require() your package the usual way.
Global
npm install -g require-install
or local
npm install --save require-install
var require_install = require('require-install');
// Just replace your require() with require_install():
var the_package = require_install('the-package');
// If it can't require it, it will install it and add it to your dependencies
the_package.doSomething();
When a package is not available it will install the package according to the ./package.json. It will look up the version number if it exists. Else it will just install the latest and add it to the dependencies.
If you wish to require-install packages without output, add the following to your package.json:
"require-install": {
"silent": true
}
Copyright (c) 2016 Maikel Vlasman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.