diff --git a/docs/development/CENTRAL.md b/docs/development/CENTRAL.md index aa2da36..cbf1b6e 100644 --- a/docs/development/CENTRAL.md +++ b/docs/development/CENTRAL.md @@ -140,3 +140,4 @@ - [Strict Cache Structure](./devlog/2025-12-18-213300_strict_cache_structure.md): Completed. Enforced cache structure `/cards/[code]/full` and `/cards/[code]/crop`, removing the `images` subdirectory and ensuring strict local file usage. - [Implicit Image Caching](./devlog/2025-12-18-213900_implicit_image_caching.md): Completed. Updated API routes `/api/sets/:code/cards` and `/api/cards/parse` to implicitly trigger and await image caching, ensuring assets are available immediately for generators. - [Restore Images Subdirectory](./devlog/2025-12-18-214300_restore_images_subdir.md): Completed. Corrected cache folder structure to `/cards/images/[set]/full` and `/cards/images/[set]/crop` as per user request. +- [Fix Build Unused Variables](./devlog/2025-12-19-011500_fix_build_unused_vars.md): Completed. Resolved TS6133 errors in RulesEngine, PersistenceManager, and CardService to fix Docker build failure. diff --git a/docs/development/devlog/2025-12-19-011500_fix_build_unused_vars.md b/docs/development/devlog/2025-12-19-011500_fix_build_unused_vars.md new file mode 100644 index 0000000..36d0653 --- /dev/null +++ b/docs/development/devlog/2025-12-19-011500_fix_build_unused_vars.md @@ -0,0 +1,24 @@ +# Fix Build Unused Variables + +## Objective +Fix Typescript errors preventing `npm run build` execution in the Docker container. +The errors were `TS6133` (unused variables) in: +- `server/game/RulesEngine.ts` +- `server/managers/PersistenceManager.ts` +- `server/services/CardService.ts` + +## Changes +1. **RulesEngine.ts**: + - Removed unused imports: `PlayerState`, `StackObject`. + - Renamed unused parameter `playerId` to `_playerId` in `cleanupStep`. + - (Also fixed an accidental comment injection during the process). + +2. **PersistenceManager.ts**: + - Removed unused `__dirname` and `__filename` definitions. + - Removed unused `fileURLToPath` import. + +3. **CardService.ts**: + - Removed unused `fs` import. + +## Verification +- Ran `npx tsc --noEmit` in `src` directory. Result: Exit code 0 (Success). diff --git a/src/client/dev-dist/sw.js b/src/client/dev-dist/sw.js index 4c4fa65..8961311 100644 --- a/src/client/dev-dist/sw.js +++ b/src/client/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-5a5d9309'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.56865l1cj5s" + "revision": "0.l4u3i9b5p1c" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/server/game/RulesEngine.ts b/src/server/game/RulesEngine.ts index 9381426..405ba35 100644 --- a/src/server/game/RulesEngine.ts +++ b/src/server/game/RulesEngine.ts @@ -1,5 +1,5 @@ -import { StrictGameState, PlayerState, Phase, Step, StackObject } from './types'; +import { StrictGameState, Phase, Step } from './types'; export class RulesEngine { public state: StrictGameState; @@ -561,7 +561,7 @@ export class RulesEngine { } } - private cleanupStep(playerId: string) { + private cleanupStep(_playerId: string) { // Remove damage, discard down to 7 console.log(`Cleanup execution.`); Object.values(this.state.cards).forEach(c => { diff --git a/src/server/managers/PersistenceManager.ts b/src/server/managers/PersistenceManager.ts index d5e9715..53164a7 100644 --- a/src/server/managers/PersistenceManager.ts +++ b/src/server/managers/PersistenceManager.ts @@ -4,12 +4,10 @@ import path from 'path'; import { RoomManager } from './RoomManager'; import { DraftManager } from './DraftManager'; import { GameManager } from './GameManager'; -import { fileURLToPath } from 'url'; + import { RedisClientManager } from './RedisClientManager'; -// Handling __dirname in ESM -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); + // Store data in src/server/data so it persists (assuming not inside a dist that gets wiped, but user root) const DATA_DIR = path.resolve(process.cwd(), 'server-data'); diff --git a/src/server/services/CardService.ts b/src/server/services/CardService.ts index 89eaa45..cc09194 100644 --- a/src/server/services/CardService.ts +++ b/src/server/services/CardService.ts @@ -1,5 +1,5 @@ -import fs from 'fs'; + import path from 'path'; import { fileURLToPath } from 'url'; import { fileStorageManager } from '../managers/FileStorageManager';