fix: remove unused imports and variables from server files to resolve build errors.
All checks were successful
Build and Deploy / build (push) Successful in 1m32s

This commit is contained in:
2025-12-19 01:10:19 +01:00
parent 49080d8233
commit 755ae73d9e
6 changed files with 31 additions and 8 deletions

View File

@@ -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.

View File

@@ -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).

View File

@@ -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"), {

View File

@@ -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 => {

View File

@@ -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');

View File

@@ -1,5 +1,5 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { fileStorageManager } from '../managers/FileStorageManager';