UNPKG

dev-services-dashboard

Version:

A lightweight development UI dashboard for managing and monitoring multiple services during local development

63 lines (58 loc) 1.8 kB
import { ChildProcess } from 'child_process'; import { Server } from 'http'; import { WebSocketServer } from 'ws'; interface LogEntry { timestamp: number; line: string; logType: "stdout" | "stderr" | "system"; } interface WebLink { label: string; url: string; } /** * Logger function type for DevUI */ type DevServicesDashboardLoggerFunction = (type: "info" | "error" | "warn", message: string, data?: object) => void; interface UserServiceConfig { id: string; name: string; command: string[]; cwd?: string; env?: Record<string, string>; webLinks?: WebLink[]; } interface Service { id: string; name: string; command: string[]; cwd: string; env?: Record<string, string>; webLinks?: WebLink[]; process: ChildProcess | null; status: "stopped" | "running" | "starting" | "stopping" | "error" | "crashed"; logs: LogEntry[]; errorDetails: string | null; } interface DevUIConfig { port?: number; hostname?: string; maxLogLines?: number; defaultCwd?: string; dashboardName?: string; services: UserServiceConfig[]; logger?: DevServicesDashboardLoggerFunction; } interface DevUIServer { httpServer: Server; wsServer: WebSocketServer; port: number; stop: () => Promise<void>; } /** * Console-based logger implementation for DevUI * @param enabled Whether logging is enabled (default: true) */ declare const createConsoleLogger: (enabled?: boolean) => DevServicesDashboardLoggerFunction; declare function startDevServicesDashboard(config: DevUIConfig): Promise<DevUIServer>; export { type DevServicesDashboardLoggerFunction, type DevUIConfig, type DevUIServer, type LogEntry, type Service, type UserServiceConfig, type WebLink, createConsoleLogger, startDevServicesDashboard };