From 113b7f4a77033bd65891ace8bee954d13c552799 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:41:38 +0200 Subject: [PATCH 1/2] chore: make use of raw running when dev script is used with newer node --- scripts/dev.cjs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/dev.cjs b/scripts/dev.cjs index 7931df6b..db7d6e0c 100644 --- a/scripts/dev.cjs +++ b/scripts/dev.cjs @@ -13,6 +13,17 @@ args.push("--dev"); args.push("--secret"); args.push(secret); +const cangoraw = (() => { + if (process.versions.bun) { + return true; + } + const [major, minor] = process.versions.node.split(".").map(x => parseInt(x)); + if (major > 22 || (major == 22 && minor >= 7)) { + return true; + } + return false; +})(); + let buildproc, runproc; const spawnopts = { stdio: "inherit", shell: true }; function run(changedFile) { @@ -29,7 +40,7 @@ function run(changedFile) { runproc = undefined; } - const thisbuildproc = spawn("npm", ["run", process.versions.bun ? "verify" : "build:dev"], spawnopts); + const thisbuildproc = spawn("npm", ["run", cangoraw ? "verify" : "build:dev"], spawnopts); const thisbuildstart = Date.now(); buildproc = thisbuildproc; buildproc.on("exit", code => { @@ -38,8 +49,8 @@ function run(changedFile) { } buildproc = undefined; if (code === 0) { - console.log(`${process.versions.bun ? "Verified" : "Built"} in ${Date.now() - thisbuildstart} ms`); - runproc = spawn("npm", ["run", process.versions.bun ? "raw:bun" : "start", "--", ...args], spawnopts); + console.log(`${cangoraw ? "Verified" : "Built"} in ${Date.now() - thisbuildstart} ms`); + runproc = spawn("npm", ["run", cangoraw ? (process.versions.bun ? "raw:bun" : "raw") : "start", "--", ...args], spawnopts); runproc.on("exit", () => { runproc = undefined; }); -- 2.47.2 From c17cb4ee511cfd450ecea1090a6404f2e9cd09af Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:43:44 +0200 Subject: [PATCH 2/2] prettier --- scripts/dev.cjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/dev.cjs b/scripts/dev.cjs index db7d6e0c..fad64aba 100644 --- a/scripts/dev.cjs +++ b/scripts/dev.cjs @@ -50,7 +50,11 @@ function run(changedFile) { buildproc = undefined; if (code === 0) { console.log(`${cangoraw ? "Verified" : "Built"} in ${Date.now() - thisbuildstart} ms`); - runproc = spawn("npm", ["run", cangoraw ? (process.versions.bun ? "raw:bun" : "raw") : "start", "--", ...args], spawnopts); + runproc = spawn( + "npm", + ["run", cangoraw ? (process.versions.bun ? "raw:bun" : "raw") : "start", "--", ...args], + spawnopts + ); runproc.on("exit", () => { runproc = undefined; }); -- 2.47.2