From 002b5a446c3db6a56cd91e3589ab2cef1e3f750b Mon Sep 17 00:00:00 2001 From: Radiquum Date: Sat, 6 Sep 2025 00:19:16 +0500 Subject: [PATCH] refactor/api-prox: config.json -> config.ts --- api-prox/bun.lock | 8 ++++++++ api-prox/package.json | 4 +++- api-prox/src/config.json | 1 - api-prox/src/config.ts | 1 + api-prox/src/index.ts | 6 +++--- api-prox/tsconfig.json | 12 ++++++++---- 6 files changed, 23 insertions(+), 9 deletions(-) delete mode 100644 api-prox/src/config.json create mode 100644 api-prox/src/config.ts diff --git a/api-prox/bun.lock b/api-prox/bun.lock index 2453ebe..b49efea 100644 --- a/api-prox/bun.lock +++ b/api-prox/bun.lock @@ -7,6 +7,8 @@ "hono": "^4.9.6", }, "devDependencies": { + "@types/node": "^20.11.17", + "typescript": "^5.9.2", "wrangler": "^4.4.0", }, }, @@ -134,6 +136,8 @@ "@speed-highlight/core": ["@speed-highlight/core@1.2.7", "", {}, "sha512-0dxmVj4gxg3Jg879kvFS/msl4s9F3T9UXC1InxgOf7t5NvcPD97u/WTA5vL/IxWHMn7qSxBozqrnnE2wvl1m8g=="], + "@types/node": ["@types/node@20.19.13", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-yCAeZl7a0DxgNVteXFHt9+uyFbqXGy/ShC4BlcHkoE0AfGXYv/BUiplV72DjMYXHDBXFjhvr6DD1NiRVfB4j8g=="], + "acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="], "acorn-walk": ["acorn-walk@8.3.2", "", {}, "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A=="], @@ -194,10 +198,14 @@ "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="], + "ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="], "undici": ["undici@7.15.0", "", {}, "sha512-7oZJCPvvMvTd0OlqWsIxTuItTpJBpU1tcbVl24FMn3xt3+VSunwUasmfPJRE57oNO1KsZ4PgA1xTdAX4hq8NyQ=="], + "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + "unenv": ["unenv@2.0.0-rc.20", "", { "dependencies": { "defu": "^6.1.4", "exsolve": "^1.0.7", "ohash": "^2.0.11", "pathe": "^2.0.3", "ufo": "^1.6.1" } }, "sha512-8tn4tAl9vD5nWoggAAPz28vf0FY8+pQAayhU94qD+ZkIbVKCBAH/E1MWEEmhb9Whn5EgouYVfBJB20RsTLRDdg=="], "workerd": ["workerd@1.20250902.0", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20250902.0", "@cloudflare/workerd-darwin-arm64": "1.20250902.0", "@cloudflare/workerd-linux-64": "1.20250902.0", "@cloudflare/workerd-linux-arm64": "1.20250902.0", "@cloudflare/workerd-windows-64": "1.20250902.0" }, "bin": { "workerd": "bin/workerd" } }, "sha512-rM+8ARYoy9gWJNPW89ERWyjbp7+m1hu6PFbehiP8FW9Hm5kNVo71lXFrkCP2HSsTP1OLfIU/IwanYOijJ0mQDw=="], diff --git a/api-prox/package.json b/api-prox/package.json index 24c3610..24e6bc8 100644 --- a/api-prox/package.json +++ b/api-prox/package.json @@ -10,6 +10,8 @@ "hono": "^4.9.6" }, "devDependencies": { - "wrangler": "^4.4.0" + "@types/node": "^20.11.17", + "wrangler": "^4.4.0", + "typescript": "^5.9.2" } } \ No newline at end of file diff --git a/api-prox/src/config.json b/api-prox/src/config.json deleted file mode 100644 index 9904ca9..0000000 --- a/api-prox/src/config.json +++ /dev/null @@ -1 +0,0 @@ -{"appVersion": "0.0.1"} \ No newline at end of file diff --git a/api-prox/src/config.ts b/api-prox/src/config.ts new file mode 100644 index 0000000..921037e --- /dev/null +++ b/api-prox/src/config.ts @@ -0,0 +1 @@ +export const appVersion = "0.0.0"; \ No newline at end of file diff --git a/api-prox/src/index.ts b/api-prox/src/index.ts index 17fb0bc..0bd6486 100644 --- a/api-prox/src/index.ts +++ b/api-prox/src/index.ts @@ -1,7 +1,7 @@ import { Hono } from "hono"; import { trimTrailingSlash } from 'hono/trailing-slash' import { asciiHTML, separatorHTML } from "./utils/info.js"; -import config from "./config.json" with { type: "json" }; +import { appVersion } from "./config.js"; const app = new Hono({ strict: true }); app.use(trimTrailingSlash()) @@ -49,14 +49,14 @@ app.get("/health", (c) => { ${asciiHTML()} ${separatorHTML()}

Status: OK

-

Version: ${config.appVersion}

+

Version: ${appVersion}

`); }); app.get("/health/json", (c) => { - return c.json({"status": "OK", "version": config.appVersion}); + return c.json({"status": "OK", "version": appVersion}); }); export default app; diff --git a/api-prox/tsconfig.json b/api-prox/tsconfig.json index 20f8eea..8a49856 100644 --- a/api-prox/tsconfig.json +++ b/api-prox/tsconfig.json @@ -3,14 +3,18 @@ "target": "ESNext", "module": "NodeNext", "moduleResolution": "NodeNext", + "resolveJsonModule": true, + "esModuleInterop": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, "strict": true, "skipLibCheck": true, - "lib": [ - "ESNext" - ], + "lib": ["ESNext"], "jsx": "react-jsx", "jsxImportSource": "hono/jsx", "outDir": "./dist" }, + "include": ["src/**/*.ts", "src/**/*.json"], "exclude": ["node_modules"] -} \ No newline at end of file +}