2026-08-02 23:31:45 -05:00
|
|
|
import { ipcMain } from 'electron'
|
2026-08-02 23:40:29 -05:00
|
|
|
import { describeProject, listProjects } from '../ddev'
|
|
|
|
|
import { runStreamed } from '../commandRunner'
|
2026-08-02 23:31:45 -05:00
|
|
|
|
|
|
|
|
export function registerProjectsIpc(): void {
|
|
|
|
|
ipcMain.handle('projects:list', () => listProjects())
|
|
|
|
|
ipcMain.handle('projects:describe', (_event, name: string) => describeProject(name))
|
2026-08-02 23:40:29 -05:00
|
|
|
ipcMain.handle('projects:start', (event, operationId: string, name: string) =>
|
|
|
|
|
runStreamed(operationId, ['start', name], event.sender)
|
|
|
|
|
)
|
|
|
|
|
ipcMain.handle('projects:stop', (event, operationId: string, name: string) =>
|
|
|
|
|
runStreamed(operationId, ['stop', name], event.sender)
|
|
|
|
|
)
|
|
|
|
|
ipcMain.handle('projects:restart', (event, operationId: string, name: string) =>
|
|
|
|
|
runStreamed(operationId, ['restart', name], event.sender)
|
|
|
|
|
)
|
2026-08-03 03:15:35 -05:00
|
|
|
// Removes DDEV's project registration + containers + database (auto-
|
|
|
|
|
// snapshotted first, unless omitted) — does not touch the project's files
|
|
|
|
|
// on disk.
|
|
|
|
|
ipcMain.handle('projects:delete', (event, operationId: string, name: string) =>
|
|
|
|
|
runStreamed(operationId, ['delete', name, '--yes'], event.sender)
|
|
|
|
|
)
|
2026-08-02 23:31:45 -05:00
|
|
|
}
|