refactor: move challenges to typescript and improve types (@fehmer)#8159
refactor: move challenges to typescript and improve types (@fehmer)#8159fehmer wants to merge 20 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors challenge definitions from frontend static JSON into a new @monkeytype/challenges workspace package, then wires frontend/backend to consume the shared TS source + stronger schemas/types.
Changes:
- Add
packages/challengespackage (typed challenge defs + helpers) and depend on it from frontend/backend. - Move
typedKeys/typedEntries/typedValuesinto@monkeytype/util/objectsand update call sites. - Tighten result schema typing by switching
CompletedEvent.challengetoChallengeNameSchema.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds workspace link + lock updates for new challenges package |
| packages/util/src/objects.ts | New shared typed keys/entries/values helpers |
| packages/schemas/src/results.ts | Uses ChallengeNameSchema for CompletedEvent.challenge |
| packages/schemas/src/challenges.ts | Introduces ChallengeNameSchema enum + ChallengeName type |
| packages/challenges/vitest.config.ts | Vitest config for new package |
| packages/challenges/tsup.config.js | TSUP entry config for new package |
| packages/challenges/tsconfig.json | TS config for building challenges package |
| packages/challenges/src/index.ts | New canonical challenge definitions + accessors |
| packages/challenges/scripts/challenge-roles.ts | Script to emit Discord role mapping |
| packages/challenges/package.json | Package metadata/scripts/exports for challenges |
| packages/challenges/.oxlintrc.json | Lint config for challenges package |
| packages/challenges/test/tsconfig.json | Test TS config scaffold |
| frontend/static/challenges/_list.json | Removes static challenges list JSON |
| frontend/src/ts/utils/misc.ts | Removes typedKeys/typedEntries from frontend misc utils |
| frontend/src/ts/utils/json-data.ts | Removes getChallengeList() fetcher for _list.json |
| frontend/src/ts/states/test.ts | Switches Challenge type import to @monkeytype/challenges |
| frontend/src/ts/controllers/url-handler.tsx | Loads challenge from URL using ChallengeController.setup() |
| frontend/src/ts/controllers/chart-controller.ts | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/controllers/challenge-controller.ts | Uses @monkeytype/challenges data instead of fetched JSON |
| frontend/src/ts/config/utils.ts | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/config/setters.ts | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/config/lifecycle.ts | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/components/pages/account/utils.ts | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/components/modals/SimpleModal.tsx | Switches to typedEntries from @monkeytype/util/objects |
| frontend/src/ts/components/common/AsyncContent.tsx | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/commandline/lists/load-challenge.ts | Builds challenge command list from getChallenges() |
| frontend/src/ts/commandline/lists.ts | Removes async challenge list bootstrap/waits |
| frontend/src/ts/commandline/commandline-metadata.ts | Switches to typedKeys from @monkeytype/util/objects |
| frontend/src/ts/auth.tsx | Switches to typedKeys from @monkeytype/util/objects |
| frontend/scripts/check-assets.ts | Removes challenges list validation path |
| frontend/package.json | Adds @monkeytype/challenges dependency |
| backend/src/constants/auto-roles.ts | Removes hardcoded auto-role list |
| backend/src/api/controllers/result.ts | Uses getChallenges() for auto-role eligibility |
| backend/package.json | Adds @monkeytype/challenges dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
No description provided.