Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/evals/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if (!wantsHelp && !wantsMan) {
const build = spawnSync("pnpm", ["run", "build"], {
stdio: "inherit",
cwd: "../..",
shell: process.platform === "win32",
});
if (build.status !== 0) process.exit(build.status ?? 1);
}
Expand Down
38 changes: 24 additions & 14 deletions packages/evals/scripts/build-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,37 @@ import { getRepoRootDir } from "../runtimePaths.js";

const repoRoot = getRepoRootDir();

import esbuild from "esbuild";

const run = (args: string[]) => {
const result = spawnSync("pnpm", args, { stdio: "inherit", cwd: repoRoot });
const cmd = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
const result = spawnSync(cmd, args, {
stdio: "inherit",
cwd: repoRoot,
});
if (result.error) {
console.error("Spawn error:", result.error);
process.exit(1);
}
if (result.status !== 0) {
process.exit(result.status ?? 1);
}
};

fs.mkdirSync(`${repoRoot}/packages/evals/dist/cli`, { recursive: true });

run([
"exec",
"esbuild",
"packages/evals/cli.ts",
"--bundle",
"--platform=node",
"--format=esm",
`--outfile=${repoRoot}/packages/evals/dist/cli/cli.js`,
"--sourcemap",
"--packages=external",
"--banner:js=#!/usr/bin/env node",
"--log-level=warning",
]);
esbuild.buildSync({
entryPoints: [`${repoRoot}/packages/evals/cli.ts`],
bundle: true,
platform: "node",
format: "esm",
outfile: `${repoRoot}/packages/evals/dist/cli/cli.js`,
sourcemap: true,
packages: "external",
banner: { js: "#!/usr/bin/env node" },
logLevel: "warning",
absWorkingDir: repoRoot,
});

/* ── merge config: always update tasks/benchmarks from source, but preserve user defaults ── */
const sourceConfig = JSON.parse(
Expand Down Expand Up @@ -66,6 +75,7 @@ fs.chmodSync(`${repoRoot}/packages/evals/dist/cli/cli.js`, 0o755);
const link = spawnSync("npm", ["link", "--force"], {
stdio: "inherit",
cwd: `${repoRoot}/packages/evals`,
shell: process.platform === "win32",
});
if (link.status !== 0) {
console.warn(
Expand Down
10 changes: 9 additions & 1 deletion packages/evals/scripts/build-esm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ import { getRepoRootDir } from "../runtimePaths.js";
const repoRoot = getRepoRootDir();

const run = (args: string[]) => {
const result = spawnSync("pnpm", args, { stdio: "inherit", cwd: repoRoot });
const result = spawnSync("pnpm", args, {
stdio: "inherit",
cwd: repoRoot,
shell: process.platform === "win32",
});
if (result.error) {
console.error("Spawn error:", result.error);
process.exit(1);
}
if (result.status !== 0) {
process.exit(result.status ?? 1);
}
Expand Down
Loading