simplify ui build
This commit is contained in:
parent
00023ba3e9
commit
adc73e4fa6
4 changed files with 6 additions and 8 deletions
|
|
@ -4,11 +4,9 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"build:uis": "rm -rf dist && concurrently 'UI=ui-raw.html vite build' 'UI=ui-vanilla.html vite build' 'UI=ui-react.html vite build'",
|
||||||
"build": "rm -rf dist && VITE_ENTRY=ui-raw vite build && VITE_ENTRY=ui-vanilla vite build && VITE_ENTRY=ui-react vite build",
|
|
||||||
"preview": "vite preview",
|
|
||||||
"server": "bun server.ts",
|
"server": "bun server.ts",
|
||||||
"start": "npm run build && npm run server"
|
"start": "npm run build:uis && npm run server"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/ext-apps": "../..",
|
"@modelcontextprotocol/ext-apps": "../..",
|
||||||
|
|
@ -23,6 +21,7 @@
|
||||||
"@types/react": "^19.2.2",
|
"@types/react": "^19.2.2",
|
||||||
"@types/react-dom": "^19.2.2",
|
"@types/react-dom": "^19.2.2",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
|
"concurrently": "^9.2.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,6 @@ app.delete("/mcp", async (req: Request, res: Response) => {
|
||||||
|
|
||||||
app.listen(MCP_PORT, () => {
|
app.listen(MCP_PORT, () => {
|
||||||
console.log(`MCP Server listening on http://localhost:${MCP_PORT}/mcp`);
|
console.log(`MCP Server listening on http://localhost:${MCP_PORT}/mcp`);
|
||||||
console.log(` Tools: create-ui-vanilla, create-ui-react, get-weather`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on("SIGINT", async () => {
|
process.on("SIGINT", async () => {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>MCP UI Client (Vanilla)</title>
|
<title>MCP UI Client (Raw)</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ import { viteSingleFile } from "vite-plugin-singlefile";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
|
|
||||||
// Get the entry from environment variable, default to ui-react
|
// Get the entry from environment variable, default to ui-react
|
||||||
const entry = process.env.VITE_ENTRY || "ui-react";
|
const uiPath = process.env.UI;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), viteSingleFile()],
|
plugins: [react(), viteSingleFile()],
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: resolve(__dirname, `${entry}.html`),
|
input: uiPath,
|
||||||
},
|
},
|
||||||
outDir: `dist`,
|
outDir: `dist`,
|
||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue