Add hasDiagnostics and fix CLI exit code
MODIFY
packages/@romejs/cli/cli.ts
packages/@romejs/cli/cli.ts
@@ -484,7 +484,7 @@ export default async function cli() {
}
case "DIAGNOSTICS": {
- process.exit(res.diagnostics.length === 0 ? 0 : 1);
+ process.exit(res.hasDiagnostics ? 1 : 0);
break;
}

MODIFY
packages/@romejs/core/common/bridges/MasterBridge.ts
packages/@romejs/core/common/bridges/MasterBridge.ts
@@ -54,6 +54,7 @@ export type MasterQueryResponseError = {
export type MasterQueryResponseDiagnostics = {
type: "DIAGNOSTICS";
+ hasDiagnostics: boolean;
diagnostics: Diagnostics;
};

MODIFY
packages/@romejs/core/master/Master.ts
packages/@romejs/core/master/Master.ts
@@ -901,6 +901,7 @@ export default class Master {
} else {
return {
type: "DIAGNOSTICS",
+ hasDiagnostics: diagnostics.length > 0,
diagnostics,
};
}

MODIFY
packages/@romejs/core/master/MasterRequest.ts
packages/@romejs/core/master/MasterRequest.ts
@@ -254,6 +254,7 @@ export default class MasterRequest {
} else if (res.type === "DIAGNOSTICS") {
res = {
type: "DIAGNOSTICS",
+ hasDiagnostics: res.hasDiagnostics,
diagnostics: [],
};
} else if (res.type === "INVALID_REQUEST") {

Add hasDiagnostics and fix CLI exit code