Skip to content

Commit f5e4ec1

Browse files
authored
Merge pull request #42 from commandlayer/codex/fix-cross-platform-build-script-for-agent-sdk
fix: make build schema copy step cross-platform
2 parents 41d4b30 + 62387ed commit f5e4ec1

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"access": "public"
2020
},
2121
"scripts": {
22-
"build": "tsc -p tsconfig.json && mkdir -p dist/src && cp src/schemas.trust-*.json dist/src/",
22+
"build": "tsc -p tsconfig.json && node scripts/copy-schemas.mjs",
2323
"test": "node --test dist/test/receipt.test.js dist/test/trust.test.js",
2424
"pretest": "npm run build",
2525
"example:basic": "node dist/examples/basic-agent.js",

scripts/copy-schemas.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { copyFile, mkdir, readdir } from 'node:fs/promises';
2+
import path from 'node:path';
3+
4+
const sourceDir = 'src';
5+
const destinationDir = path.join('dist', 'src');
6+
const schemaPattern = /^schemas\.trust-.*\.json$/;
7+
8+
await mkdir(destinationDir, { recursive: true });
9+
10+
const sourceEntries = await readdir(sourceDir, { withFileTypes: true });
11+
const schemaFiles = sourceEntries
12+
.filter((entry) => entry.isFile() && schemaPattern.test(entry.name))
13+
.map((entry) => entry.name);
14+
15+
await Promise.all(
16+
schemaFiles.map((fileName) =>
17+
copyFile(path.join(sourceDir, fileName), path.join(destinationDir, fileName)),
18+
),
19+
);

0 commit comments

Comments
 (0)