* feat: make MCP SDK a peer dependency - Move @modelcontextprotocol/sdk from dependencies to peerDependencies (^1.20.0) - Add to devDependencies for local development (^1.24.3) - Externalize SDK from all build entry points (app, app-bridge, react, server) Benefits: - Consumers control their SDK version - Deduplication when consumer already has SDK - Follows pattern of react/zod peer deps * fix: require SDK ^1.24.0 for Zod 4 compatibility Earlier SDK versions have Zod type incompatibilities that cause build errors. * chore: update examples to SDK ^1.24.0 to match peer dep
42 lines
999 B
TypeScript
42 lines
999 B
TypeScript
#!/usr/bin/env bun
|
|
import { $ } from "bun";
|
|
|
|
// Run TypeScript compiler for type declarations
|
|
await $`tsc`;
|
|
|
|
const isDevelopment = Bun.env.NODE_ENV === "development";
|
|
|
|
// Build all JavaScript/TypeScript files
|
|
function buildJs(entrypoint: string, opts: Record<string, any> = {}) {
|
|
return Bun.build({
|
|
entrypoints: [entrypoint],
|
|
outdir: "dist",
|
|
target: "browser",
|
|
minify: !isDevelopment,
|
|
...(isDevelopment
|
|
? {
|
|
sourcemap: "inline",
|
|
}
|
|
: {}),
|
|
...opts,
|
|
});
|
|
}
|
|
|
|
await Promise.all([
|
|
buildJs("src/app.ts", {
|
|
outdir: "dist/src",
|
|
external: ["@modelcontextprotocol/sdk"],
|
|
}),
|
|
buildJs("src/app-bridge.ts", {
|
|
outdir: "dist/src",
|
|
external: ["@modelcontextprotocol/sdk"],
|
|
}),
|
|
buildJs("src/react/index.tsx", {
|
|
outdir: "dist/src/react",
|
|
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
|
|
}),
|
|
buildJs("src/server/index.ts", {
|
|
outdir: "dist/src/server",
|
|
external: ["@modelcontextprotocol/sdk"],
|
|
}),
|
|
]);
|