Skip to content

Commit 932d0e1

Browse files
authored
build: fix openapi spec path for docs & stats endpoints on dev (@nadalaba) (monkeytypegame#6343)
### Description 1. fix openapi specification path so that /docs endpoint would work on dev. > Error: ENOENT: no such file or directory, stat 'backend/src/static/api/public.html' Stack: Error: ENOENT: no such file or directory 2. fix openapi specification path so that API Operation would work on /stats endpoint on dev. > Cannot read openApi specification from backend/src/api/routes/../../static/api/openapi.json. Swagger stats will not fully work. ![stats](https://github.com/user-attachments/assets/82f3e8b4-814c-4ede-ba67-8da53dacad87) 3. remove unneeded `files` & `ts-node` options from `tsconfig.json` in various places. > File 'backend/src/types/types.d.ts' not found. The file is in the program because: Part of 'files' list in tsconfig.json 4. add the missing `pnpm test` script to the funbox package.
1 parent 572de8a commit 932d0e1

File tree

10 files changed

+3
-27
lines changed

10 files changed

+3
-27
lines changed

backend/__tests__/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"noEmit": true,
55
"types": ["vitest/globals"]
66
},
7-
"ts-node": {
8-
"files": true
9-
},
107
"files": ["vitest.d.ts"],
118
"include": ["./**/*.ts", "./**/*.spec.ts", "./setup-tests.ts"]
129
}

backend/scripts/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@
33
"compilerOptions": {
44
"target": "ES6"
55
},
6-
"ts-node": {
7-
"files": true
8-
},
9-
"files": ["../src/types/types.d.ts"],
106
"include": ["./**/*"]
117
}

backend/src/api/routes/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Response, Router } from "express";
22

33
const router = Router();
44

5-
const root = __dirname + "../../../static";
5+
const root = __dirname + "/../../../dist/static";
66

77
router.use("/internal", (req, res) => {
88
setCsp(res);

backend/src/api/routes/swagger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { readFileSync } from "fs";
55
import Logger from "../../utils/logger";
66

77
function addSwaggerMiddlewares(app: Application): void {
8-
const openApiSpec = __dirname + "/../../static/api/openapi.json";
8+
const openApiSpec = __dirname + "/../../../dist/static/api/openapi.json";
99
let spec = {};
1010
try {
1111
spec = JSON.parse(readFileSync(openApiSpec, "utf8")) as string;

backend/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"useUnknownInCatchVariables": false,
99
"strictPropertyInitialization": false
1010
},
11-
"ts-node": {
12-
"files": true
13-
},
1411
"include": ["src"],
1512
"exclude": [
1613
"node_modules",

frontend/__tests__/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"noEmit": true,
77
"types": ["vitest/globals"]
88
},
9-
"ts-node": {
10-
"files": true
11-
},
129
"files": ["vitest.d.ts"],
1310
"include": ["./**/*.spec.ts", "./setup-tests.ts"]
1411
}

packages/contracts/__test__/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,5 @@
44
"noEmit": true,
55
"types": ["vitest/globals"]
66
},
7-
"ts-node": {
8-
"files": true
9-
},
10-
"files": ["../src/types/types.d.ts"],
117
"include": ["./**/*.ts", "./**/*.spec.ts", "./setup-tests.ts"]
128
}

packages/funbox/__test__/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,5 @@
44
"noEmit": true,
55
"types": ["vitest/globals"]
66
},
7-
"ts-node": {
8-
"files": true
9-
},
10-
// "files": ["../src/types/types.d.ts"],
117
"include": ["./**/*.ts", "./**/*.spec.ts", "./setup-tests.ts"]
128
}

packages/funbox/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"dev": "tsup-node --watch",
66
"build": "npm run madge && tsup-node",
7+
"test": "vitest run",
78
"madge": " madge --circular --extensions ts ./src",
89
"ts-check": "tsc --noEmit",
910
"lint": "eslint \"./**/*.ts\""

packages/util/__test__/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,5 @@
44
"noEmit": true,
55
"types": ["vitest/globals"]
66
},
7-
"ts-node": {
8-
"files": true
9-
},
10-
// "files": ["../src/types/types.d.ts"],
117
"include": ["./**/*.ts", "./**/*.spec.ts", "./setup-tests.ts"]
128
}

0 commit comments

Comments
 (0)