d3ro-voice/src/main/index.ts
Yun Chan 3f4d0c5828 Phase 7~8 구현: 테스트 + 빌드 + CI/CD + SoundEffect + AutoLaunch + UI 리디자인
- vitest 41개 단위 테스트 (HistoryService, DictionaryService, CustomInstructionService, VoiceModeService, D3ROError)
- electron-builder.yml (NSIS, asarUnpack, extraResources)
- .gitlab-ci.yml (lint, typecheck, test, build, release)
- SoundEffectService: WAV 프리로드 + PowerShell 재생 + VoiceMode 연동
- AutoLaunchService: app.setLoginItemSettings + ConfigService 동기화
- TextInsertService: 간이 삽입 검증 (EditMonitor 경량)
- 번들링 인프라: SoX 다운로드 스크립트, PyInstaller 빌드, 경로 해상도 유틸
- AudioCaptureService/LocalSTTService: 번들 경로 자동 감지
- 08-design-system.md 기반 MUI 테마 (다크+라이트+auto 테마 시스템)
- 전체 UI 컴포넌트 리디자인: AppLayout, Dashboard, StatusBar, History, Dictionary, Commands, Settings
- 효과음 WAV 생성: recording-start, recording-stop, error
- EPIPE 에러 핸들링 추가
2026-04-05 09:12:56 +09:00

43 lines
1.3 KiB
TypeScript

// src/main/index.ts — 앱 진입점
import { app } from 'electron'
import { bootstrap } from './bootstrap'
import { setupLifecycle } from './lifecycle'
import { getMainWindow } from './windows/WindowManager'
// EPIPE 에러 방지: electron-log가 stdout/stderr에 쓸 때 파이프가 끊기면 크래시 방지
process.stdout?.on?.('error', () => { /* ignore EPIPE */ })
process.stderr?.on?.('error', () => { /* ignore EPIPE */ })
process.on('uncaughtException', (err) => {
if (err.message?.includes('EPIPE')) return // EPIPE는 무시
// 기타 예외는 로그만
try { require('electron-log').default?.error?.('Uncaught:', err) } catch { /* noop */ }
})
// 단일 인스턴스 잠금
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', () => {
// 기존 인스턴스의 메인 윈도우를 활성화
const mainWindow = getMainWindow()
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
}
})
app.whenReady().then(async () => {
await bootstrap()
setupLifecycle()
})
app.on('window-all-closed', () => {
// Windows에서는 모든 윈도우 닫아도 앱 유지 (트레이)
if (process.platform !== 'darwin') {
// closeToTray 설정 확인은 lifecycle에서 처리
}
})
}