How thebertdark/gcsim-to-multiopt works
Project Type and Purpose
• This is a client-side, single-page web application (SPA) built with Svelte/SvelteKit and Vite.
• Purpose: In-browser conversion of gcsim JSON/GZ sample files into configuration JSON for Genshin Optimizer’s Multi-Opt tool.
File Structure Analysis
• Top-level:
• .github/ – CI workflow (deploy) and issue templates
• package.json + lock – NPM dependencies and scripts
• svelte.config.js, vite.config.ts, tsconfig.json – build and TS configuration
• src/:
• app.html – base HTML shell
• routes/+page.svelte – main page component (entry point)
• lib/components/ – UI building blocks (PlayIcon, PauseIcon, WelcomeOverlay, etc.)
• lib/gcsim-to-multiopt/ – core conversion logic (config mappings, type definitions, convert.ts)
• lib/utils/ – ancillary functions (themeManager, konamiCode, holiday testers)
• static/:
• CSS for seasonal themes, audio assets
• No server or database directories – purely static front end
Key Insights from README
• Workflow: upload sample → parse JSON/GZ → select character → toggle mods → generate output → copy to clipboard → import into Genshin Optimizer
• Conversion engine lives entirely on the client
• The app is hosted as static files (via GitHub Pages or similar)
Main Components
a. Browser (Client)
• Svelte Frontend (UI Components)
• File Processor (Conversion Engine in TS)
• Theme/UX Utilities
b. Static Hosting
• CDN or GitHub Pages serves HTML, JS, CSS, assets
c. External Service
• Genshin Optimizer site (consumer of generated JSON)
Relationships and Data Flows
• User → Browser UI: drag & drop or click to upload file
• Browser UI → File Processor: invoke convert() with parsed data
• File Processor → UI: return processed config and error list
• UI → Clipboard API: copy JSON output
• User → Genshin Optimizer: paste JSON into Multi-Opt tool
• Hosting Provider → Browser: serves static assets over HTTP(S)
Architectural Patterns and Design Principles
• SPA architecture: view and logic co-located in client
• Component-based UI (Svelte components)
• Modular conversion engine: separate TS modules for mapping/config and processing
• No server-side state; all state lives in the browser
Technologies and Frameworks
• Svelte / SvelteKit for component-driven UI
• Vite for dev server and build
• TypeScript for type safety
• GitHub Actions for automated deploy
Elements
• Hosting/CDN
• External Genshin Optimizer
• From Browser to Hosting (asset fetch)
• From User to Browser (upload)
• Within Browser (UI → Conversion Engine → UI → Clipboard API)
• From User to Genshin Optimizer
• Green for hosting/infrastructure
• Orange for external integration