diff options
-rw-r--r-- | bundle/scripts/build.js | 9 | ||||
-rw-r--r-- | bundle/src/start.ts | 2 | ||||
-rw-r--r-- | cdn/tests/cdn_endpoints.test.js | 4 |
3 files changed, 9 insertions, 6 deletions
diff --git a/bundle/scripts/build.js b/bundle/scripts/build.js index 4f56694c..f73fb11a 100644 --- a/bundle/scripts/build.js +++ b/bundle/scripts/build.js @@ -1,10 +1,12 @@ const { execSync } = require("child_process"); const path = require("path"); -const fse = require("fs-extra"); const fs = require("fs"); const { getSystemErrorMap } = require("util"); const { argv } = require("process"); +var steps = 2, 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"); @@ -30,6 +32,7 @@ var copyRecursiveSync = function(src, dest) { }; if (argv.includes("clean")) { + console.log(`[${++i}/${steps}] Cleaning...`); dirs.forEach((a) => { var d = "../" + a + "/dist"; if (fs.existsSync(d)) { @@ -39,6 +42,7 @@ if (argv.includes("clean")) { }); } +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")); @@ -47,9 +51,8 @@ dirs.forEach((a) => { if (verbose) console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`); }); -console.log("[1/2] Copying src files done"); if (!argv.includes("copyonly")) { - console.log("[2/2] Compiling src files ..."); + console.log(`[${++i}/${steps}] Compiling src files ...`); console.log( execSync( diff --git a/bundle/src/start.ts b/bundle/src/start.ts index 1b21659e..d2707f4d 100644 --- a/bundle/src/start.ts +++ b/bundle/src/start.ts @@ -43,7 +43,7 @@ Commit Hash: ${ ? `${cyan(commit)} (${yellow(commit.slice(0, 7))})` : "Unknown (Git cannot be found)" } -Cores: ${cyan(cores)} +Cores: ${cyan(os.cpus().length)} (Using ${cores} thread(s).) `) ); diff --git a/cdn/tests/cdn_endpoints.test.js b/cdn/tests/cdn_endpoints.test.js index 8cf16748..5a543e54 100644 --- a/cdn/tests/cdn_endpoints.test.js +++ b/cdn/tests/cdn_endpoints.test.js @@ -1,6 +1,6 @@ const dotenv = require("dotenv"); const path = require("path"); -const fse = require("fs-extra"); +const fs = require("fs"); dotenv.config(); // TODO: write unittest to check if FileStorage.ts is working @@ -21,7 +21,7 @@ if (process.env.STORAGE_PROVIDER === "file") { } else { process.env.STORAGE_LOCATION = path.join(__dirname, "..", "files", "/"); } - fse.ensureDirSync(process.env.STORAGE_LOCATION); + if(!fs.existsSync(process.env.STORAGE_LOCATION)) fs.mkdirSync(process.env.STORAGE_LOCATION, {recursive:true}); } const { CDNServer } = require("../dist/Server"); const { Config } = require("@fosscord/util"); |