From 3fc90fd6d38a9d5e063ae46f1eaa9142996879d0 Mon Sep 17 00:00:00 2001 From: y574444354 <574444354@qq.com> Date: Sat, 11 Apr 2026 12:46:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20=E4=B8=8A?= =?UTF-8?q?=20bun.exe=20=E5=91=BD=E4=BB=A4=E8=AF=86=E5=88=AB=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E8=87=B3=204.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/defines.ts | 2 +- scripts/dev.ts | 6 +++++- scripts/health-check.ts | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/defines.ts b/scripts/defines.ts index d339b0eb3..097a6d217 100644 --- a/scripts/defines.ts +++ b/scripts/defines.ts @@ -7,7 +7,7 @@ */ export function getMacroDefines(): Record { return { - "MACRO.VERSION": JSON.stringify("4.0.1"), + "MACRO.VERSION": JSON.stringify("4.0.3"), "MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()), "MACRO.FEEDBACK_CHANNEL": JSON.stringify(""), "MACRO.ISSUES_EXPLAINER": JSON.stringify(""), diff --git a/scripts/dev.ts b/scripts/dev.ts index 0b35f4bc8..d0aeae49b 100644 --- a/scripts/dev.ts +++ b/scripts/dev.ts @@ -53,8 +53,12 @@ const inspectArgs = process.env.BUN_INSPECT ? ["--inspect-wait=" + process.env.BUN_INSPECT] : []; +// Use the bun executable from PATH - on Windows, Bun CLI registers 'bun' command +// which resolves to bun.exe. Using 'bun' directly works on all platforms. +const bunCmd = process.platform === 'win32' ? 'bun.exe' : 'bun'; + const result = Bun.spawnSync( - ["bun", ...inspectArgs, "run", ...defineArgs, ...featureArgs, cliPath, ...process.argv.slice(2)], + [bunCmd, ...inspectArgs, "run", ...defineArgs, ...featureArgs, cliPath, ...process.argv.slice(2)], { stdio: ["inherit", "inherit", "inherit"], cwd: projectRoot }, ); diff --git a/scripts/health-check.ts b/scripts/health-check.ts index 458420989..dd3b7ec3d 100644 --- a/scripts/health-check.ts +++ b/scripts/health-check.ts @@ -57,6 +57,7 @@ async function checkCodeSize() { // --------------------------------------------------------------------------- async function checkLint() { try { + // Use 'bunx' which resolves to bunx.exe on Windows const result = await $`bunx biome check src/ 2>&1`.quiet().nothrow().text(); const errorMatch = result.match(/Found (\d+) errors?/); const warnMatch = result.match(/Found (\d+) warnings?/); @@ -74,6 +75,7 @@ async function checkLint() { // --------------------------------------------------------------------------- async function checkTests() { try { + // Use 'bun test' which resolves correctly on Windows const result = await $`bun test 2>&1`.quiet().nothrow().text(); const passMatch = result.match(/(\d+) pass/); const failMatch = result.match(/(\d+) fail/); @@ -91,6 +93,7 @@ async function checkTests() { // --------------------------------------------------------------------------- async function checkUnused() { try { + // Use 'bunx knip-bun' which resolves correctly on Windows const result = await $`bunx knip-bun 2>&1`.quiet().nothrow().text(); const unusedFiles = result.match(/Unused files \((\d+)\)/); const unusedExports = result.match(/Unused exports \((\d+)\)/); @@ -108,6 +111,7 @@ async function checkUnused() { // --------------------------------------------------------------------------- async function checkBuild() { try { + // Use 'bun run build' which resolves correctly on Windows const result = await $`bun run build 2>&1`.quiet().nothrow(); if (result.exitCode === 0) { // 获取产物大小