fit-lms-mcp 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +1 -1
- package/scripts/setup.mjs +17 -3
package/README.md
CHANGED
|
@@ -277,6 +277,8 @@ Version 2.0.0 requires Node.js 22 or later; Node.js 18 and 20 are no longer supp
|
|
|
277
277
|
|
|
278
278
|
The `publish.yml` workflow publishes on a `v*` Git tag push or a manual workflow run. Creating a GitHub Release does not trigger a second publish. Update `package.json` and `package-lock.json` before tagging a release, and make the tag match the package version (for example, `v2.0.0`). Published npm versions cannot be reused, even after unpublishing.
|
|
279
279
|
|
|
280
|
+
For manual runs, the `tag` input selects the npm distribution channel: `latest`, `beta`, or `next`. To publish the stable version `2.0.0` from `package.json`, select `latest`. The package version (`2.0.0`), Git tag (`v2.0.0`), and npm channel (`latest`) are separate values.
|
|
281
|
+
|
|
280
282
|
Publishing uses npm trusted publishing (OIDC) from a GitHub-hosted runner with Node.js 24 and npm 11. No `NPM_TOKEN` secret is required. Configure the package's Trusted Publisher on npm with:
|
|
281
283
|
|
|
282
284
|
- **Organization or user:** `DwaftPainter`
|
package/package.json
CHANGED
package/scripts/setup.mjs
CHANGED
|
@@ -81,12 +81,16 @@ export function stripJsonComments(text) {
|
|
|
81
81
|
const end = text.indexOf("*/", i + 2);
|
|
82
82
|
if (end === -1) break;
|
|
83
83
|
i = end + 1;
|
|
84
|
+
} else if (char === "}" || char === "]") {
|
|
85
|
+
// Strip trailing commas only outside strings, after skipping comments.
|
|
86
|
+
result = result.replace(/,(\s*)$/, "$1");
|
|
87
|
+
result += char;
|
|
84
88
|
} else {
|
|
85
89
|
result += char;
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
|
-
return result
|
|
93
|
+
return result;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
export function updateJsonConfigFile(configPath, serverConfig, key = "mcpServers") {
|
|
@@ -119,10 +123,20 @@ export function updateJsonConfigFile(configPath, serverConfig, key = "mcpServers
|
|
|
119
123
|
return false;
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
if (
|
|
126
|
+
if (Object.hasOwn(json, key) &&
|
|
127
|
+
(json[key] === null || typeof json[key] !== "object" || Array.isArray(json[key]))) {
|
|
128
|
+
console.error(`\n❌ Cấu trúc ${key} không hợp lệ (không phải JSON object): ${configPath}`);
|
|
129
|
+
console.error(` ⚠️ Đã HỦY thao tác ghi để bảo vệ file của bạn.`);
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (!Object.hasOwn(json, key)) {
|
|
123
133
|
json[key] = {};
|
|
124
134
|
}
|
|
125
|
-
|
|
135
|
+
// Reuse the legacy name when present so setup does not add a second server.
|
|
136
|
+
const serverName = !Object.hasOwn(json[key], "fit-lms") && Object.hasOwn(json[key], "hanu-lms")
|
|
137
|
+
? "hanu-lms"
|
|
138
|
+
: "fit-lms";
|
|
139
|
+
json[key][serverName] = serverConfig;
|
|
126
140
|
|
|
127
141
|
try {
|
|
128
142
|
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|