UNPKG

everything-dev

Version:

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

1 lines • 982 B
{"version":3,"file":"exit-codes.mjs","names":[],"sources":["../../src/cli/exit-codes.ts"],"sourcesContent":["/** The CLI's exit-code mapping (ticket #426): one place decides the process\n * exit code from a command result — status \"error\", a bare error string, or\n * an explicit `code` field. */\nexport type ExitCode = 0 | 1;\n\nexport function exitCodeFor(\n result:\n | {\n status?: string;\n error?: string;\n code?: number;\n }\n | undefined,\n): ExitCode {\n if (!result) return 0;\n if (typeof result.code === \"number\") return (result.code === 0 ? 0 : 1) as ExitCode;\n if (result.status === \"error\") return 1;\n if (typeof result.error === \"string\" && result.error.length > 0) return 1;\n return 0;\n}\n"],"mappings":";AAKA,SAAgB,YACd,QAOU;CACV,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,OAAO,OAAO,SAAS,UAAU,OAAQ,OAAO,SAAS,IAAI,IAAI;CACrE,IAAI,OAAO,WAAW,SAAS,OAAO;CACtC,IAAI,OAAO,OAAO,UAAU,YAAY,OAAO,MAAM,SAAS,GAAG,OAAO;CACxE,OAAO;AACT"}