feat(V2-1a): Monorepo 구조 전환 — apps/desktop으로 V1 이동

- npm workspaces 루트 (apps/*, packages/*) 세팅
- V1 전체를 apps/desktop/으로 git mv (src, resources, tests, sidecar,
  scripts, electron.vite.config.ts, electron-builder.yml, vitest.config.ts,
  tsconfig.node.json, tsconfig.web.json)
- apps/desktop/package.json 신규 (name=@d3ro/desktop)
- productName: 'd3ro-voice' 명시 — app.getName()을 고정하여 userData 경로
  %APPDATA%\d3ro-voice\ 그대로 유지 (기존 DB/설정 연속성 보장)
- 루트 package.json을 workspace 루트로 재구성, 공통 devDep만 유지
  (typescript, eslint, prettier)
- turbo.json, tsconfig.base.json 추가 (Turborepo 자체 설치는 별도 sub-phase)
- memory/project_status.md 생성 (규칙 13)

검증:
- npm run typecheck 통과
- npm run build 통과 (electron-vite main+preload+renderer)
- npm run dev 실제 실행 → DB/핫키/Ollama 자동 실행 모두 정상
This commit is contained in:
yunchan8804 2026-04-08 14:04:41 +09:00
parent 3a160b9032
commit 45a580878a
178 changed files with 214 additions and 0 deletions

View file

@ -0,0 +1,98 @@
// src/main/ipc/config-handlers.ts
import { ipcMain, BrowserWindow } from 'electron'
import { IPC_CHANNELS } from '@shared/ipc-channels'
import { ipcSuccess, ipcError, ErrorCode } from '@shared/errors'
import { configGet, configSet, configGetAll, configReset } from '../services/ConfigService'
import { getAutoLaunchService } from '../services/AutoLaunchService'
import { reapplyThemeToAllPopups } from '../windows/WindowManager'
/** 설정 변경 시 모든 렌더러에 broadcast */
function broadcastConfigChanged(key: string, value: unknown, previousValue?: unknown): void {
for (const win of BrowserWindow.getAllWindows()) {
win.webContents.send(IPC_CHANNELS.CONFIG.CHANGED, { key, value, previousValue })
}
}
import type {
ConfigGetParams,
ConfigSetParams,
ConfigResetParams,
SetThemeParams,
SetLanguageParams,
SetAutoLaunchParams,
SetCloseToTrayParams,
AppConfig
} from '@shared/types'
export function registerConfigHandlers(): void {
ipcMain.handle(IPC_CHANNELS.CONFIG.GET, async (_event, params: ConfigGetParams) => {
try {
return ipcSuccess(configGet(params.key))
} catch {
return ipcError(ErrorCode.ConfigReadFailed, `Failed to read config key: ${params.key}`)
}
})
ipcMain.handle(IPC_CHANNELS.CONFIG.SET, async (_event, params: ConfigSetParams) => {
try {
const prev = configGet(params.key)
configSet(params.key, params.value as AppConfig[typeof params.key])
broadcastConfigChanged(params.key, params.value, prev)
return ipcSuccess(undefined)
} catch {
return ipcError(ErrorCode.ConfigWriteFailed, `Failed to write config key: ${params.key}`)
}
})
ipcMain.handle(IPC_CHANNELS.CONFIG.GET_ALL, async () => {
return ipcSuccess(configGetAll())
})
ipcMain.handle(IPC_CHANNELS.CONFIG.RESET, async (_event, params: ConfigResetParams) => {
try {
configReset(params.key)
return ipcSuccess(undefined)
} catch {
return ipcError(ErrorCode.ConfigResetFailed, 'Failed to reset config')
}
})
ipcMain.handle(IPC_CHANNELS.CONFIG.GET_THEME, async () => {
return ipcSuccess(configGet('theme'))
})
ipcMain.handle(IPC_CHANNELS.CONFIG.SET_THEME, async (_event, params: SetThemeParams) => {
const prev = configGet('theme')
configSet('theme', params.theme)
broadcastConfigChanged('theme', params.theme, prev)
reapplyThemeToAllPopups()
return ipcSuccess(undefined)
})
ipcMain.handle(IPC_CHANNELS.CONFIG.GET_LANGUAGE, async () => {
return ipcSuccess(configGet('language'))
})
ipcMain.handle(IPC_CHANNELS.CONFIG.SET_LANGUAGE, async (_event, params: SetLanguageParams) => {
configSet('language', params.language)
return ipcSuccess(undefined)
})
ipcMain.handle(IPC_CHANNELS.CONFIG.GET_AUTO_LAUNCH, async () => {
return ipcSuccess(configGet('autoLaunch'))
})
ipcMain.handle(IPC_CHANNELS.CONFIG.SET_AUTO_LAUNCH, async (_event, params: SetAutoLaunchParams) => {
getAutoLaunchService().setEnabled(params.enabled)
return ipcSuccess(undefined)
})
ipcMain.handle(IPC_CHANNELS.CONFIG.GET_CLOSE_TO_TRAY, async () => {
return ipcSuccess(configGet('closeToTray'))
})
ipcMain.handle(IPC_CHANNELS.CONFIG.SET_CLOSE_TO_TRAY, async (_event, params: SetCloseToTrayParams) => {
configSet('closeToTray', params.enabled)
return ipcSuccess(undefined)
})
}