feat: add display kiosk host
This commit is contained in:
@@ -11,24 +11,28 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
/**
|
||||
* `ekklesia-build-module-ui` — the canonical module UI build command, run from a module directory.
|
||||
*
|
||||
* A module with no `entrypoints.ui` is not an error: backend-only modules stay first-class and this
|
||||
* command reports that there was nothing to build and exits successfully, so one `build` script
|
||||
* works for every module.
|
||||
* A module with neither UI role is not an error: backend-only modules stay first-class and this
|
||||
* command reports that there was nothing to build and exits successfully. When one or both roles
|
||||
* are declared, this one command builds exactly that set.
|
||||
*/
|
||||
async function main(): Promise<number> {
|
||||
const moduleDirectory = process.argv[2] ?? process.cwd();
|
||||
|
||||
try {
|
||||
const result = await buildModuleUi({ moduleDirectory });
|
||||
process.stdout.write(`Built module UI: ${path.relative(moduleDirectory, result.outputFile)}\n`);
|
||||
if (result.artifacts.length === 0) {
|
||||
process.stdout.write("No module UI entrypoints declared; skipping the module UI build.\n");
|
||||
return 0;
|
||||
}
|
||||
for (const artifact of result.artifacts) {
|
||||
process.stdout.write(
|
||||
`Built module UI (${artifact.kind}): ${path.relative(moduleDirectory, artifact.outputFile)}\n`,
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
} catch (error) {
|
||||
if (error instanceof ModuleUiBuildError) {
|
||||
if (error.code === "MODULE_UI_ENTRYPOINT_NOT_DECLARED") {
|
||||
process.stdout.write("No entrypoints.ui declared; skipping the module UI build.\n");
|
||||
return 0;
|
||||
}
|
||||
process.stderr.write(`${error.message}\n`);
|
||||
process.stderr.write(`${error.kind ? `${error.kind}: ` : ""}${error.message}\n`);
|
||||
// esbuild's own diagnostics carry the file, line, and reason a developer needs. They are
|
||||
// printed here, never folded into the sanitized error message itself.
|
||||
const diagnostics = isRecord(error) ? error.diagnostics : undefined;
|
||||
|
||||
Reference in New Issue
Block a user