feat: add code queue services and baidu netdisk
This commit is contained in:
+28
-1
@@ -1,4 +1,4 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { runCommand } from "./command";
|
||||
import { type UniDeskConfig, repoRoot, rootPath } from "./config";
|
||||
import { composeConfig } from "./docker";
|
||||
@@ -28,6 +28,32 @@ function commandItem(name: string, command: string[]): CheckItem {
|
||||
};
|
||||
}
|
||||
|
||||
function unifiedLogRotationItem(): CheckItem {
|
||||
const serviceFiles = [
|
||||
"src/components/backend-core/src/index.ts",
|
||||
"src/components/frontend/src/index.ts",
|
||||
"src/components/provider-gateway/src/index.ts",
|
||||
"src/components/microservices/code-queue/src/index.ts",
|
||||
"src/components/microservices/project-manager/src/index.ts",
|
||||
"src/components/microservices/baidu-netdisk/src/index.ts",
|
||||
];
|
||||
const offenders = serviceFiles.flatMap((path) => {
|
||||
const text = readFileSync(rootPath(path), "utf8");
|
||||
const directLogAppend = /appendFileSync\(\s*(?:config\.)?logFile\b/u.test(text) || /appendFileSync\(\s*process\.env\.LOG_FILE\b/u.test(text);
|
||||
const missingWriter = !text.includes("createHourlyJsonlWriter");
|
||||
return directLogAppend || missingWriter ? [{ path, directLogAppend, missingWriter }] : [];
|
||||
});
|
||||
return {
|
||||
name: "logs:unified-hourly-rotation",
|
||||
ok: offenders.length === 0,
|
||||
detail: {
|
||||
sharedWriter: "src/components/shared/src/rotating-jsonl.ts",
|
||||
checkedFiles: serviceFiles,
|
||||
offenders,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function runChecks(config: UniDeskConfig): { ok: boolean; items: CheckItem[] } {
|
||||
const items: CheckItem[] = [
|
||||
{ name: "config:validated", ok: true, detail: { project: config.project.name, runtime: config.runtime } },
|
||||
@@ -39,6 +65,7 @@ export function runChecks(config: UniDeskConfig): { ok: boolean; items: CheckIte
|
||||
fileItem("src/components/frontend/src/index.ts"),
|
||||
fileItem("src/components/provider-gateway/src/index.ts"),
|
||||
fileItem("scripts/src/e2e.ts"),
|
||||
unifiedLogRotationItem(),
|
||||
commandItem("bun:version", ["bun", "--version"]),
|
||||
commandItem("typescript:scripts", ["bunx", "tsc", "-p", "scripts/tsconfig.json", "--noEmit", "--pretty", "false"]),
|
||||
commandItem("typescript:components", ["bunx", "tsc", "-p", "src/tsconfig.check.json", "--pretty", "false"]),
|
||||
|
||||
Reference in New Issue
Block a user