Skip to content

Commit 1b1c043

Browse files
authored
fix: externalize packages in CLI bundle (#47)
1 parent 706588d commit 1b1c043

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"scripts": {
4444
"build": "npm run build:runtime && npm run build:declarations",
4545
"build:declarations": "tsc -p ./tsconfig.build.json",
46-
"build:runtime": "esbuild ./src/index.ts ./src/cli.ts --bundle --platform=node --format=esm --target=node22 --outdir=./dist",
46+
"build:runtime": "esbuild ./src/index.ts ./src/cli.ts --bundle --packages=external --platform=node --format=esm --target=node22 --outdir=./dist",
4747
"fmt": "oxfmt .",
4848
"fmt:check": "oxfmt --check .",
4949
"prepare": "husky",
@@ -52,7 +52,7 @@
5252
"skillgym:help": "tsx ./index.ts help",
5353
"skillgym:example:basic": "tsx ./index.ts run ./examples/basic-suite.ts",
5454
"skillgym:example:skill-selection": "tsx ./index.ts run ./examples/skill-selection-suite.ts",
55-
"test": "vitest run",
55+
"test": "npm run build:runtime && vitest run",
5656
"typecheck": "tsc -p ./tsconfig.json --noEmit"
5757
},
5858
"dependencies": {

test/cli.test.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { execFileCapture } from "../src/utils/process.js";
77
import { accumulateTagOptionValues, parseTagOption } from "../src/cli/tag-options.js";
88

99
const repoRoot = process.cwd();
10-
const tsxLoaderPath = path.join(repoRoot, "node_modules", "tsx", "dist", "loader.mjs");
1110
const tempDirs: string[] = [];
1211

1312
afterEach(async () => {
@@ -880,12 +879,8 @@ test("cli run passes retryFailed through to execution", async () => {
880879
});
881880

882881
async function execCli(args: string[], cwd = repoRoot) {
883-
return execFileCapture(
884-
process.execPath,
885-
["--import", tsxLoaderPath, path.join(repoRoot, "index.ts"), ...args],
886-
{
887-
cwd,
888-
timeoutMs: 30_000,
889-
},
890-
);
882+
return execFileCapture(process.execPath, [path.join(repoRoot, "bin.js"), ...args], {
883+
cwd,
884+
timeoutMs: 30_000,
885+
});
891886
}

test/runner/execute-suite.reporter.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,8 @@ test("executeSuite raises process max listeners for parallel runs and restores i
14831483
passed: true,
14841484
durationMs: 10,
14851485
executionArtifactDir: options.artifactDir,
1486+
outputTokens: 0,
1487+
observedReads: 0,
14861488
});
14871489
},
14881490
});

test/runner/model-rejection.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async function createResultWithLogs(options: {
102102
passed: false,
103103
status: "failed",
104104
durationMs: 1,
105+
executionArtifactDir: artifactDir,
105106
artifactDir,
106107
error: {
107108
name: "Error",

0 commit comments

Comments
 (0)