#!/usr/bin/env node import {spawnSync} from 'node:child_process'; const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'; const h5HostBridgeTests = [ 'packages/shared/src/contracts/hostBridge.test.ts', 'src/services/host-bridge/hostBridge.test.ts', 'src/services/host-bridge/nativeAppHostBridge.test.ts', 'src/App.test.tsx', 'src/components/common/PublishShareModal.test.tsx', 'src/services/runtimeAudioFeedback.test.ts', 'src/services/clipboard.test.ts', 'src/services/appTitle.test.ts', ]; const steps = [ { label: 'h5-host-bridge-tests', command: npmCommand, args: ['run', 'test', '--', ...h5HostBridgeTests], }, { label: 'mobile-shell-typecheck', command: npmCommand, args: ['run', 'mobile-shell:typecheck'], }, { label: 'mobile-shell-test', command: npmCommand, args: ['run', 'mobile-shell:test'], }, { label: 'desktop-shell-typecheck', command: npmCommand, args: ['run', 'desktop-shell:typecheck'], }, { label: 'desktop-shell-test', command: npmCommand, args: ['run', 'desktop-shell:test'], }, ]; for (const step of steps) { console.log(`[check:native-shells] ${step.label}`); const result = spawnSync(step.command, step.args, { cwd: process.cwd(), stdio: 'inherit', }); if (result.error) { console.error( `[check:native-shells] failed to start ${step.label}: ${result.error.message}`, ); process.exit(1); } if (result.signal) { console.error( `[check:native-shells] ${step.label} was terminated by signal ${result.signal}`, ); process.exit(1); } if ((result.status ?? 0) !== 0) { process.exit(result.status ?? 1); } } console.log('[check:native-shells] OK');