-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
25 lines (23 loc) · 892 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const commands = require("./functions");
const { existsSync: existsSync, mkdirSync: mkdirSync, promises: fs } = require("fs");
const process = require("process");
const config = require("./config.json");
let dev = false;
const run = async () => {
const files = [];
if (process.argv.length > 3) {
files.push(...process.argv.slice(3));
dev = process.argv.indexOf("--dev") === -1 ? false : true;
}
await fs.rm(config.buildDir, { recursive: true, force: true });
if (!existsSync(config.buildDir)) {
mkdirSync(config.buildDir);
}
const completeMenu = await commands.makeMenu();
await fs.writeFile("menu.json", JSON.stringify(completeMenu, null, 4));
await commands.build(completeMenu, completeMenu, { dev, files });
await commands.compileCSS();
await commands.copyDataFolder();
await commands.copyPublicFolder();
};
run();