Scan directory for nested directories and create an index module
Tree
βββ main.js
βββ lib
βββ index.js
βββ module1
β βββ index.js
β βββ spec.js
βββ module2
βββ index.js
βββ spec.js
lib/index.js
const inedx = require('index-require');
module.exports = inedx(__dirname);
main.js
const {module1, module2} = require('./lib');
app.js
βββ app.js
βββ feature1
βΒ Β βββ index.js
βΒ Β βββ spec.js
βββ feature2
βββ index.js
βββ spec.js
app.js
const inedx = require('index-require');
const {
feature1,
feature2,
} = inedx(__dirname);
const inedx = require('index-require');
module.exports = inedx(__dirname, name => `./${name}/main.js`);