UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

1 lines • 3.75 kB
{"version":3,"file":"processes.cjs","names":["colors","frames","icons","gradients"],"sources":["../../../src/cli/render/processes.ts"],"sourcesContent":["import type { PsResult } from \"../../contract\";\nimport { colors, frames, gradients, icons } from \"../../utils/theme\";\n\nexport function renderPs(result: PsResult): void {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n const entries = result.entries ?? [];\n if (entries.length === 0) {\n console.log(colors.dim(\" No tracked development processes running.\"));\n console.log();\n console.log(colors.dim(` Start one with ${colors.cyan(\"bos dev\")} and it will appear here.`));\n console.log();\n return;\n }\n console.log(colors.cyan(frames.top(60)));\n console.log(` ${icons.app} ${gradients.cyber(\"PROCESSES\")}`);\n console.log(colors.cyan(frames.bottom(60)));\n console.log();\n for (const entry of entries) {\n const ageMs = Date.now() - entry.startedAt;\n const ageStr =\n ageMs < 60_000\n ? `${Math.floor(ageMs / 1000)}s`\n : ageMs < 3_600_000\n ? `${Math.floor(ageMs / 60_000)}m`\n : `${Math.floor(ageMs / 3_600_000)}h`;\n const roleTag =\n entry.role === \"workspace-parent\"\n ? colors.magenta(\"parent\")\n : entry.role === \"workspace-child\"\n ? colors.blue(\"child\")\n : colors.dim(\"dev\");\n console.log(` ${colors.green(`pid ${entry.pid}`)} ${roleTag} ${colors.dim(ageStr)}`);\n console.log(` ${colors.dim(\"dir:\")} ${entry.configDir}`);\n if (entry.parentPid !== undefined) {\n console.log(` ${colors.dim(\"parent:\")} ${entry.parentPid}`);\n }\n const portPairs = Object.entries(entry.ports ?? {})\n .filter(([, p]) => typeof p === \"number\")\n .map(([k, v]) => `${k}=${v}`);\n if (portPairs.length > 0) {\n console.log(` ${colors.dim(\"ports:\")} ${portPairs.join(\" \")}`);\n }\n if (entry.budget) {\n console.log(` ${colors.dim(\"budget:\")} [${entry.budget.min}, ${entry.budget.max}]`);\n }\n console.log(` ${colors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