File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " mcp-framework" ,
3- "version" : " 0.1.4 " ,
3+ "version" : " 0.1.5 " ,
44 "description" : " Framework for building Model Context Protocol (MCP) servers in Typescript" ,
55 "type" : " module" ,
66 "author" : " Alex Andru <alex@andru.codes>" ,
1515 "files" : [
1616 " dist"
1717 ],
18+ "bin" : {
19+ "mcp-build" : " ./dist/cli/build.js"
20+ },
1821 "scripts" : {
1922 "build" : " tsc" ,
2023 "watch" : " tsc --watch" ,
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ import { spawnSync } from "child_process" ;
3+ import { readFileSync , writeFileSync } from "fs" ;
4+ import { join } from "path" ;
5+
6+ function runTsc ( ) {
7+ const tscPath = join ( process . cwd ( ) , "node_modules" , ".bin" , "tsc" ) ;
8+ const tsc = spawnSync ( tscPath , [ ] , {
9+ stdio : "inherit" ,
10+ shell : true ,
11+ } ) ;
12+
13+ if ( tsc . status !== 0 ) {
14+ process . exit ( tsc . status ?? 1 ) ;
15+ }
16+ }
17+
18+ function addShebang ( ) {
19+ const indexPath = join ( process . cwd ( ) , "dist" , "index.js" ) ;
20+ try {
21+ const content = readFileSync ( indexPath , "utf8" ) ;
22+ const shebang = "#!/usr/bin/env node\n" ;
23+
24+ if ( ! content . startsWith ( shebang ) ) {
25+ writeFileSync ( indexPath , shebang + content ) ;
26+ console . log ( "Added shebang to dist/index.js" ) ;
27+ }
28+ } catch ( error ) {
29+ console . error ( "Error adding shebang:" , error ) ;
30+ process . exit ( 1 ) ;
31+ }
32+ }
33+
34+ runTsc ( ) ;
35+
36+ addShebang ( ) ;
37+
38+ console . log ( "MCP Build complete" ) ;
You can’t perform that action at this time.
0 commit comments