mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-25 19:52:36 +01:00
Add silent mode
This commit is contained in:
parent
d821536572
commit
fca4480c97
@ -3,7 +3,7 @@ const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { getSystemErrorMap } = require("util");
|
||||
const { argv, stdout, exit } = require("process");
|
||||
const {copyRecursiveSync,execIn} = require('./utils');
|
||||
const { copyRecursiveSync, execIn, parts} = require('./utils');
|
||||
|
||||
if(argv.includes("help")) {
|
||||
console.log(`Fosscord build script help:
|
||||
@ -13,20 +13,23 @@ Arguments:
|
||||
copyonly Only copy source files, don't build (useful for updating assets)
|
||||
verbose Enable verbose logging
|
||||
logerrors Log build errors to console
|
||||
pretty-errors Pretty-print build errors`);
|
||||
pretty-errors Pretty-print build errors
|
||||
silent No output, no build log`);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
let steps = 3, i = 0;
|
||||
if (argv.includes("clean")) steps++;
|
||||
if (argv.includes("copyonly")) steps--;
|
||||
const dirs = ["api", "util", "cdn", "gateway", "bundle"];
|
||||
|
||||
const verbose = argv.includes("verbose") || argv.includes("v");
|
||||
const silent = argv.includes("silent");
|
||||
|
||||
if(silent) console.log = function() {}
|
||||
|
||||
if (argv.includes("clean")) {
|
||||
console.log(`[${++i}/${steps}] Cleaning...`);
|
||||
dirs.forEach((a) => {
|
||||
parts.forEach((a) => {
|
||||
let d = "../" + a + "/dist";
|
||||
if (fs.existsSync(d)) {
|
||||
fs.rmSync(d, { recursive: true });
|
||||
@ -44,7 +47,7 @@ console.log(`[${++i}/${steps}] Copying src files...`);
|
||||
copyRecursiveSync(path.join(__dirname, "..", "..", "api", "assets"), path.join(__dirname, "..", "dist", "api", "assets"));
|
||||
copyRecursiveSync(path.join(__dirname, "..", "..", "api", "client_test"), path.join(__dirname, "..", "dist", "api", "client_test"));
|
||||
copyRecursiveSync(path.join(__dirname, "..", "..", "api", "locales"), path.join(__dirname, "..", "dist", "api", "locales"));
|
||||
dirs.forEach((a) => {
|
||||
parts.forEach((a) => {
|
||||
copyRecursiveSync("../" + a + "/src", "dist/" + a + "/src");
|
||||
if (verbose) console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user