From 9f77b8f7a311283f18b0c4a641e4d24825fe53e8 Mon Sep 17 00:00:00 2001 From: Pulkit Pareek Date: Tue, 12 May 2026 17:06:05 +0530 Subject: [PATCH] Dashboard: add @types/node so the Docker dashboard-build stage compiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Docker `dashboard-build` stage installs ONLY the dashboard workspace's deps and runs tsc --noEmit. Locally and in CI's validate job the dashboard tsc walked UP from dashboard/node_modules to find the root's @types/node — both workspaces share a parent filesystem. Inside Docker, /app/dashboard/node_modules is in isolation and there is no /app/node_modules to walk into, so playwright.config.ts and the test files erupted with TS2591 ("Cannot find name 'process'") and TS2304 ("Cannot find name 'global'"). The production deploy on main consequently failed at this exact step right after the dev → main merge fired the Deploy workflow. Fix: - Add @types/node ^20 to dashboard devDependencies (matches the root pin so the SDK version is identical). - Add "node" to dashboard/tsconfig.json compilerOptions.types so the explicit types list activates the new install. Verified locally: - npm --prefix dashboard run typecheck → clean - npm --prefix dashboard run build → 330 KB / 98 KB gzipped, source maps emitted - docker build --target dashboard-build → succeeds in isolation, reproducing the prod deploy path The dev branch's CI did not catch this because validate runs both root + dashboard `npm ci` in the same workspace, so root's @types/node was always reachable. Long-term gap: add a "build via Docker" check on dev too. Tracked separately. --- dashboard/package-lock.json | 18 ++++++++++++++++++ dashboard/package.json | 1 + dashboard/tsconfig.json | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json index 0960de7..f4ea32e 100644 --- a/dashboard/package-lock.json +++ b/dashboard/package-lock.json @@ -20,6 +20,7 @@ "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", "@testing-library/user-event": "^14.6.1", + "@types/node": "^20.19.41", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^4.7.0", @@ -2081,6 +2082,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "20.19.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.41.tgz", + "integrity": "sha512-ECymXOukMnOoVkC2bb1Vc/w/836DXncOg5m8Xj1RH7xSHZJWNYY6Zh7EH477vcnD5egKNNfy2RpNOmuChhFPgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.2.14", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", @@ -5331,6 +5342,13 @@ "typescript": ">=4.8.4 <6.1.0" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", diff --git a/dashboard/package.json b/dashboard/package.json index a048329..1ccc370 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -29,6 +29,7 @@ "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", "@testing-library/user-event": "^14.6.1", + "@types/node": "^20.19.41", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^4.7.0", diff --git a/dashboard/tsconfig.json b/dashboard/tsconfig.json index 8ff5b7f..fff5943 100644 --- a/dashboard/tsconfig.json +++ b/dashboard/tsconfig.json @@ -15,7 +15,7 @@ "noUnusedLocals": false, "noUnusedParameters": false, "noFallthroughCasesInSwitch": true, - "types": ["vitest/globals", "@testing-library/jest-dom"] + "types": ["node", "vitest/globals", "@testing-library/jest-dom"] }, "include": ["src", "vite.config.ts", "playwright.config.ts", "e2e"] }