源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)
This commit is contained in:
commit
04bac1f6e2
2200 files changed
+489415
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { renderArtifactIndexHtml, scanTestRuns } from "../src/index.ts";
|
||||
|
||||
const repoRoot = fileURLToPath(new URL("../../../..", import.meta.url));
|
||||
const resultsDir = join(repoRoot, "evals", "results");
|
||||
const testRunsDir = join(resultsDir, "test-runs");
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const shouldOpen = args.includes("--open");
|
||||
const unknown = args.filter((arg) => arg !== "--open");
|
||||
if (unknown.length > 0) throw new Error(`Unknown argument: ${unknown[0]}`);
|
||||
|
||||
await mkdir(testRunsDir, { recursive: true });
|
||||
const entries = await scanTestRuns(resultsDir);
|
||||
const indexPath = join(testRunsDir, "index.html");
|
||||
await writeFile(indexPath, renderArtifactIndexHtml(entries), "utf8");
|
||||
process.stdout.write(`${indexPath}\n`);
|
||||
|
||||
if (shouldOpen) {
|
||||
if (process.platform !== "darwin") throw new Error("--open is only supported on darwin.");
|
||||
const opened = spawnSync("open", [indexPath], { stdio: "inherit" });
|
||||
if (opened.error || opened.status !== 0) throw opened.error ?? new Error(`open exited ${opened.status}`);
|
||||
}
|
||||
Reference in new issue
Block a user