esbuild instead of tsc

This commit is contained in:
azykov@mail.ru
2026-07-01 13:43:05 +03:00
parent 0d2b6f6067
commit ab985c8fc1
6 changed files with 22 additions and 3 deletions
+1
View File
@@ -14,6 +14,7 @@ FROM deps AS builder
WORKDIR /app WORKDIR /app
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY build.js ./
COPY src ./src COPY src ./src
RUN pnpm build RUN pnpm build
+13
View File
@@ -0,0 +1,13 @@
// build.js
import { build } from 'esbuild';
build({
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
target: 'node22',
format: 'esm',
outfile: 'dist/index.js',
sourcemap: true,
packages: 'external',
}).catch(() => process.exit(1));
+3 -2
View File
@@ -4,11 +4,11 @@
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "tsc",
"dev": "tsx watch src/index.ts", "dev": "tsx watch src/index.ts",
"start": "node dist/index.js", "start": "node dist/index.js",
"lint": "eslint .", "lint": "eslint .",
"typecheck": "tsc --noEmit", "typecheck": "tsc",
"build": "tsc && node build.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"keywords": [], "keywords": [],
@@ -27,6 +27,7 @@
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.21.0", "@eslint/js": "^9.21.0",
"@types/node": "^22.13.5", "@types/node": "^22.13.5",
"esbuild": "^0.28.1",
"eslint": "^9.21.0", "eslint": "^9.21.0",
"pino-pretty": "^13.1.3", "pino-pretty": "^13.1.3",
"tsx": "^4.19.3", "tsx": "^4.19.3",
+3
View File
@@ -226,6 +226,9 @@ importers:
'@types/node': '@types/node':
specifier: ^22.13.5 specifier: ^22.13.5
version: 22.20.0 version: 22.20.0
esbuild:
specifier: ^0.28.1
version: 0.28.1
eslint: eslint:
specifier: ^9.21.0 specifier: ^9.21.0
version: 9.39.4 version: 9.39.4
+1 -1
View File
@@ -1,7 +1,7 @@
import Fastify, { type FastifyInstance } from "fastify"; import Fastify, { type FastifyInstance } from "fastify";
import { ToolDef } from "./types"; import { ToolDef } from "./types";
import McpSession from "./mcpConnection"; import McpSession from "./mcpConnection";
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types"; import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
import { pingTool, testAddTool, testRemoveTool, listToolsTool, invokeToolTool } from "./mcpTools"; import { pingTool, testAddTool, testRemoveTool, listToolsTool, invokeToolTool } from "./mcpTools";
export class Server { export class Server {
+1
View File
@@ -6,6 +6,7 @@
"lib": ["ES2022"], "lib": ["ES2022"],
"outDir": "dist", "outDir": "dist",
"rootDir": "src", "rootDir": "src",
"noEmit": true,
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,