const fs = require("fs");
const path = require("path");

const defaultConfig = {
    handler: () => {},
    filter: filePath => filePath.endsWith(".js"),
};

function tranvase(filePath, config) {
    const { handler, filter } = Object.assign(defaultConfig, config);
    if (fs.statSync(filePath).isDirectory()) {
        fs.readdirSync(filePath).forEach(fileName => {
            tranvase(path.resolve(filePath, fileName), config);
        });
    } else if (filter(filePath)) {
        handler(filePath);
    }
}

function getFuiExports() {}

function getFuiComponent() {}

module.exports = { tranvase, getFuiComponent, getFuiExports };