Skip to content

Commit dc64739

Browse files
committed
refactor(example): reuse the package build command
1 parent c6eafac commit dc64739

2 files changed

Lines changed: 7 additions & 23 deletions

File tree

‎examples/custom-validation/run.mjs‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,11 @@ for (const name of ["app.mts", "validate.mts"]) {
1414

1515
const build = spawnSync(
1616
process.execPath,
17-
[
18-
fileURLToPath(
19-
new URL(
20-
"../../sdk/typescript/node_modules/typescript/bin/tsc",
21-
import.meta.url,
22-
),
23-
),
24-
"--project",
25-
fileURLToPath(
26-
new URL("../../sdk/typescript/tsconfig.examples.json", import.meta.url),
27-
),
28-
"--outDir",
29-
target,
30-
],
31-
{ stdio: "inherit" },
17+
["--run", "build:examples", "--", "--outDir", target],
18+
{
19+
cwd: fileURLToPath(new URL("../../sdk/typescript", import.meta.url)),
20+
stdio: "inherit",
21+
},
3222
);
3323
if (build.error) throw build.error;
3424
if (build.status !== 0) process.exit(build.status ?? 1);

‎sdk/typescript/tests-ts/custom-validation-example.test.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@ test("compiled validation example saves HTTP proof and exits after server cleanu
1212
try {
1313
const build = await runCommand(
1414
"node",
15-
[
16-
join(packageRoot, "node_modules", "typescript", "bin", "tsc"),
17-
"--project",
18-
join(packageRoot, "tsconfig.examples.json"),
19-
"--outDir",
20-
source,
21-
],
22-
{ timeout: 30_000 },
15+
["--run", "build:examples", "--", "--outDir", source],
16+
{ cwd: packageRoot, timeout: 30_000 },
2317
);
2418
expect(build.status, build.stdout + build.stderr).toBe(0);
2519
const proofPath = join(output, "artifacts", "http-proof.json");

0 commit comments

Comments
 (0)