Skip to content

Commit 965ee79

Browse files
committed
feat(jira): migrate to Rollup for bundling and improve build process
- Add Rollup configuration for bundling the Jira package - Update package.json scripts to use Rollup for building - Add TypeScript configuration for Rollup - Remove unnecessary CHANGELOG.md in nested directory - Update build and inspector paths - Add module resolution and external dependency handling
1 parent 3b30a7d commit 965ee79

File tree

7 files changed

+623
-23
lines changed

7 files changed

+623
-23
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ dist/
55
.env*
66
.DS_Store
77
.idea/
8+
*.tgz
9+
.pnpm-store
10+
.pnpm-debug.log

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"scripts": {
88
"build": "pnpm -r build",
99
"dev": "pnpm -r watch",
10-
"inspector": "pnpm inspector"
10+
"inspector": "pnpm inspector",
11+
"postinstall": "pnpm -r build"
1112
},
1213
"devDependencies": {
1314
"@types/node": "^22.13.9",

packages/jira/package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,31 @@
66
"bin": {
77
"mcp-jira": "./build/index.js"
88
},
9-
"files": [
10-
"build"
11-
],
9+
"files": ["build"],
10+
"type": "module",
1211
"scripts": {
13-
"build": "tsc && node -e \"fs.chmodSync('build/index.js', '755')\"",
12+
"build:tsc": "rollup -c",
13+
"build:bundle": "pnpm run build:tsc",
14+
"build": "pnpm run build:tsc && npm run build:bundle && chmod +x dist/index.js",
1415
"prepare": "pnpm run build",
1516
"watch": "tsc --watch",
16-
"inspector": "npx @modelcontextprotocol/inspector build/index.js"
17+
"inspector": "npx @modelcontextprotocol/inspector dist/index.js"
1718
},
1819
"dependencies": {
19-
"@modelcontextprotocol/sdk": "1.6.1",
2020
"@mcp-devtools/http-client": "workspace:*",
21+
"@modelcontextprotocol/sdk": "1.6.1",
2122
"qs": "^6.12.0",
2223
"zod": "^3.22.4"
2324
},
2425
"devDependencies": {
26+
"@mcp-devtools/typescript-config": "workspace:*",
27+
"@rollup/plugin-commonjs": "^28.0.3",
28+
"@rollup/plugin-json": "^6.1.0",
29+
"@rollup/plugin-node-resolve": "^16.0.0",
2530
"@types/node": "^22.13.9",
2631
"@types/qs": "^6.9.14",
27-
"@mcp-devtools/typescript-config": "workspace:*",
32+
"rollup": "^4.35.0",
33+
"rollup-plugin-typescript2": "^0.36.0",
2834
"typescript": "^5.8.2"
2935
}
3036
}

packages/jira/packages/jira/CHANGELOG.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/jira/rollup.config.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { readFileSync } from "node:fs";
2+
import commonjs from "@rollup/plugin-commonjs";
3+
import json from "@rollup/plugin-json";
4+
import { nodeResolve } from "@rollup/plugin-node-resolve";
5+
import typescript from "rollup-plugin-typescript2";
6+
7+
// Node.js built-ins to keep external
8+
const builtins = [
9+
"fs",
10+
"path",
11+
"os",
12+
"crypto",
13+
"http",
14+
"https",
15+
"url",
16+
"util",
17+
"stream",
18+
"zlib",
19+
"child_process",
20+
"events",
21+
"assert",
22+
"buffer",
23+
"querystring",
24+
"readline",
25+
"tty",
26+
];
27+
28+
// Keep @modelcontextprotocol/sdk external since it's a peer dependency
29+
const externalPkgs = ["@modelcontextprotocol/sdk"];
30+
31+
export default {
32+
input: "src/index.ts",
33+
output: {
34+
file: "build/index.js",
35+
format: "cjs",
36+
banner: "#!/usr/bin/env node",
37+
sourcemap: false,
38+
},
39+
external: (id) => {
40+
// Keep Node.js built-ins external
41+
if (builtins.includes(id) || id.startsWith("node:")) return true;
42+
43+
// Keep specific packages external
44+
if (externalPkgs.some((pkg) => id === pkg || id.startsWith(`${pkg}/`)))
45+
return true;
46+
47+
return false;
48+
},
49+
plugins: [
50+
{
51+
name: "remove-shebang",
52+
transform(code, id) {
53+
if (id.includes("index.ts")) {
54+
return code.replace(/^#!.*/, "");
55+
}
56+
},
57+
},
58+
nodeResolve({
59+
preferBuiltins: true,
60+
}),
61+
commonjs(),
62+
json(),
63+
typescript({
64+
tsconfig: "./tsconfig.rollup.json",
65+
tsconfigOverride: {
66+
compilerOptions: {
67+
declaration: false,
68+
declarationMap: false,
69+
},
70+
},
71+
}),
72+
],
73+
};

packages/jira/tsconfig.rollup.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "ESNext",
5+
"moduleResolution": "Node"
6+
}
7+
}

0 commit comments

Comments
 (0)