Skip to content

Commit

Permalink
refactor: replace process.version checks with Deno.args for command-l…
Browse files Browse the repository at this point in the history
…ine argument handling
  • Loading branch information
renhiyama committed Nov 2, 2024
1 parent 0ecfd76 commit c60db9f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import rovel from "rovel.js";
rovel.env.config();
import fs from "node:fs";
import pkg from "./package.json" with { type: "json" };
if (process.version.split(1, 3) > 18) {
process.exit(0);
}

if (pkg.checkCache == "true" && !process.argv.join(" ").includes("--force")) {

if (pkg.checkCache == "true" && !Deno.args.join(" ").includes("--force")) {
try {
if (fs.existsSync("./src/public/assets/img/bot/logo-36.png")) {
console.log("Build cache was found. Skipping build.");
Expand Down
2 changes: 1 addition & 1 deletion src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import users from "./models/users.js";
import servers from "./models/servers.js";
globalThis.Cache = {};
console.log("[CACHE] Started!");

import process from "node:process";
process.emit("STARTED", {});

function compare(a, b, on) {
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Error.stackTraceLimit = Infinity;
import WebSocket from "isomorphic-ws";
globalThis.WebSocket = WebSocket;
import process from "node:process";
const v = process.version.slice(1, 3);
if (v < 20 && process.platform != "android") {
console.error("[ERROR] Node.js v20 or above is required.");
Expand Down
1 change: 1 addition & 0 deletions src/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ globalThis.path = path;
import bots from "./routes/bots.js";
import non_api from "./routes/non-api.js";
globalThis.started = false;
import process from "node:process";
process.on("STARTED", () => {
console.log(rovel.text.green(`Everything Started! RDL is ready to go!`));
globalThis.started = true;
Expand Down
1 change: 1 addition & 0 deletions src/server/mw/booting.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from "node:process";
export default function (req, res, next) {
if (!globalThis.started) {
console.log("[WAITING] Booting: " + process.uptime());
Expand Down

0 comments on commit c60db9f

Please sign in to comment.