fix: use owner-level unidesk state

This commit is contained in:
Codex
2026-07-10 05:09:13 +02:00
parent 01ff35d0f8
commit fbd9dbbae1
48 changed files with 133 additions and 148 deletions
+16 -9
View File
@@ -1,6 +1,7 @@
import { chromium, type BrowserContext, type Request } from "playwright";
import { existsSync } from "node:fs";
import { resolve } from "node:path";
import { homedir } from "node:os";
import { join, resolve } from "node:path";
import { readConfig } from "./config";
interface CodeQueuePerfOptions {
@@ -20,6 +21,8 @@ interface ApiTiming {
durationMs: number;
}
const isCheckMode = process.execArgv.includes("--check");
function argValue(args: string[], name: string): string | null {
const index = args.indexOf(name);
if (index === -1) return null;
@@ -90,7 +93,7 @@ function parseNumberAttr(value: string | null): number | null {
}
async function runCodeQueuePerf(options: CodeQueuePerfOptions): Promise<Record<string, unknown>> {
const browsersPath = process.env.PLAYWRIGHT_BROWSERS_PATH || ".state/playwright-browsers";
const browsersPath = process.env.PLAYWRIGHT_BROWSERS_PATH || join(homedir(), ".unidesk", ".state", "playwright-browsers");
const fullChromePath = resolve(browsersPath, "chromium-1217/chrome-linux64/chrome");
const launchArgs = [
"--no-sandbox",
@@ -211,11 +214,15 @@ async function runCodeQueuePerf(options: CodeQueuePerfOptions): Promise<Record<s
}
}
const options = readOptions();
const result = await runCodeQueuePerf(options);
if (options.json) {
console.log(JSON.stringify(result));
} else {
console.log(JSON.stringify(result, null, 2));
async function main(): Promise<void> {
const options = readOptions();
const result = await runCodeQueuePerf(options);
if (options.json) {
console.log(JSON.stringify(result));
} else {
console.log(JSON.stringify(result, null, 2));
}
if (result.ok !== true) process.exitCode = 1;
}
if (result.ok !== true) process.exitCode = 1;
if (import.meta.main && !isCheckMode) await main();