fix(tooling): resolve Bun in the full dev launcher

dev-web-full.mjs is started by node and spawned bare `bun`, so on Windows
machines where npm exposes only bun.cmd both children died with ENOENT and
`dev:web:full` never started. It now uses the resolver dev-web-hmr.mjs got,
and hides the console window like the other Node-spawned children.
This commit is contained in:
Bohdan Triapitsyn
2026-09-05 14:45:20 +03:00
parent ac23e23db7
commit e43541d38b
+6 -2
View File
@@ -3,10 +3,13 @@ import { spawn } from 'node:child_process';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { resolveBunExecutable } from './lib/bun-executable.mjs';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
const repoRoot = path.resolve(__dirname, '..'); const repoRoot = path.resolve(__dirname, '..');
const useDetachedChildren = process.platform === 'darwin' || process.platform === 'linux'; const useDetachedChildren = process.platform === 'darwin' || process.platform === 'linux';
const bunExecutable = resolveBunExecutable();
function run(label, command, args, options = {}) { function run(label, command, args, options = {}) {
const child = spawn(command, args, { const child = spawn(command, args, {
@@ -14,6 +17,7 @@ function run(label, command, args, options = {}) {
stdio: ['inherit', 'pipe', 'pipe'], stdio: ['inherit', 'pipe', 'pipe'],
env: { ...process.env }, env: { ...process.env },
detached: useDetachedChildren, detached: useDetachedChildren,
windowsHide: true,
...options, ...options,
}); });
@@ -160,7 +164,7 @@ function waitForFirstBuildSuccess(buildChild) {
let shuttingDown = false; let shuttingDown = false;
let api = null; let api = null;
const build = run('build', 'bun', ['run', '--cwd', 'packages/web', 'build:watch']); const build = run('build', bunExecutable, ['run', '--cwd', 'packages/web', 'build:watch']);
async function shutdown(exitCode = 0) { async function shutdown(exitCode = 0) {
if (shuttingDown) return; if (shuttingDown) return;
@@ -193,7 +197,7 @@ waitForFirstBuildSuccess(build)
return; return;
} }
console.log('[dev:web:full] Initial frontend build ready, starting API watcher...'); console.log('[dev:web:full] Initial frontend build ready, starting API watcher...');
api = run('api', 'bun', ['run', '--cwd', 'packages/web', 'dev:server:watch']); api = run('api', bunExecutable, ['run', '--cwd', 'packages/web', 'dev:server:watch']);
api.on('exit', onChildExit('api')); api.on('exit', onChildExit('api'));
}) })
.catch((error) => { .catch((error) => {