fix: 修复 Windows 上 bun.exe 命令识别问题并更新版本号至 4.0.3

This commit is contained in:
y574444354 2026-04-11 12:46:38 +08:00
parent e577962516
commit 3fc90fd6d3
3 changed files with 10 additions and 2 deletions

View File

@ -7,7 +7,7 @@
*/ */
export function getMacroDefines(): Record<string, string> { export function getMacroDefines(): Record<string, string> {
return { return {
"MACRO.VERSION": JSON.stringify("4.0.1"), "MACRO.VERSION": JSON.stringify("4.0.3"),
"MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()), "MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()),
"MACRO.FEEDBACK_CHANNEL": JSON.stringify(""), "MACRO.FEEDBACK_CHANNEL": JSON.stringify(""),
"MACRO.ISSUES_EXPLAINER": JSON.stringify(""), "MACRO.ISSUES_EXPLAINER": JSON.stringify(""),

View File

@ -53,8 +53,12 @@ const inspectArgs = process.env.BUN_INSPECT
? ["--inspect-wait=" + 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( 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 }, { stdio: ["inherit", "inherit", "inherit"], cwd: projectRoot },
); );

View File

@ -57,6 +57,7 @@ async function checkCodeSize() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
async function checkLint() { async function checkLint() {
try { try {
// Use 'bunx' which resolves to bunx.exe on Windows
const result = await $`bunx biome check src/ 2>&1`.quiet().nothrow().text(); const result = await $`bunx biome check src/ 2>&1`.quiet().nothrow().text();
const errorMatch = result.match(/Found (\d+) errors?/); const errorMatch = result.match(/Found (\d+) errors?/);
const warnMatch = result.match(/Found (\d+) warnings?/); const warnMatch = result.match(/Found (\d+) warnings?/);
@ -74,6 +75,7 @@ async function checkLint() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
async function checkTests() { async function checkTests() {
try { try {
// Use 'bun test' which resolves correctly on Windows
const result = await $`bun test 2>&1`.quiet().nothrow().text(); const result = await $`bun test 2>&1`.quiet().nothrow().text();
const passMatch = result.match(/(\d+) pass/); const passMatch = result.match(/(\d+) pass/);
const failMatch = result.match(/(\d+) fail/); const failMatch = result.match(/(\d+) fail/);
@ -91,6 +93,7 @@ async function checkTests() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
async function checkUnused() { async function checkUnused() {
try { try {
// Use 'bunx knip-bun' which resolves correctly on Windows
const result = await $`bunx knip-bun 2>&1`.quiet().nothrow().text(); const result = await $`bunx knip-bun 2>&1`.quiet().nothrow().text();
const unusedFiles = result.match(/Unused files \((\d+)\)/); const unusedFiles = result.match(/Unused files \((\d+)\)/);
const unusedExports = result.match(/Unused exports \((\d+)\)/); const unusedExports = result.match(/Unused exports \((\d+)\)/);
@ -108,6 +111,7 @@ async function checkUnused() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
async function checkBuild() { async function checkBuild() {
try { try {
// Use 'bun run build' which resolves correctly on Windows
const result = await $`bun run build 2>&1`.quiet().nothrow(); const result = await $`bun run build 2>&1`.quiet().nothrow();
if (result.exitCode === 0) { if (result.exitCode === 0) {
// 获取产物大小 // 获取产物大小