refactor: Migrate the app to TypeScript

Convert the React app from JS/JSX to TS/TSX and add type-checking:
- Rename sheet-main, book, BookIndex, CharacterSheet to .ts(x) and
  add types (Fields, Bond, ClassEntry, Spell, CheckMap; loose
  SavedData for abbreviated save/share payloads)
- Add globals.d.ts for CSS imports and the __BOOK_DATA__ global
- tsconfig.json (strict, noEmit) and a 'typecheck' npm script
- webpack: handle ts/tsx via @babel/preset-typescript
- Enforce types with a tracked pre-commit hook (core.hooksPath),
  wired up automatically via the 'prepare' script
- Update stale Justfile format target for the src/ layout

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 00:51:53 +00:00
parent 0ba87ac547
commit 6461039bd7
11 changed files with 384 additions and 53 deletions

View File

@@ -1,12 +1,17 @@
{
"scripts": {
"build": "webpack --mode=production",
"dev": "webpack serve --mode=development"
"dev": "webpack serve --mode=development",
"typecheck": "tsc --noEmit",
"prepare": "git config core.hooksPath .githooks || true"
},
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/preset-react": "^7.29.7",
"@babel/preset-typescript": "^7.29.7",
"@babel/register": "^7.29.7",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"babel-loader": "^10.1.1",
"copy-webpack-plugin": "^14.0.0",
"css-loader": "^7.1.4",
@@ -17,6 +22,7 @@
"react": "^19.2.7",
"react-dom": "^19.2.7",
"style-loader": "^4.0.0",
"typescript": "^6.0.3",
"webpack": "^5.107.2",
"webpack-cli": "^7.0.3",
"webpack-dev-server": "^5.2.4"