Skip to content

Commit 46d289f

Browse files
committed
add building for examples, add node 20 in main.yml
1 parent 0067a00 commit 46d289f

File tree

6 files changed

+62
-3
lines changed

6 files changed

+62
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
node-version: [22, 24]
41+
node-version: [20, 22, 24]
4242

4343
steps:
4444
- uses: actions/checkout@v6

examples/client/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
],
2424
"scripts": {
2525
"typecheck": "tsc -p tsconfig.json --noEmit",
26+
"build": "tsdown",
27+
"build:watch": "tsdown --watch",
2628
"prepack": "npm run build:esm && npm run build:cjs",
2729
"lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .",
2830
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
@@ -40,6 +42,7 @@
4042
"@modelcontextprotocol/sdk-examples-shared": "workspace:^",
4143
"@modelcontextprotocol/tsconfig": "workspace:^",
4244
"@modelcontextprotocol/eslint-config": "workspace:^",
43-
"@modelcontextprotocol/vitest-config": "workspace:^"
45+
"@modelcontextprotocol/vitest-config": "workspace:^",
46+
"tsdown": "catalog:devTools"
4447
}
4548
}

examples/client/tsdown.config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from 'tsdown';
2+
3+
export default defineConfig({
4+
// 1. Entry Points
5+
// Directly matches package.json include/exclude globs
6+
entry: ['src/**/*.ts'],
7+
8+
// 2. Output Configuration
9+
format: ['esm'],
10+
outDir: 'dist',
11+
clean: true, // Recommended: Cleans 'dist' before building
12+
sourcemap: true,
13+
14+
// 3. Platform & Target
15+
target: 'esnext',
16+
platform: 'node',
17+
shims: true, // Polyfills common Node.js shims (__dirname, etc.)
18+
19+
// 4. Type Definitions
20+
// Bundles d.ts files into a single output
21+
dts: false,
22+
// 5. Vendoring Strategy - Bundle the code for this specific package into the output,
23+
// but treat all other dependencies as external (require/import).
24+
noExternal: ['@modelcontextprotocol/sdk-examples-shared']
25+
});

examples/server/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
],
2424
"scripts": {
2525
"typecheck": "tsc -p tsconfig.json --noEmit",
26+
"build": "tsdown",
27+
"build:watch": "tsdown --watch",
2628
"prepack": "npm run build:esm && npm run build:cjs",
2729
"lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .",
2830
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
@@ -45,6 +47,7 @@
4547
"@modelcontextprotocol/tsconfig": "workspace:^",
4648
"@modelcontextprotocol/vitest-config": "workspace:^",
4749
"@types/cors": "catalog:devTools",
48-
"@types/express": "catalog:devTools"
50+
"@types/express": "catalog:devTools",
51+
"tsdown": "catalog:devTools"
4952
}
5053
}

examples/server/tsdown.config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from 'tsdown';
2+
3+
export default defineConfig({
4+
// 1. Entry Points
5+
// Directly matches package.json include/exclude globs
6+
entry: ['src/**/*.ts'],
7+
8+
// 2. Output Configuration
9+
format: ['esm'],
10+
outDir: 'dist',
11+
clean: true, // Recommended: Cleans 'dist' before building
12+
sourcemap: true,
13+
14+
// 3. Platform & Target
15+
target: 'esnext',
16+
platform: 'node',
17+
shims: true, // Polyfills common Node.js shims (__dirname, etc.)
18+
19+
// 4. Type Definitions
20+
// Bundles d.ts files into a single output
21+
dts: false,
22+
// 5. Vendoring Strategy - Bundle the code for this specific package into the output,
23+
// but treat all other dependencies as external (require/import).
24+
noExternal: ['@modelcontextprotocol/sdk-examples-shared']
25+
});

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)