build app-with-deps (#221)

This commit is contained in:
Olivier Chafik 2026-01-09 01:26:31 +00:00 • committed by GitHub
commit e078250adf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View file

@ -7,7 +7,10 @@ await $`tsc`;
const isDevelopment = Bun.env.NODE_ENV === "development";
// Build all JavaScript/TypeScript files
function buildJs(entrypoint: string, opts: Record<string, any> = {}) {
function buildJs(
entrypoint: string,
opts: Partial<Parameters<(typeof Bun)["build"]>[0]> = {},
) {
return Bun.build({
entrypoints: [entrypoint],
outdir: "dist",
@ -27,6 +30,10 @@ await Promise.all([
outdir: "dist/src",
external: ["@modelcontextprotocol/sdk"],
}),
buildJs("src/app.ts", {
outdir: "dist/src",
naming: { entry: "app-with-deps.js" },
}),
buildJs("src/app-bridge.ts", {
outdir: "dist/src",
external: ["@modelcontextprotocol/sdk"],
@ -35,6 +42,11 @@ await Promise.all([
outdir: "dist/src/react",
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
}),
buildJs("src/react/index.tsx", {
outdir: "dist/src/react",
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
naming: { entry: "react-with-deps.js" },
}),
buildJs("src/server/index.ts", {
outdir: "dist/src/server",
external: ["@modelcontextprotocol/sdk"],

View file

@ -15,10 +15,18 @@
"types": "./dist/src/app.d.ts",
"default": "./dist/src/app.js"
},
"./app-with-deps": {
"types": "./dist/src/app.d.ts",
"default": "./dist/src/app-with-deps.js"
},
"./react": {
"types": "./dist/src/react/index.d.ts",
"default": "./dist/src/react/index.js"
},
"./react-with-deps": {
"types": "./dist/src/react/index.d.ts",
"default": "./dist/src/react/react-with-deps.js"
},
"./app-bridge": {
"types": "./dist/src/app-bridge.d.ts",
"default": "./dist/src/app-bridge.js"