diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-06 15:24:12 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-06 15:24:12 +0200 |
commit | fca4480c97124cfbd2352d47f14c27d1f3767cc9 (patch) | |
tree | 980e39fb6645bf974eb2709dcb7e34dcfe852933 | |
parent | Add utility scripts (diff) | |
download | server-fca4480c97124cfbd2352d47f14c27d1f3767cc9.tar.xz |
Add silent mode
-rw-r--r-- | bundle/scripts/build.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bundle/scripts/build.js b/bundle/scripts/build.js index 8a1b3c83..99454be6 100644 --- a/bundle/scripts/build.js +++ b/bundle/scripts/build.js @@ -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"}!`); }); |