Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Commit a7a716b

Browse files
update package.json and pnpm-lock.yaml to bump es-toolkit and moodle-client versions, remove test.json, and enhance pre-commit hook for type checking
1 parent 9380a97 commit a7a716b

8 files changed

Lines changed: 863 additions & 817 deletions

File tree

.husky/pre-commit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
pnpm run build
2-
pnpm run bundle
31
pnpm typecheck
42
pnpm test
5-
git add .
63

74
##############################################
85
# Check if package.json is staged for commit #

dist/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"bin": {
88
"moodle-openapi-server": "./dist/index.js"
99
},
10-
"files": ["dist"],
10+
"files": [
11+
"dist"
12+
],
1113
"scripts": {
1214
"build": "tsgo && ts-add-js-extension --dir=dist && cp package.json dist/package.json",
1315
"bundle": "bun build src/server.ts --outfile=dist/server.bundle.js",
@@ -31,7 +33,7 @@
3133
"@dotenvx/dotenvx": "^1.44.1",
3234
"@total-typescript/ts-reset": "^0.6.1",
3335
"concurrently": "^8.2.2",
34-
"es-toolkit": "^1.39.1",
36+
"es-toolkit": "^1.39.3",
3537
"fastmcp": "^1.27.7",
3638
"hono": "^4.7.11"
3739
},

dist/server.bundle.js

Lines changed: 798 additions & 770 deletions
Large diffs are not rendered by default.

dist/src/server.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ app.get("/docs/swagger/:id", (c) => {
145145
// remove the protocol and the domain from the domainUrl
146146
const host = new URL(domainUrl).host;
147147
doc.host = host;
148+
// Patch all paths/methods to ensure summary, description, operationId
149+
if (doc.paths) {
150+
for (const [path, methods] of Object.entries(doc.paths)) {
151+
for (const [method, op] of Object.entries(methods)) {
152+
if (typeof op !== "object" || op == null)
153+
continue;
154+
// @ts-ignore
155+
if (!op.summary)
156+
// @ts-ignore
157+
op.summary = `Endpoint for ${method.toUpperCase()} ${path}`;
158+
// @ts-ignore
159+
if (!op.description)
160+
op.description = op.summary;
161+
// @ts-ignore
162+
if (!op.operationId)
163+
// @ts-ignore
164+
op.operationId = `${method}${path.replace(/\W+/g, "_")}`;
165+
}
166+
}
167+
}
148168
return c.json(doc, { status: 200 });
149169
});
150170
app.get("/docs/openapi_3_1/:id{.+\\.json}", (c) => {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "moodle-openapi-server",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Moddle OpenAPI server",
55
"private": true,
66
"type": "module",
@@ -31,7 +31,7 @@
3131
"@dotenvx/dotenvx": "^1.44.1",
3232
"@total-typescript/ts-reset": "^0.6.1",
3333
"concurrently": "^8.2.2",
34-
"es-toolkit": "^1.39.1",
34+
"es-toolkit": "^1.39.3",
3535
"fastmcp": "^1.27.7",
3636
"hono": "^4.7.11"
3737
},

pnpm-lock.yaml

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ app.get("/docs/swagger/:id", (c) => {
221221
const host = new URL(domainUrl).host;
222222
doc.host = host;
223223

224+
// Patch all paths/methods to ensure summary, description, operationId
225+
if (doc.paths) {
226+
for (const [path, methods] of Object.entries(doc.paths)) {
227+
for (const [method, op] of Object.entries(methods)) {
228+
if (typeof op !== "object" || op == null) continue;
229+
230+
// @ts-ignore
231+
if (!op.summary)
232+
// @ts-ignore
233+
op.summary = `Endpoint for ${method.toUpperCase()} ${path}`;
234+
// @ts-ignore
235+
if (!op.description) op.description = op.summary;
236+
// @ts-ignore
237+
if (!op.operationId)
238+
// @ts-ignore
239+
op.operationId = `${method}${path.replace(/\W+/g, "_")}`;
240+
}
241+
}
242+
}
243+
224244
return c.json(doc, { status: 200 });
225245
});
226246

test.json

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

0 commit comments

Comments
 (0)