|
|
|
@ -1,21 +1,15 @@
|
|
|
|
|
const { promisify } = require(`util`);
|
|
|
|
|
const fs = require(`fs`);
|
|
|
|
|
const path = require(`path`);
|
|
|
|
|
const { readdirSync } = require(`fs`);
|
|
|
|
|
const { join } = require(`path`);
|
|
|
|
|
|
|
|
|
|
const readdir = promisify(fs.readdir);
|
|
|
|
|
|
|
|
|
|
async function optimize() {
|
|
|
|
|
for (let type of (await readdir(path.join(__dirname, `module`))).filter(
|
|
|
|
|
f => !f.includes(`.`)
|
|
|
|
|
)) {
|
|
|
|
|
for (let File of (await readdir(path.join(__dirname, `module`, type)))
|
|
|
|
|
.filter(file => file !== `index.js` && file.endsWith(`.js`))) {
|
|
|
|
|
for (let type of readdirSync(join(__dirname, `module`)).filter(
|
|
|
|
|
f => !f.includes(`.`)
|
|
|
|
|
)) {
|
|
|
|
|
readdirSync(join(__dirname, `module`, type))
|
|
|
|
|
.filter(file => file !== `index.js` && file.endsWith(`.js`))
|
|
|
|
|
.map(File => {
|
|
|
|
|
const Name = File.split(`.`)[0];
|
|
|
|
|
exports[
|
|
|
|
|
Name.charAt(0).toUpperCase() + Name.slice(1)
|
|
|
|
|
] = require(`${__dirname}/module/${type}/${File}`, { lazy: true });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
] = require(`${__dirname}/module/${type}/${File}`);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
optimize();
|
|
|
|
|