-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.ts
More file actions
40 lines (32 loc) · 1.05 KB
/
build.ts
File metadata and controls
40 lines (32 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bun
/**
* Build script for Letta Code SDK
* Bundles TypeScript source and generates declarations
*/
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Read version from package.json
const pkg = JSON.parse(readFileSync(join(__dirname, "package.json"), "utf-8"));
const version = pkg.version;
console.log(`📦 Building Letta Code SDK v${version}...`);
// Bundle with Bun
await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
target: "node",
format: "esm",
minify: false,
sourcemap: "external",
});
// Generate type declarations
console.log("📝 Generating type declarations...");
const tscResult = Bun.spawnSync(["bunx", "tsc", "-p", "tsconfig.build.json"]);
if (tscResult.exitCode !== 0) {
console.error("Type generation failed:", tscResult.stderr.toString());
process.exit(1);
}
console.log("✅ Build complete!");
console.log(` Output: dist/`);