build: Add Docker containerization documentation and remove unused variables to resolve TypeScript errors.
All checks were successful
Build and Deploy / build (push) Successful in 1m14s

This commit is contained in:
2025-12-14 22:55:00 +01:00
parent 6f3c773dfd
commit b8e23a5614
7 changed files with 26 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ The project has successfully migrated from a .NET backend to a Node.js Modular M
- **[2025-12-14] Fix Draft Images**: Fixed image loading in Draft UI by adding proxy configuration and correcting property access. [Link](./devlog/2025-12-14-230000_fix_draft_images.md)
- **[2025-12-14] Fix Submit Deck**: Implemented `player_ready` handler and state transition to auto-start game when deck is submitted. [Link](./devlog/2025-12-14-233000_fix_submit_deck.md)
- **[2025-12-14] Fix Hooks & Waiting State**: Resolved React hook violation crash and added proper waiting screen for ready players. [Link](./devlog/2025-12-14-234500_fix_hooks_and_waiting_state.md)
- **[2025-12-14] Docker Containerization**: Created Dockerfile, fixed build errors, and verified monolithic build. [Link](./devlog/2025-12-14-235700_docker_containerization.md)
## Active Modules
1. **Cube Manager**: Fully functional (Parsing, Fetching, Pack Generation).

View File

@@ -0,0 +1,24 @@
# Docker Containerization and Build Fixes
## Objectives
- Create a Dockerfile to package the application as a monolith (Node.js + React).
- Fix TypeScript build errors preventing successful compilation.
- Verify the build process.
## Changes
- **Dockerfile**: Created multi-stage build using `node:20-alpine`.
- Installs dependencies.
- Builds frontend.
- Prunes dev dependencies.
- **Server Entry (`src/server/index.ts`)**: Added logic to serve static `dist` files and handle client-side routing in production.
- **Package.json**: Moved `tsx` to dependencies and updated `start` script.
- **Code Fixes**: Removed unused variables in client and server code used to satisfy strict TypeScript rules:
- `DeckBuilderView.tsx`: Removed unused `payload`.
- `DraftView.tsx`: Removed unused `CardComponent`.
- `GameView.tsx`: Removed unused `myCommand`, `oppGraveyard`.
- `DraftManager.ts`: Removed unused `numPlayers`, `cardIndex`.
- `GameManager.ts`: Renamed unused args in `shuffleLibrary`.
## Status
- Docker build successful (`docker build -t mtg-draft-maker .`).
- Image ready for deployment.

View File

@@ -79,9 +79,6 @@ export const DeckBuilderView: React.FC<DeckBuilderViewProps> = ({ roomId, curren
// Host will gather decks? No, that's P2P.
// Let's emit 'submit_deck' payload.
const payload = {
[currentPlayerId]: fullDeck
};
// We need a way to accumulate decks on server.
// Let's assume we just log it for now and Host starts game with dummy decks or we add logic.
// Actually, user rules say "Host ... guided ... configuring packs ... multiplayer".

View File

@@ -1,7 +1,6 @@
import React, { useState, useEffect } from 'react';
import { socketService } from '../../services/SocketService';
import { CardComponent } from '../game/CardComponent';
interface DraftViewProps {
draftState: any;

View File

@@ -55,11 +55,9 @@ export const GameView: React.FC<GameViewProps> = ({ gameState, currentPlayerId }
const myGraveyard = getCards(currentPlayerId, 'graveyard');
const myLibrary = getCards(currentPlayerId, 'library');
const myExile = getCards(currentPlayerId, 'exile');
const myCommand = getCards(currentPlayerId, 'command');
const oppBattlefield = getCards(opponentId, 'battlefield');
const oppHand = getCards(opponentId, 'hand'); // Should be hidden/count only
const oppGraveyard = getCards(opponentId, 'graveyard');
const oppLibrary = getCards(opponentId, 'library');
return (

View File

@@ -38,7 +38,6 @@ export class DraftManager extends EventEmitter {
createDraft(roomId: string, players: string[], allPacks: Pack[]): DraftState {
// Distribute 3 packs to each player
const numPlayers = players.length;
// Assume allPacks contains (3 * numPlayers) packs
// Shuffle packs just in case (optional, but good practice)
@@ -83,7 +82,6 @@ export class DraftManager extends EventEmitter {
if (!playerState || !playerState.activePack) return null;
// Find card
const cardIndex = playerState.activePack.cards.findIndex(c => c.id === cardId || (c as any).uniqueId === cardId);
// uniqueId check implies if cards have unique instance IDs in pack, if not we rely on strict equality or assume 1 instance per pack
// Fallback: If we can't find by ID (if Scryfall ID generic), just pick the first matching ID?

View File

@@ -138,7 +138,7 @@ export class GameManager {
}
}
private shuffleLibrary(game: GameState, action: { playerId: string }) {
private shuffleLibrary(_game: GameState, _action: { playerId: string }) {
// In a real implementation we would shuffle the order array.
// Since we retrieve by filtering currently, we don't have order.
// We need to implement order index if we want shuffling.