File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 31
31
"prepare" : " npm run build" ,
32
32
"build:clean" : " rm -rf dist" ,
33
33
"build:update-package-info" : " tsx scripts/update-package-info.ts" ,
34
- "build:esm" : " tsc --project tsconfig.esm.json && echo '{\" type\" :\" module\" }' > dist/package.json" ,
35
- "build:cjs" : " tsc --project tsconfig.cjs.json && echo '{\" type\" :\" commonjs\" }' > dist/cjs/package.json" ,
34
+ "build:esm" : " tsc --project tsconfig.esm.json" ,
35
+ "build:cjs" : " tsc --project tsconfig.cjs.json" ,
36
+ "build:package-json" : " tsx scripts/write-package-json.ts" ,
36
37
"build:chmod" : " chmod +x dist/cjs/index.js" ,
37
- "build" : " npm run build:clean && npm run build:esm && npm run build:cjs && npm run build:chmod" ,
38
+ "build" : " npm run build:clean && npm run build:esm && npm run build:cjs && npm run build:package-json && npm run build: chmod" ,
38
39
"inspect" : " npm run build && mcp-inspector -- dist/cjs/index.js" ,
39
40
"prettier" : " prettier" ,
40
41
"check" : " npm run build && npm run check:types && npm run check:lint && npm run check:format" ,
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env tsx
2
+
3
+ import { writeFileSync , mkdirSync } from "fs" ;
4
+ import { resolve } from "path" ;
5
+
6
+ const distDir = resolve ( "dist" ) ;
7
+
8
+ // ESM package.json
9
+ const esmPath = resolve ( distDir , "esm" , "package.json" ) ;
10
+ mkdirSync ( resolve ( distDir , "esm" ) , { recursive : true } ) ;
11
+ writeFileSync ( esmPath , JSON . stringify ( { type : "module" } ) ) ;
12
+
13
+ // CJS package.json
14
+ const cjsPath = resolve ( distDir , "cjs" , "package.json" ) ;
15
+ mkdirSync ( resolve ( distDir , "cjs" ) , { recursive : true } ) ;
16
+ writeFileSync ( cjsPath , JSON . stringify ( { type : "commonjs" } ) ) ;
You can’t perform that action at this time.
0 commit comments