| 46 | } |
| 47 | |
| 48 | function build(part: BuildPart, root: string): void { |
| 49 | if (part === 'engine') { |
| 50 | // Resolve the installed compiler directly: npx may download an unrelated |
| 51 | // package named tsc when dependencies are missing. |
| 52 | const compiler = require.resolve(path.join(root, 'node_modules/typescript/bin/tsc')); |
| 53 | execFileSync(process.execPath, [compiler], { cwd: root, stdio: 'inherit' }); |
| 54 | execSync('npm run copy-assets', { cwd: root, stdio: 'inherit' }); |
| 55 | } else { |
| 56 | execSync('npm run build:ui', { cwd: root, stdio: 'inherit' }); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** Exported for isolated filesystem fixtures; Vitest calls the default wrapper. */ |
| 61 | export function ensureTestDist(root: string, runBuild: BuildRunner = build): void { |