requiry

Package auto-installer for dev environments

Usage no npm install needed!

<script type="module">
  import requiry from 'https://cdn.skypack.dev/requiry';
</script>

README

Requiry

NPM Version Build Status Code Coverage Dependencies Support

Requiry checks process.env.NODE_ENV, and if you are in a "dev" environment, it will auto-install packages when you require packages that are not installed.

Installation

In your project directory, run:

npm i --save requiry

Getting Started

To use Requiry, you simply need to require it, then require a package which may or may not be installed.

require('requiry');

var something = require('something');

If you run your application without specifying an environment, or specifying an environment other than "dev", the require function will operate as usual, triggering a MODULE_NOT_FOUND error if something isn't installed. However, if you run in "dev" mode, it will install something for you.

NODE_ENV=dev node app


API

.setLogger(logger)

You can make requiry use a custom logger by passing it in.

.enable(boolean)

If you would like to disable Requiry, even in "dev" mode, you can call requiry.enable(false).