Skip to content

Commit f84266a

Browse files
committed
fix: cli build issues
1 parent 06af3b8 commit f84266a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcp-framework",
3-
"version": "0.1.9",
3+
"version": "0.1.10",
44
"description": "Framework for building Model Context Protocol (MCP) servers in Typescript",
55
"type": "module",
66
"author": "Alex Andru <[email protected]>",
@@ -20,10 +20,9 @@
2020
"mcp-build": "./dist/cli/framework/build.js"
2121
},
2222
"scripts": {
23-
"build": "tsc",
23+
"build": "node ./dist/cli/framework/build.js",
2424
"watch": "tsc --watch",
25-
"test": "jest",
26-
"prepare": "npm run build"
25+
"prepare": "tsc && node ./dist/cli/framework/build.js"
2726
},
2827
"keywords": [
2928
"mcp",

src/cli/framework/build.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { spawnSync } from "child_process";
33
import { readFileSync, writeFileSync } from "fs";
44
import { join } from "path";
5+
import { platform } from "os";
56

67
export function buildFramework() {
78
runTsc();
@@ -10,13 +11,25 @@ export function buildFramework() {
1011
}
1112

1213
function runTsc() {
13-
const tscPath = join(process.cwd(), "node_modules", ".bin", "tsc");
14+
const isWindows = platform() === "win32";
15+
const tscPath = join(
16+
process.cwd(),
17+
"node_modules",
18+
".bin",
19+
isWindows ? "tsc.cmd" : "tsc"
20+
);
21+
1422
const tsc = spawnSync(tscPath, [], {
1523
stdio: "inherit",
1624
shell: true,
25+
env: {
26+
...process.env,
27+
PATH: process.env.PATH,
28+
},
1729
});
1830

1931
if (tsc.status !== 0) {
32+
console.error("TypeScript compilation failed");
2033
process.exit(tsc.status ?? 1);
2134
}
2235
}

0 commit comments

Comments
 (0)