Move trophy definitions next to each game and type trophy ids

オープン
#38 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript, vite

調査の方向性

Start with shared/achievements.ts and games/registry.json to understand the trophy list and game registry, then read src/hub/trophies-panel.ts for how games without trophies are displayed. The issue proposes four steps, including adding tests despite noting that no test suite exists; first run npm run typecheck and npm run build to establish the baseline. Done means mistyped trophy IDs fail typechecking and adding a game no longer requires editing shared/achievements.ts.

索引モデルが issue の本文から書いたものです。

説明

severity: medium tech-debt

Summary

All 43 trophies live in one hand-maintained list in a shared module, so every new game edits shared code, and the set of games is stated twice (registry and the trophy list). Trophy ids are bare strings at call sites.

Where

  • shared/achievements.ts:22-76, shared/achievements.ts:110-111, shared/achievements.ts:143-144
  • src/hub/trophies-panel.ts:26-27 (games with no trophies are skipped, hiding their stats)

Impact

  • A mistyped id in unlock('...') compiles and silently never unlocks.
  • A game added without trophies is excluded from the "play every game" trophy and from the stats panel.
  • shared/achievements.ts changes in every game-add commit.

Suggested fix

Each step leaves the build working:

  1. Add tests for unlock, addCounter, recordPlay and a registry consistency test.
  2. Derive a TrophyId union from the list (as const) and type unlock(id: TrophyId). No behaviour change.
  3. Move each game's rows to games/<slug>/trophies.ts and build the list with import.meta.glob (Phaser-free, so the hub still loads it cheaply).
  4. Derive the "play every game" set from the registry, and render a stats-only section for games with no trophies.

Acceptance criteria

  • A mistyped trophy id fails typecheck
  • Adding a game does not require editing shared/achievements.ts

Getting started

  • Relevant files: shared/achievements.ts, games/registry.json, src/hub/trophies-panel.ts
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Related: #1


Filed by repo-audit/full-audit at b001f5d. Severity: medium. Effort: M. audit-key: tech-debt|shared/achievements.ts|TROPHIES

主要言語
TypeScript
スター
3
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/GH-Arcade のほかの issue

TMHSDigital/GH-Arcade の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。