forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
662 B
25 lines
662 B
2 years ago
|
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 };
|