From 2c73764a17585cff4908a9269f6ac6cfb18c4774 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 16 Aug 2026 09:29:49 +0300 Subject: [PATCH] Extract @sendou/in-game-lists and @sendou/tournament-engine workspace packages --- .../app/components/AbilitiesSelector.tsx | 4 +- apps/web-react/app/components/Ability.tsx | 2 +- apps/web-react/app/components/BuildCard.tsx | 14 +-- .../web-react/app/components/GameTimeline.tsx | 3 +- apps/web-react/app/components/GearSelect.tsx | 14 +-- apps/web-react/app/components/Image.tsx | 8 +- .../app/components/MapPoolSelector.tsx | 6 +- .../app/components/PlayerStatusTimeline.tsx | 3 +- .../app/components/StageBannerBox.tsx | 2 +- apps/web-react/app/components/StageSelect.tsx | 4 +- .../web-react/app/components/WeaponSelect.tsx | 22 ++--- .../app/components/layout/GlobalSearch.tsx | 2 +- .../app/components/layout/WeaponSearch.tsx | 14 +-- .../layout/global-search-persisted.ts | 4 +- .../layout/global-search-search-params.ts | 2 +- .../match-page/MatchActionPickBanTab.tsx | 4 +- .../components/match-page/MatchActionTab.tsx | 4 +- .../app/components/match-page/MatchBanner.tsx | 2 +- .../match-page/MatchBannerBottomRow.tsx | 2 +- .../components/match-page/MatchRosterTab.tsx | 2 +- .../components/match-page/MatchTimeline.tsx | 16 ++-- .../app/components/match-page/WeaponPool.tsx | 2 +- .../components/match-page/WeaponReporter.tsx | 10 +-- .../match-page/ingested-scoreboard.test.ts | 2 +- .../match-page/ingested-scoreboard.ts | 2 +- .../match-page/useMatchWeaponReport.ts | 2 +- .../app/db/seed/core/SplatoonFaker.ts | 20 ++--- apps/web-react/app/db/seed/dev/misc.ts | 2 +- apps/web-react/app/db/seed/dev/tournaments.ts | 6 +- apps/web-react/app/db/seed/dev/users.ts | 4 +- .../app/db/seed/factories/BuildFactory.ts | 2 +- .../seed/factories/SplatoonRotationFactory.ts | 4 +- .../db/seed/factories/TournamentFactory.ts | 2 +- apps/web-react/app/db/tables-json.ts | 55 +++--------- apps/web-react/app/db/tables.ts | 26 +++--- .../app/features/api-public/schema.ts | 2 +- .../bracket-test/routes/bracket-test.tsx | 4 +- .../features/build-analyzer/analyzer-hooks.ts | 8 +- .../analyzer-search-params.test.ts | 2 +- .../build-analyzer/analyzer-search-params.ts | 2 +- .../features/build-analyzer/analyzer-types.ts | 7 +- .../features/build-analyzer/analyzer-urls.ts | 2 +- .../components/PerInkTankGrid.tsx | 2 +- .../core/ability-points.test.ts | 2 +- .../build-analyzer/core/ability-points.ts | 4 +- .../core/abilityChunksCalc.test.ts | 4 +- .../build-analyzer/core/abilityChunksCalc.ts | 4 +- .../build-analyzer/core/serializer.ts | 4 +- .../build-analyzer/core/stats.test.ts | 4 +- .../app/features/build-analyzer/core/stats.ts | 8 +- .../app/features/build-analyzer/core/utils.ts | 4 +- .../build-analyzer/routes/analyzer.tsx | 36 ++++---- .../features/build-stats/build-stats-utils.ts | 4 +- .../loaders/builds.$slug.popular.server.ts | 2 +- .../loaders/builds.$slug.stats.server.ts | 2 +- .../builds/BuildRepository.server.test.ts | 8 +- .../features/builds/BuildRepository.server.ts | 12 +-- .../app/features/builds/builds-constants.ts | 2 +- .../app/features/builds/builds-types.ts | 2 +- .../core/ability-sorting.server.test.ts | 2 +- .../builds/core/ability-sorting.server.ts | 7 +- .../app/features/builds/core/filter.server.ts | 6 +- .../app/features/builds/core/filter.test.ts | 6 +- .../builds/loaders/builds.$slug.server.ts | 2 +- .../features/builds/routes/builds.$slug.tsx | 6 +- .../app/features/builds/routes/builds.tsx | 10 +-- .../calendar/actions/calendar.new.server.ts | 2 +- .../features/calendar/calendar-new-schemas.ts | 2 +- .../app/features/calendar/calendar-schemas.ts | 4 +- .../calendar/calendar-search-params.ts | 4 +- .../app/features/calendar/calendar-types.ts | 2 +- .../BracketProgressionFormFields.tsx | 2 +- .../calendar/components/FiltersBar.tsx | 4 +- .../features/calendar/core/CalendarEvent.ts | 4 +- .../features/calendar/routes/calendar.new.tsx | 2 +- .../comp-analyzer/comp-analyzer-constants.ts | 4 +- .../comp-analyzer-search-params.ts | 2 +- .../comp-analyzer/comp-analyzer-types.ts | 2 +- .../components/DamageComboBar.tsx | 10 +-- .../components/RangeVisualization.tsx | 2 +- .../components/SelectedWeapons.tsx | 2 +- .../components/WeaponCategories.tsx | 8 +- .../comp-analyzer/components/WeaponGrid.tsx | 12 +-- .../comp-analyzer/core/damage-combinations.ts | 2 +- .../core/special-weapon-range.test.ts | 4 +- .../core/special-weapon-range.ts | 4 +- .../comp-analyzer/core/weapon-range.test.ts | 2 +- .../comp-analyzer/core/weapon-range.ts | 4 +- .../routes/comp-analyzer.all-ranges.tsx | 6 +- .../comp-analyzer/routes/comp-analyzer.tsx | 2 +- .../components-showcase/routes/components.tsx | 2 +- .../components/SplatoonRotations.tsx | 4 +- .../img-export/components/BuildGraphic.tsx | 12 +-- .../img-export/components/Graphic.tsx | 2 +- .../components/SeasonSummaryGraphic.tsx | 2 +- .../features/img-export/core/RunComps.test.ts | 2 +- .../app/features/img-export/core/RunComps.ts | 2 +- .../features/img-export/core/SeasonSummary.ts | 6 +- .../LeaderboardRepository.server.test.ts | 2 +- .../LeaderboardRepository.server.ts | 8 +- .../core/leaderboards.server.test.ts | 2 +- .../leaderboards/core/leaderboards.server.ts | 4 +- .../leaderboards/leaderboards-constants.ts | 4 +- .../loaders/leaderboards.server.ts | 10 +-- .../leaderboards/routes/leaderboards.tsx | 6 +- .../app/features/lfg/core/filtering.ts | 10 +-- .../app/features/lfg/lfg-search-params.ts | 2 +- apps/web-react/app/features/lfg/lfg-types.ts | 2 +- .../web-react/app/features/lfg/routes/lfg.tsx | 2 +- .../map-list-generator/core/MapList.test.ts | 4 +- .../map-list-generator/core/MapList.ts | 6 +- .../core/map-pool-serializer/serializer.ts | 6 +- .../core/map-pool-serializer/types.ts | 5 +- .../map-list-generator/core/map-pool.ts | 4 +- .../map-list-generator/routes/maps.tsx | 4 +- .../map-planner/components/Planner.tsx | 28 +++--- .../MatchProfileRepository.server.ts | 2 +- .../app/features/match-profile/banned-maps.ts | 4 +- .../calculator-constants.ts | 2 +- .../calculator-hooks.ts | 2 +- .../calculator-search-params.ts | 16 ++-- .../calculator-urls.ts | 2 +- .../core/objectDamage.test.ts | 20 ++--- .../core/objectDamage.ts | 12 +-- .../core/objectHitPoints.ts | 10 +-- .../routes/object-damage-calculator.tsx | 26 +++--- .../params/components/WeaponParamsTable.tsx | 10 +-- .../params/components/WeaponParamsView.tsx | 2 +- .../params/components/WeaponPatchHistory.tsx | 10 +-- .../app/features/params/core/WeaponParams.ts | 8 +- .../params/loaders/params.$slug.server.ts | 10 +-- .../features/params/params-search-params.ts | 2 +- .../features/params/routes/params.$slug.tsx | 6 +- .../features/params/weapon-params-types.ts | 2 +- .../scanner-ingest/core/Matches.test.ts | 2 +- .../scanner-ingest/core/Scoreboards.test.ts | 12 +-- .../scanner-ingest/core/Scoreboards.ts | 12 +-- .../scanner-ingest/core/VodMatches.ts | 2 +- .../scanner-ingest/core/tests/fixtures.ts | 2 +- .../features/scanner-ingest/tests/harness.ts | 11 +-- .../scanner/components/AbilityGrid.tsx | 2 +- .../features/scanner/components/DeathCard.tsx | 2 +- .../features/scanner/components/MatchCard.tsx | 2 +- .../scanner/components/MinimapCard.tsx | 2 +- .../scanner/components/ScreenshotPage.tsx | 2 +- .../features/scanner/components/events-csv.ts | 2 +- .../app/features/scanner/components/labels.ts | 2 +- .../scanner/components/sendou-upload.ts | 3 +- .../features/scanner/core/ability-harvest.ts | 2 +- .../scanner/core/detectors/death/index.ts | 2 +- .../scanner/core/detectors/map-start/index.ts | 2 +- .../scanner/core/detectors/minimap/index.ts | 2 +- .../scanner/core/detectors/minimap/stage.ts | 2 +- .../core/detectors/objective/strip-weapons.ts | 2 +- .../scoreboard-battle-log-replay/header.ts | 2 +- .../core/detectors/scoreboard-own/index.ts | 2 +- .../core/detectors/scoreboard/header.ts | 2 +- .../core/detectors/scoreboard/index.ts | 2 +- .../scanner/core/detectors/scoreboard/kits.ts | 6 +- .../scanner/core/localized-entries.ts | 2 +- .../app/features/scanner/core/localized.ts | 2 +- .../features/scanner/core/match-builder.ts | 2 +- .../app/features/scanner/core/resources.ts | 4 +- .../features/scanner/core/scanner-match.ts | 2 +- .../scanner/core/slot-row-assignment.ts | 2 +- .../app/features/scanner/node/fixtures.ts | 2 +- .../app/features/scanner/scanner-schemas.ts | 11 +-- .../app/features/scanner/scanner-types.ts | 6 +- .../scanner/tests/ability-harvest.test.ts | 2 +- .../scanner/tests/logic/dedupe-events.test.ts | 2 +- .../scanner/tests/logic/match-builder.test.ts | 2 +- .../scanner/tests/sendou-upload.test.ts | 2 +- .../scanner/tests/strip-weapons.test.ts | 2 +- .../scrims/ScrimMapListRepository.server.ts | 2 +- .../scrims/ScrimMapRepository.server.ts | 2 +- .../features/scrims/components/ScrimCard.tsx | 2 +- .../scrims/components/ScrimMatchStatsTab.tsx | 2 +- .../scrims/core/ScrimMapByMap.test.ts | 4 +- .../app/features/scrims/core/ScrimMapByMap.ts | 4 +- .../app/features/scrims/scrims-schemas.ts | 2 +- .../PlayerStatRepository.server.ts | 2 +- .../ReportedWeaponRepository.server.ts | 10 +-- .../components/SendouQMatchActionTab.tsx | 2 +- .../sendouq-match/core/match.server.test.ts | 2 +- .../sendouq-match/core/match.server.ts | 4 +- .../core/reported-weapons.server.test.ts | 2 +- .../core/reported-weapons.server.ts | 2 +- .../sendouq-match/core/summarizer.server.ts | 2 +- .../features/sendouq/components/GroupCard.tsx | 2 +- .../sendouq/core/SendouQ.server.test.ts | 2 +- .../features/sendouq/core/SendouQ.server.ts | 4 +- .../sendouq/core/default-maps.server.test.ts | 2 +- .../sendouq/core/default-maps.server.ts | 2 +- .../app/features/sendouq/q-search-params.ts | 2 +- apps/web-react/app/features/sendouq/q-urls.ts | 2 +- .../web-react/app/features/sendouq/q-utils.ts | 2 +- .../features/sendouq/routes/q.looking.test.ts | 2 +- .../components/MapModePreferencesField.tsx | 4 +- .../settings/components/ModeMapPoolPicker.tsx | 4 +- .../splatoon-rotations.server.ts | 4 +- .../components/TierListItemImage.tsx | 2 +- .../tier-list-maker/hooks/useTierList.ts | 10 +-- .../routes/tier-list-maker.tsx | 2 +- .../tier-list-maker-search-params.ts | 2 +- .../XRankPlacementRepository.server.test.ts | 2 +- .../XRankPlacementRepository.server.ts | 4 +- .../features/top-search/routes/xsearch.tsx | 2 +- .../top-search/top-search-search-params.ts | 2 +- .../features/top-search/top-search-urls.ts | 2 +- .../tournament-admin-schemas.ts | 2 +- .../BracketRepository.server.ts | 14 +-- .../actions/to.$id.brackets.server.ts | 2 +- .../Bracket/Bracket.browser.test.tsx | 2 +- .../components/Bracket/Match.tsx | 2 +- .../components/Bracket/PlacementsTable.tsx | 2 +- .../components/Bracket/RoundRobin.tsx | 2 +- .../components/Bracket/Swiss.tsx | 4 +- .../components/BracketMapListDialog.tsx | 8 +- .../tournament-bracket/core/Bracket.test.ts | 6 +- .../core/Bracket/Bracket.ts | 7 +- .../core/Bracket/DoubleEliminationBracket.ts | 5 +- .../core/Bracket/RoundRobinBracket.ts | 2 +- .../core/Bracket/SingleEliminationBracket.ts | 6 +- .../core/Bracket/SwissBracket.ts | 6 +- .../tournament-bracket/core/Bracket/utils.ts | 2 +- .../tournament-bracket/core/PickBan.test.ts | 2 +- .../tournament-bracket/core/PickBan.ts | 19 ++-- .../core/PreparedMaps.test.ts | 4 +- .../tournament-bracket/core/PreparedMaps.ts | 4 +- .../tournament-bracket/core/Seeding.ts | 2 +- .../tournament-bracket/core/Swiss.test.ts | 6 +- .../core/Tournament.server.test.ts | 2 +- .../core/Tournament.test.ts | 6 +- .../tournament-bracket/core/Tournament.ts | 6 +- .../core/executeBracketOperation.server.ts | 2 +- .../tournament-bracket/core/rounds.ts | 2 +- .../core/summarizer.server.ts | 2 +- .../core/tests/test-utils.ts | 2 +- .../tournament-bracket/core/toMapList.ts | 4 +- .../tournament-bracket-constants.ts | 33 ++----- .../components/LFGGroupCard.tsx | 2 +- .../loaders/to.$id.looking.server.ts | 2 +- .../TournamentMatchRepository.server.ts | 4 +- .../actions/to.$id.matches.$mid.server.ts | 2 +- .../TournamentMatchActionPickBanTab.tsx | 4 +- .../components/TournamentMatchActionTab.tsx | 2 +- .../components/TournamentMatchAdminTab.tsx | 2 +- .../components/TournamentMatchBanner.tsx | 2 +- .../core/executeRoll.server.ts | 2 +- .../tournament-match/core/mapList.server.ts | 2 +- .../core/reportScore.server.ts | 2 +- .../loaders/to.$id.matches.$mid.server.ts | 2 +- .../tournament-match-utils.ts | 2 +- .../tournament/TournamentRepository.server.ts | 2 +- .../TournamentTeamRepository.server.ts | 2 +- .../components/CounterPickMapPoolPicker.tsx | 2 +- .../tournament/core/Standings.test.ts | 6 +- .../features/tournament/core/sets.server.ts | 2 +- .../loaders/to.$id.teams.$tid.comps.server.ts | 2 +- .../tournament/routes/to.$id.rules.tsx | 2 +- .../tournament/tournament-constants.ts | 20 ++--- .../tournament/tournament-utils.server.ts | 2 +- .../features/tournament/tournament-utils.ts | 4 +- .../user-card/UserCardRepository.server.ts | 2 +- .../user-card/components/UserCard.tsx | 2 +- .../app/features/user-card/user-card-types.ts | 2 +- .../u.$identifier.builds.new.server.ts | 2 +- .../components/GameBadgeSelectField.tsx | 8 +- .../components/NewBuildForm.browser.test.tsx | 2 +- .../user-page/components/NewBuildForm.tsx | 10 +-- .../features/user-page/components/Widget.tsx | 12 +-- .../core/build-sorting.server.test.ts | 2 +- .../user-page/core/build-sorting.server.ts | 6 +- .../core/widgets/portfolio-loaders.server.ts | 2 +- .../core/widgets/widget-form-schemas.ts | 2 +- .../u.$identifier.builds.new.server.ts | 2 +- .../user-page/routes/u.$identifier.builds.tsx | 4 +- .../routes/u.$identifier.edit.test.ts | 2 +- .../user-page/routes/u.$identifier.index.tsx | 2 +- .../routes/u.$identifier.seasons.stats.tsx | 6 +- .../features/user-page/user-page-schemas.ts | 10 +-- .../user-page/user-page-search-params.ts | 4 +- .../app/features/user-page/user-page-urls.ts | 2 +- .../app/features/vods/VodRepository.server.ts | 12 +-- .../features/vods/actions/vods.new.server.ts | 2 +- .../app/features/vods/routes/vods.$id.tsx | 2 +- .../vods/routes/vods.new.browser.test.tsx | 10 +-- .../app/features/vods/routes/vods.new.tsx | 2 +- .../app/features/vods/routes/vods.tsx | 6 +- .../app/features/vods/vods-schemas.ts | 2 +- .../app/features/vods/vods-search-params.ts | 4 +- .../web-react/app/features/vods/vods-types.ts | 2 +- .../app/features/vods/vods-utils.test.ts | 4 +- apps/web-react/app/form/FormField.tsx | 2 +- apps/web-react/app/form/fields.ts | 2 +- .../app/form/fields/StageSelectFormField.tsx | 2 +- .../app/form/fields/WeaponPoolFormField.tsx | 4 +- .../app/form/fields/WeaponSelectFormField.tsx | 2 +- apps/web-react/app/hooks/swr.ts | 2 +- .../app/hooks/useRecentlyReportedWeapons.ts | 4 +- .../balanced-map-list.ts | 4 +- .../generation.test.ts | 4 +- .../starter-map.ts | 6 +- .../tournament-map-list-generator/types.ts | 2 +- apps/web-react/app/utils/strings.ts | 2 +- apps/web-react/app/utils/unslugify.server.ts | 2 +- apps/web-react/app/utils/urls.ts | 24 ++--- apps/web-react/app/utils/zod.ts | 10 +-- apps/web-react/e2e/builds.spec.ts | 2 +- .../e2e/helpers/counterpick-map-pool.ts | 4 +- apps/web-react/e2e/helpers/tournament.ts | 2 +- .../e2e/pages/analyzer/analyzer-page.ts | 2 +- .../e2e/pages/builds/build-form-page.ts | 2 +- .../web-react/e2e/pages/builds/builds-page.ts | 2 +- .../e2e/pages/builds/weapon-builds-page.ts | 2 +- .../pages/comp-analyzer/comp-analyzer-page.ts | 2 +- .../web-react/e2e/pages/sendouq/group-card.ts | 2 +- .../e2e/pages/sendouq/sendouq-match-page.ts | 2 +- .../settings/map-mode-preferences-field.ts | 2 +- .../e2e/pages/top-search/top-search-page.ts | 2 +- .../tournament-admin-registration-page.ts | 2 +- .../tournament/tournament-register-page.ts | 2 +- .../pages/tournament/tournament-team-page.ts | 2 +- apps/web-react/e2e/pages/vods/vod-page.ts | 2 +- apps/web-react/e2e/scrims.spec.ts | 2 +- apps/web-react/e2e/settings.spec.ts | 2 +- apps/web-react/e2e/vods.spec.ts | 2 +- apps/web-react/package.json | 3 +- .../scripts/benchmark-db/fixtures.ts | 10 +-- .../web-react/scripts/create-analyzer-json.ts | 20 ++--- apps/web-react/scripts/create-gear-json.ts | 2 +- apps/web-react/scripts/create-misc-json.ts | 4 +- .../scripts/create-object-dmg-json.ts | 6 +- apps/web-react/scripts/placements/index.ts | 4 +- .../scanner/build-localized-entries.ts | 6 +- .../web-react/scripts/scanner/status-audit.ts | 18 ++-- apps/web-react/scripts/sync-weapon-params.ts | 2 +- apps/web-react/vite.config.ts | 1 - apps/web-react/vitest.unit.config.ts | 2 +- package.json | 2 +- packages/in-game-lists/package.json | 13 +++ .../in-game-lists/src}/abilities.ts | 0 packages/in-game-lists/src/assert.ts | 5 ++ .../in-game-lists/src}/brand-ids.ts | 0 .../in-game-lists/src}/game-badge-ids.ts | 0 .../in-game-lists/src}/games.ts | 0 .../in-game-lists/src}/gear-ids.ts | 0 .../in-game-lists/src}/modes.ts | 0 .../in-game-lists/src}/stage-ids.ts | 0 .../in-game-lists/src}/types.ts | 5 ++ .../in-game-lists/src}/utils.test.ts | 0 .../in-game-lists/src}/utils.ts | 5 +- .../in-game-lists/src}/weapon-alt-names.ts | 0 .../in-game-lists/src}/weapon-ids.test.ts | 0 .../in-game-lists/src}/weapon-ids.ts | 2 +- packages/in-game-lists/tsconfig.json | 23 +++++ packages/tournament-engine/package.json | 20 +++++ packages/tournament-engine/src/constants.ts | 10 +++ .../tournament-engine/src}/create/builder.ts | 0 .../src}/create/double-elimination.test.ts | 0 .../src}/create/double-elimination.ts | 0 .../src}/create/helpers.test.ts | 0 .../tournament-engine/src}/create/helpers.ts | 0 .../tournament-engine/src}/create/index.ts | 2 +- .../src}/create/round-robin.test.ts | 0 .../src}/create/round-robin.ts | 0 .../tournament-engine/src}/create/seeding.ts | 2 +- .../tournament-engine/src}/create/settings.ts | 17 ++-- .../src}/create/single-elimination.test.ts | 0 .../src}/create/single-elimination.ts | 0 .../tournament-engine/src}/create/swiss.ts | 10 +-- .../src}/edmonds-blossom.d.ts | 0 .../tournament-engine/src}/general.test.ts | 0 .../tournament-engine/src}/index.ts | 1 + .../propagation/double-elimination.test.ts | 0 .../src}/propagation/dropped-teams.ts | 0 .../src}/propagation/helpers.ts | 0 .../src}/propagation/report-result.ts | 2 +- .../src}/propagation/reset-result.ts | 0 .../src}/propagation/round-robin.test.ts | 0 .../src}/propagation/set.test.ts | 3 +- .../tournament-engine/src}/propagation/set.ts | 2 +- .../propagation/single-elimination.test.ts | 0 .../src}/propagation/store.ts | 0 .../src}/propagation/traversal.ts | 0 .../src}/propagation/update.test.ts | 0 .../tournament-engine/src}/status.test.ts | 0 .../tournament-engine/src}/status.ts | 2 +- .../tournament-engine/src}/swiss/pairing.ts | 5 +- .../src}/swiss/team-status.ts | 0 .../tournament-engine/src}/types.ts | 85 ++++++++++++++++-- .../tournament-engine/src/utils/arrays.ts | 4 + .../tournament-engine/src/utils/invariant.ts | 12 +++ .../tournament-engine/src/utils/result.ts | 15 ++++ packages/tournament-engine/src/utils/types.ts | 5 ++ packages/tournament-engine/tsconfig.json | 23 +++++ pnpm-lock.yaml | 43 ++++++++- tooling/codemods/package.json | 14 +++ tooling/codemods/src/mono-split.ts | 90 +++++++++++++++++++ 399 files changed, 1160 insertions(+), 877 deletions(-) create mode 100644 packages/in-game-lists/package.json rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/abilities.ts (100%) create mode 100644 packages/in-game-lists/src/assert.ts rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/brand-ids.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/game-badge-ids.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/games.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/gear-ids.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/modes.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/stage-ids.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/types.ts (92%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/utils.test.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/utils.ts (83%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/weapon-alt-names.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/weapon-ids.test.ts (100%) rename {apps/web-react/app/modules/in-game-lists => packages/in-game-lists/src}/weapon-ids.ts (99%) create mode 100644 packages/in-game-lists/tsconfig.json create mode 100644 packages/tournament-engine/package.json create mode 100644 packages/tournament-engine/src/constants.ts rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/builder.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/double-elimination.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/double-elimination.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/helpers.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/helpers.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/index.ts (98%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/round-robin.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/round-robin.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/seeding.ts (98%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/settings.ts (80%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/single-elimination.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/single-elimination.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/create/swiss.ts (90%) rename {apps/web-react/types => packages/tournament-engine/src}/edmonds-blossom.d.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/general.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/index.ts (94%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/double-elimination.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/dropped-teams.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/helpers.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/report-result.ts (94%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/reset-result.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/round-robin.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/set.test.ts (96%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/set.ts (98%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/single-elimination.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/store.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/traversal.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/propagation/update.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/status.test.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/status.ts (99%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/swiss/pairing.ts (98%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/swiss/team-status.ts (100%) rename {apps/web-react/app/features/tournament-bracket/core/engine => packages/tournament-engine/src}/types.ts (80%) create mode 100644 packages/tournament-engine/src/utils/arrays.ts create mode 100644 packages/tournament-engine/src/utils/invariant.ts create mode 100644 packages/tournament-engine/src/utils/result.ts create mode 100644 packages/tournament-engine/src/utils/types.ts create mode 100644 packages/tournament-engine/tsconfig.json create mode 100644 tooling/codemods/package.json create mode 100644 tooling/codemods/src/mono-split.ts diff --git a/apps/web-react/app/components/AbilitiesSelector.tsx b/apps/web-react/app/components/AbilitiesSelector.tsx index 041366d11..9f102d635 100644 --- a/apps/web-react/app/components/AbilitiesSelector.tsx +++ b/apps/web-react/app/components/AbilitiesSelector.tsx @@ -1,7 +1,7 @@ +import { abilities } from "@sendou/in-game-lists/abilities"; +import type { BuildAbilitiesTupleWithUnknown } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import * as React from "react"; -import { abilities } from "~/modules/in-game-lists/abilities"; -import type { BuildAbilitiesTupleWithUnknown } from "~/modules/in-game-lists/types"; import invariant from "~/utils/invariant"; import { abilityImageUrl } from "~/utils/urls"; import styles from "./AbilitiesSelector.module.css"; diff --git a/apps/web-react/app/components/Ability.tsx b/apps/web-react/app/components/Ability.tsx index 7f997487f..eb2664027 100644 --- a/apps/web-react/app/components/Ability.tsx +++ b/apps/web-react/app/components/Ability.tsx @@ -1,7 +1,7 @@ +import type { AbilityWithUnknown } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import React from "react"; import { useTranslation } from "react-i18next"; -import type { AbilityWithUnknown } from "~/modules/in-game-lists/types"; import { abilityImageUrl } from "~/utils/urls"; import styles from "./Ability.module.css"; import { Image } from "./Image"; diff --git a/apps/web-react/app/components/BuildCard.tsx b/apps/web-react/app/components/BuildCard.tsx index 65f5fa540..f8bfb8986 100644 --- a/apps/web-react/app/components/BuildCard.tsx +++ b/apps/web-react/app/components/BuildCard.tsx @@ -1,3 +1,10 @@ +import type { + Ability as AbilityType, + BuildAbilitiesTuple, + GearType, + ModeShort, +} from "@sendou/in-game-lists/types"; +import { canonicalWeaponSplId } from "@sendou/in-game-lists/weapon-ids"; import clsx from "clsx"; import { HardDriveDownload, @@ -18,13 +25,6 @@ import { type BuildGraphicOwner, } from "~/features/img-export/components/BuildGraphic"; import { ImageExportDialog } from "~/features/img-export/components/ImageExportDialog"; -import type { - Ability as AbilityType, - BuildAbilitiesTuple, - GearType, - ModeShort, -} from "~/modules/in-game-lists/types"; -import { canonicalWeaponSplId } from "~/modules/in-game-lists/weapon-ids"; import type { UserWithPlusTier } from "~/utils/kysely.server"; import { gearTypeToInitial } from "~/utils/strings"; import { diff --git a/apps/web-react/app/components/GameTimeline.tsx b/apps/web-react/app/components/GameTimeline.tsx index 152e11217..cea78cf09 100644 --- a/apps/web-react/app/components/GameTimeline.tsx +++ b/apps/web-react/app/components/GameTimeline.tsx @@ -7,11 +7,12 @@ * special ready. The chart's own tooltip is turned off in favor of the * readout. */ + +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { memo, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { clamp } from "remeda"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { abilityImageUrl } from "~/utils/urls"; import styles from "./GameTimeline.module.css"; import { Image, WeaponImage } from "./Image"; diff --git a/apps/web-react/app/components/GearSelect.tsx b/apps/web-react/app/components/GearSelect.tsx index 472f19d46..1658636de 100644 --- a/apps/web-react/app/components/GearSelect.tsx +++ b/apps/web-react/app/components/GearSelect.tsx @@ -1,3 +1,10 @@ +import { brandIds } from "@sendou/in-game-lists/brand-ids"; +import { + clothesGearBrandGrouped, + headGearBrandGrouped, + shoesGearBrandGrouped, +} from "@sendou/in-game-lists/gear-ids"; +import type { GearType } from "@sendou/in-game-lists/types"; import { useTranslation } from "react-i18next"; import { SendouSelect, @@ -5,13 +12,6 @@ import { SendouSelectItemSection, } from "~/components/elements/Select"; import { Image } from "~/components/Image"; -import { brandIds } from "~/modules/in-game-lists/brand-ids"; -import { - clothesGearBrandGrouped, - headGearBrandGrouped, - shoesGearBrandGrouped, -} from "~/modules/in-game-lists/gear-ids"; -import type { GearType } from "~/modules/in-game-lists/types"; import { brandImageUrl, gearImageUrl } from "~/utils/urls"; import styles from "./WeaponSelect.module.css"; diff --git a/apps/web-react/app/components/Image.tsx b/apps/web-react/app/components/Image.tsx index a24ff642d..434b4d6c2 100644 --- a/apps/web-react/app/components/Image.tsx +++ b/apps/web-react/app/components/Image.tsx @@ -1,13 +1,13 @@ -import clsx from "clsx"; -import { useTranslation } from "react-i18next"; -import type { TierName } from "~/features/mmr/mmr-constants"; import type { MainWeaponId, ModeShortWithSpecial, SpecialWeaponId, StageId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import clsx from "clsx"; +import { useTranslation } from "react-i18next"; +import type { TierName } from "~/features/mmr/mmr-constants"; import { mainWeaponImageUrl, modeImageUrl, diff --git a/apps/web-react/app/components/MapPoolSelector.tsx b/apps/web-react/app/components/MapPoolSelector.tsx index 7b755c0a6..5f2164272 100644 --- a/apps/web-react/app/components/MapPoolSelector.tsx +++ b/apps/web-react/app/components/MapPoolSelector.tsx @@ -1,3 +1,6 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { ArrowLeft, X } from "lucide-react"; import * as React from "react"; @@ -6,9 +9,6 @@ import { Image } from "~/components/Image"; import type { Tables } from "~/db/tables"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { split, startsWith } from "~/utils/strings"; import { assertType } from "~/utils/types"; import { modeImageUrl, stageImageUrl } from "~/utils/urls"; diff --git a/apps/web-react/app/components/PlayerStatusTimeline.tsx b/apps/web-react/app/components/PlayerStatusTimeline.tsx index 2ac487bcf..304a9d29f 100644 --- a/apps/web-react/app/components/PlayerStatusTimeline.tsx +++ b/apps/web-react/app/components/PlayerStatusTimeline.tsx @@ -8,8 +8,9 @@ * observed, so bands never bridge across one (the state there is unknown, * not continued). */ + +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { useTranslation } from "react-i18next"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { abilityImageUrl } from "~/utils/urls"; import { Image, WeaponImage } from "./Image"; import { diff --git a/apps/web-react/app/components/StageBannerBox.tsx b/apps/web-react/app/components/StageBannerBox.tsx index 8c5e33aeb..f000ec265 100644 --- a/apps/web-react/app/components/StageBannerBox.tsx +++ b/apps/web-react/app/components/StageBannerBox.tsx @@ -1,6 +1,6 @@ +import type { StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import type * as React from "react"; -import type { StageId } from "~/modules/in-game-lists/types"; import { stageBannerImageUrl } from "~/utils/urls"; import styles from "./StageBannerBox.module.css"; diff --git a/apps/web-react/app/components/StageSelect.tsx b/apps/web-react/app/components/StageSelect.tsx index 058afc27c..d31dd875a 100644 --- a/apps/web-react/app/components/StageSelect.tsx +++ b/apps/web-react/app/components/StageSelect.tsx @@ -1,9 +1,9 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { StageId } from "@sendou/in-game-lists/types"; import type { Key } from "react-aria-components"; import { useTranslation } from "react-i18next"; import { SendouSelect, SendouSelectItem } from "~/components/elements/Select"; import { StageImage } from "~/components/Image"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { StageId } from "~/modules/in-game-lists/types"; import styles from "./StageSelect.module.css"; interface StageSelectProps { diff --git a/apps/web-react/app/components/WeaponSelect.tsx b/apps/web-react/app/components/WeaponSelect.tsx index db9d6c276..63a559505 100644 --- a/apps/web-react/app/components/WeaponSelect.tsx +++ b/apps/web-react/app/components/WeaponSelect.tsx @@ -1,3 +1,14 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { filterWeapon } from "@sendou/in-game-lists/utils"; +import { + mainWeaponIds, + nonDamagingSpecialWeaponIds, + SPLAT_BOMB_ID, + specialWeaponIds, + subWeaponIds, + TRIZOOKA_ID, + weaponCategories, +} from "@sendou/in-game-lists/weapon-ids"; import type { TFunction } from "i18next"; import * as React from "react"; import type { Key } from "react-aria-components"; @@ -9,17 +20,6 @@ import { } from "~/components/elements/Select"; import { Image, WeaponImage } from "~/components/Image"; import type { AnyWeapon } from "~/features/build-analyzer/analyzer-types"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { filterWeapon } from "~/modules/in-game-lists/utils"; -import { - mainWeaponIds, - nonDamagingSpecialWeaponIds, - SPLAT_BOMB_ID, - specialWeaponIds, - subWeaponIds, - TRIZOOKA_ID, - weaponCategories, -} from "~/modules/in-game-lists/weapon-ids"; import { specialWeaponImageUrl, subWeaponImageUrl, diff --git a/apps/web-react/app/components/layout/GlobalSearch.tsx b/apps/web-react/app/components/layout/GlobalSearch.tsx index 56db215ce..9cf52dceb 100644 --- a/apps/web-react/app/components/layout/GlobalSearch.tsx +++ b/apps/web-react/app/components/layout/GlobalSearch.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import type { TFunction } from "i18next"; import { Search } from "lucide-react"; @@ -24,7 +25,6 @@ import { searchSearchParams } from "~/features/search/search-search-params"; import { tournamentOrganizationPage } from "~/features/tournament-organization/tournament-organization-urls"; import { useDebounce } from "~/hooks/useDebounce"; import { useHydrated } from "~/hooks/useHydrated"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import * as PersistedState from "~/modules/persisted-state/persisted-state"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { diff --git a/apps/web-react/app/components/layout/WeaponSearch.tsx b/apps/web-react/app/components/layout/WeaponSearch.tsx index dd677a5ed..e7b3995b6 100644 --- a/apps/web-react/app/components/layout/WeaponSearch.tsx +++ b/apps/web-react/app/components/layout/WeaponSearch.tsx @@ -1,3 +1,10 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { filterWeapon } from "@sendou/in-game-lists/utils"; +import { + canonicalWeaponSplId, + mainWeaponIds, + weaponIdToBaseWeaponId, +} from "@sendou/in-game-lists/weapon-ids"; import { clsx } from "clsx"; import type { Namespace, TFunction } from "i18next"; import { @@ -15,13 +22,6 @@ import type * as React from "react"; import { ListBox, ListBoxItem } from "react-aria-components"; import { useTranslation } from "react-i18next"; import { Image } from "~/components/Image"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { filterWeapon } from "~/modules/in-game-lists/utils"; -import { - canonicalWeaponSplId, - mainWeaponIds, - weaponIdToBaseWeaponId, -} from "~/modules/in-game-lists/weapon-ids"; import { ANALYZER_URL, LFG_PAGE, diff --git a/apps/web-react/app/components/layout/global-search-persisted.ts b/apps/web-react/app/components/layout/global-search-persisted.ts index f5c644dd4..fd188df0b 100644 --- a/apps/web-react/app/components/layout/global-search-persisted.ts +++ b/apps/web-react/app/components/layout/global-search-persisted.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import { usePersistedState } from "~/modules/persisted-state/hooks"; import * as PersistedState from "~/modules/persisted-state/persisted-state"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/components/layout/global-search-search-params.ts b/apps/web-react/app/components/layout/global-search-search-params.ts index 16b04f6a8..dd167775d 100644 --- a/apps/web-react/app/components/layout/global-search-search-params.ts +++ b/apps/web-react/app/components/layout/global-search-search-params.ts @@ -1,5 +1,5 @@ +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/components/match-page/MatchActionPickBanTab.tsx b/apps/web-react/app/components/match-page/MatchActionPickBanTab.tsx index 3f8c3a240..ea46ceb44 100644 --- a/apps/web-react/app/components/match-page/MatchActionPickBanTab.tsx +++ b/apps/web-react/app/components/match-page/MatchActionPickBanTab.tsx @@ -1,11 +1,11 @@ +import { shortStageName } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Check, X } from "lucide-react"; import type * as React from "react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { SendouButton } from "~/components/elements/Button"; -import { shortStageName } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { stageImageUrl } from "~/utils/urls"; import { Divider } from "../Divider"; import { SendouTabPanel } from "../elements/Tabs"; diff --git a/apps/web-react/app/components/match-page/MatchActionTab.tsx b/apps/web-react/app/components/match-page/MatchActionTab.tsx index fe6702496..a0e5cdeb7 100644 --- a/apps/web-react/app/components/match-page/MatchActionTab.tsx +++ b/apps/web-react/app/components/match-page/MatchActionTab.tsx @@ -1,3 +1,5 @@ +import { shortStageName } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Check } from "lucide-react"; import type * as React from "react"; @@ -5,8 +7,6 @@ import { useState } from "react"; import { Radio, RadioGroup } from "react-aria-components"; import { useTranslation } from "react-i18next"; import { useWebHaptics } from "web-haptics/react"; -import { shortStageName } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import type { CommonUser } from "~/utils/kysely.server"; import { Avatar } from "../Avatar"; import { SendouButton } from "../elements/Button"; diff --git a/apps/web-react/app/components/match-page/MatchBanner.tsx b/apps/web-react/app/components/match-page/MatchBanner.tsx index c986270de..9781e6ead 100644 --- a/apps/web-react/app/components/match-page/MatchBanner.tsx +++ b/apps/web-react/app/components/match-page/MatchBanner.tsx @@ -1,10 +1,10 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Check, X } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Avatar } from "~/components/Avatar"; import { SendouButton } from "~/components/elements/Button"; import { SendouPopover } from "~/components/elements/Popover"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { specialWeaponImageUrl, stageBannerImageUrl } from "~/utils/urls"; import { ModeImage } from "../Image"; import styles from "./MatchBanner.module.css"; diff --git a/apps/web-react/app/components/match-page/MatchBannerBottomRow.tsx b/apps/web-react/app/components/match-page/MatchBannerBottomRow.tsx index 59ec6fde8..1902fa21b 100644 --- a/apps/web-react/app/components/match-page/MatchBannerBottomRow.tsx +++ b/apps/web-react/app/components/match-page/MatchBannerBottomRow.tsx @@ -1,7 +1,7 @@ +import type { ModeShort } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { MousePointerClick } from "lucide-react"; import { useTranslation } from "react-i18next"; -import type { ModeShort } from "~/modules/in-game-lists/types"; import type { CommonUser } from "~/utils/kysely.server"; import { Avatar } from "../Avatar"; import { ModeImage } from "../Image"; diff --git a/apps/web-react/app/components/match-page/MatchRosterTab.tsx b/apps/web-react/app/components/match-page/MatchRosterTab.tsx index 51ae546a5..f49a9b3ed 100644 --- a/apps/web-react/app/components/match-page/MatchRosterTab.tsx +++ b/apps/web-react/app/components/match-page/MatchRosterTab.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Armchair, Edit } from "lucide-react"; import { useState } from "react"; @@ -13,7 +14,6 @@ import { UserCard, useUserCardData, } from "~/features/user-card/components/UserCard"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import invariant from "~/utils/invariant"; import type { CommonUser } from "~/utils/kysely.server"; import { tierImageUrl } from "~/utils/urls"; diff --git a/apps/web-react/app/components/match-page/MatchTimeline.tsx b/apps/web-react/app/components/match-page/MatchTimeline.tsx index d8e625a68..4c614539c 100644 --- a/apps/web-react/app/components/match-page/MatchTimeline.tsx +++ b/apps/web-react/app/components/match-page/MatchTimeline.tsx @@ -1,3 +1,11 @@ +import { abilities } from "@sendou/in-game-lists/abilities"; +import { shortStageName } from "@sendou/in-game-lists/stage-ids"; +import type { + AbilityWithUnknown, + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { ArrowRight, @@ -15,14 +23,6 @@ import type { GroupSkillDifference, UserSkillDifference, } from "~/db/tables-json"; -import { abilities } from "~/modules/in-game-lists/abilities"; -import { shortStageName } from "~/modules/in-game-lists/stage-ids"; -import type { - AbilityWithUnknown, - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import type { CommonUser } from "~/utils/kysely.server"; import { roundToNDecimalPlaces } from "~/utils/number"; import { abilityImageUrl, navIconUrl } from "~/utils/urls"; diff --git a/apps/web-react/app/components/match-page/WeaponPool.tsx b/apps/web-react/app/components/match-page/WeaponPool.tsx index 12514a5fd..92a699b78 100644 --- a/apps/web-react/app/components/match-page/WeaponPool.tsx +++ b/apps/web-react/app/components/match-page/WeaponPool.tsx @@ -1,7 +1,7 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Button } from "react-aria-components"; import { useTranslation } from "react-i18next"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { abilityImageUrl } from "~/utils/urls"; import { SendouPopover } from "../elements/Popover"; import { Image, WeaponImage } from "../Image"; diff --git a/apps/web-react/app/components/match-page/WeaponReporter.tsx b/apps/web-react/app/components/match-page/WeaponReporter.tsx index 320db6f13..3d40ed0d6 100644 --- a/apps/web-react/app/components/match-page/WeaponReporter.tsx +++ b/apps/web-react/app/components/match-page/WeaponReporter.tsx @@ -1,14 +1,14 @@ +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import { Crosshair } from "lucide-react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useUser } from "~/features/auth/core/user"; import { weaponReportDefaultOpenSchema } from "~/features/settings/settings-schemas"; import { useActionSubmit } from "~/hooks/useActionSubmit"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { abilityImageUrl, SETTINGS_PAGE } from "~/utils/urls"; import { SendouButton } from "../elements/Button"; import { Image, StageImage, WeaponImage } from "../Image"; diff --git a/apps/web-react/app/components/match-page/ingested-scoreboard.test.ts b/apps/web-react/app/components/match-page/ingested-scoreboard.test.ts index 58518e158..2969946c9 100644 --- a/apps/web-react/app/components/match-page/ingested-scoreboard.test.ts +++ b/apps/web-react/app/components/match-page/ingested-scoreboard.test.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; import type { IngestedScoreboardPlayer } from "~/features/scanner-ingest/core/Scoreboards"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { resolveTimelineWeapons } from "./ingested-scoreboard"; const TEAM_ID = 1; diff --git a/apps/web-react/app/components/match-page/ingested-scoreboard.ts b/apps/web-react/app/components/match-page/ingested-scoreboard.ts index a58ca3f13..248ead4f2 100644 --- a/apps/web-react/app/components/match-page/ingested-scoreboard.ts +++ b/apps/web-react/app/components/match-page/ingested-scoreboard.ts @@ -1,8 +1,8 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { IngestedScoreboardData, IngestedScoreboardPlayer, } from "~/features/scanner-ingest/core/Scoreboards"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { ObjectiveTimelineEvent } from "../ObjectiveTimeline"; import type { PlayerStatusTimelineSample } from "../PlayerStatusTimeline"; import type { TimelineMap } from "./MatchTimeline"; diff --git a/apps/web-react/app/components/match-page/useMatchWeaponReport.ts b/apps/web-react/app/components/match-page/useMatchWeaponReport.ts index a367438bd..6eb512037 100644 --- a/apps/web-react/app/components/match-page/useMatchWeaponReport.ts +++ b/apps/web-react/app/components/match-page/useMatchWeaponReport.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { useActionSubmit } from "~/hooks/useActionSubmit"; import { useRecentlyReportedWeapons } from "~/hooks/useRecentlyReportedWeapons"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { weaponReportActionSchema } from "./match-page-schemas"; import type { WeaponReporterMap, WeaponReporterProps } from "./WeaponReporter"; diff --git a/apps/web-react/app/db/seed/core/SplatoonFaker.ts b/apps/web-react/app/db/seed/core/SplatoonFaker.ts index 5e947c4a6..64884b72e 100644 --- a/apps/web-react/app/db/seed/core/SplatoonFaker.ts +++ b/apps/web-react/app/db/seed/core/SplatoonFaker.ts @@ -1,25 +1,25 @@ -import { - IN_GAME_NAME, - sanitizeInGameName, -} from "~/features/user-page/in-game-name"; -import { abilities } from "~/modules/in-game-lists/abilities"; +import { abilities } from "@sendou/in-game-lists/abilities"; import { clothesGearIds, headGearIds, shoesGearIds, -} from "~/modules/in-game-lists/gear-ids"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; +} from "@sendou/in-game-lists/gear-ids"; +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import type { Ability, BuildAbilitiesTuple, MainWeaponId, ModeWithStage, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { canonicalWeaponSplId, mainWeaponIds, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { + IN_GAME_NAME, + sanitizeInGameName, +} from "~/features/user-page/in-game-name"; import invariant from "~/utils/invariant"; import { faker } from "./faker"; diff --git a/apps/web-react/app/db/seed/dev/misc.ts b/apps/web-react/app/db/seed/dev/misc.ts index c14729b83..1e2a71754 100644 --- a/apps/web-react/app/db/seed/dev/misc.ts +++ b/apps/web-react/app/db/seed/dev/misc.ts @@ -1,8 +1,8 @@ +import type { MainWeaponId, ModeShort } from "@sendou/in-game-lists/types"; import { sub } from "date-fns"; import { Config } from "~/config"; import type { Tables } from "~/db/tables"; import type { Notification } from "~/features/notifications/notifications-types"; -import type { MainWeaponId, ModeShort } from "~/modules/in-game-lists/types"; import { getArtFilename, SEED_ART_URLS, diff --git a/apps/web-react/app/db/seed/dev/tournaments.ts b/apps/web-react/app/db/seed/dev/tournaments.ts index 12fc74073..e87f245a7 100644 --- a/apps/web-react/app/db/seed/dev/tournaments.ts +++ b/apps/web-react/app/db/seed/dev/tournaments.ts @@ -1,11 +1,11 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { sub } from "date-fns"; import type { TournamentSettings } from "~/db/tables-json"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; import type { TournamentTierNumber } from "~/features/tournament/core/tiering"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import { faker, unique } from "../core/faker"; import * as showcaseNames from "../core/showcaseNames"; diff --git a/apps/web-react/app/db/seed/dev/users.ts b/apps/web-react/app/db/seed/dev/users.ts index be9a04955..a9c3ad07b 100644 --- a/apps/web-react/app/db/seed/dev/users.ts +++ b/apps/web-react/app/db/seed/dev/users.ts @@ -1,3 +1,5 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import type { UserMapModePreferences } from "~/db/tables-json"; import { ADMIN_DISCORD_ID } from "~/features/admin/admin-constants"; import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; @@ -5,8 +7,6 @@ import { AMOUNT_OF_MAPS_IN_POOL_PER_MODE } from "~/features/match-profile/match- import { LUTI_DIVS } from "~/features/scrims/scrims-constants"; import { PRESET_COLORS } from "~/features/tier-list-maker/tier-list-maker-constants"; import type { UnifiedLanguageCode } from "~/modules/i18n/config"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; import { ADMIN_TEST_AVATAR, NZAP_TEST_AVATAR, diff --git a/apps/web-react/app/db/seed/factories/BuildFactory.ts b/apps/web-react/app/db/seed/factories/BuildFactory.ts index 8ca68aa6c..f4cab1f1a 100644 --- a/apps/web-react/app/db/seed/factories/BuildFactory.ts +++ b/apps/web-react/app/db/seed/factories/BuildFactory.ts @@ -1,5 +1,5 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import * as BuildRepository from "~/features/builds/BuildRepository.server"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { defineFactory } from "../core/defineFactory"; import { faker } from "../core/faker"; import * as SplatoonFaker from "../core/SplatoonFaker"; diff --git a/apps/web-react/app/db/seed/factories/SplatoonRotationFactory.ts b/apps/web-react/app/db/seed/factories/SplatoonRotationFactory.ts index 4fe8e3cf4..1e84dfd0b 100644 --- a/apps/web-react/app/db/seed/factories/SplatoonRotationFactory.ts +++ b/apps/web-react/app/db/seed/factories/SplatoonRotationFactory.ts @@ -1,7 +1,7 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import type { TablesInsertable } from "~/db/tables"; import * as SplatoonRotationRepository from "~/features/splatoon-rotations/SplatoonRotationRepository.server"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; import { faker } from "../core/faker"; type Rotation = Omit; diff --git a/apps/web-react/app/db/seed/factories/TournamentFactory.ts b/apps/web-react/app/db/seed/factories/TournamentFactory.ts index f546dddcd..30a4deebf 100644 --- a/apps/web-react/app/db/seed/factories/TournamentFactory.ts +++ b/apps/web-react/app/db/seed/factories/TournamentFactory.ts @@ -1,3 +1,4 @@ +import * as Engine from "@sendou/tournament-engine"; import * as R from "remeda"; import type { TournamentSettings } from "~/db/tables-json"; import * as CalendarRepository from "~/features/calendar/CalendarRepository.server"; @@ -6,7 +7,6 @@ import type { TournamentTierNumber } from "~/features/tournament/core/tiering"; import * as TournamentRepository from "~/features/tournament/TournamentRepository.server"; import * as TournamentTeamRepository from "~/features/tournament/TournamentTeamRepository.server"; import * as BracketRepository from "~/features/tournament-bracket/BracketRepository.server"; -import * as Engine from "~/features/tournament-bracket/core/engine"; import { finalizeTournament } from "~/features/tournament-bracket/core/finalizeTournament.server"; import { clearTournamentDataCache, diff --git a/apps/web-react/app/db/tables-json.ts b/apps/web-react/app/db/tables-json.ts index f5592713d..722aa88da 100644 --- a/apps/web-react/app/db/tables-json.ts +++ b/apps/web-react/app/db/tables-json.ts @@ -5,26 +5,22 @@ * and are imported by `tables.ts` directly. */ +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; +import type { TournamentRoundMaps } from "@sendou/tournament-engine/types"; import type { DBBoolean } from "~/db/tables"; import type { CalendarFilters } from "~/features/calendar/calendar-types"; import type { TieredSkill } from "~/features/mmr/tiered.server"; import type { ScrimFilters } from "~/features/scrims/scrims-types"; import type { CustomThemeVar } from "~/features/theme/theme-constants"; -import type * as PickBan from "~/features/tournament-bracket/core/PickBan"; import type * as Progression from "~/features/tournament-bracket/core/Progression"; -import type { - ActionType, - WhoSide, -} from "~/features/tournament-bracket/tournament-bracket-constants"; import type { ObjectPronoun, SubjectPronoun, } from "~/features/user-page/user-page-constants"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; export type CustomTheme = Omit, "--_chat-h"> & { "--_chat-h": number | null; @@ -184,39 +180,12 @@ export interface PreparedMaps { eliminationTeamCount?: number; } -export interface TournamentRoundMaps { - list?: Array<{ mode: ModeShort; stageId: StageId }> | null; - count: number; - type: "BEST_OF" | "PLAY_ALL"; - pickBan?: PickBan.Type | null; - customFlow?: CustomPickBanFlow | null; -} - -export interface CustomPickBanStep { - action: ActionType; - side?: WhoSide; -} - -export interface CustomPickBanFlow { - preSet: CustomPickBanStep[]; - postGame: CustomPickBanStep[]; -} - -// when updating this also update `settingsFromFormValues` in calendar-progression-form.ts -export interface TournamentStageSettings { - // SE - thirdPlaceMatch?: boolean; - // RR - teamsPerGroup?: number; - /** (RR only) When true, teams are split into A and B divisions and matches only pair A-vs-B. Only valid on starting brackets. */ - hasAbDivisions?: boolean; - // SWISS - groupCount?: number; - // SWISS - roundCount?: number; - /** (Swiss only) Number of wins required for a team to advance early. When set, teams advance at this win count and are eliminated at (roundCount - advanceThreshold + 1) losses. */ - advanceThreshold?: number; -} +export type { + CustomPickBanFlow, + CustomPickBanStep, + TournamentRoundMaps, + TournamentStageSettings, +} from "@sendou/tournament-engine/types"; export interface TournamentAuditLogMetadata { bracketIdx?: number; diff --git a/apps/web-react/app/db/tables.ts b/apps/web-react/app/db/tables.ts index 899d4ad14..b022843ac 100644 --- a/apps/web-react/app/db/tables.ts +++ b/apps/web-react/app/db/tables.ts @@ -4,6 +4,19 @@ * `tables-json.ts`; domain constants live in their feature's constants file. */ +import type { + Ability, + BuildAbilitiesTuple, + MainWeaponId, + ModeShort, + RankedModeShort, + StageId, +} from "@sendou/in-game-lists/types"; +import type { + ParticipantResult, + Side, + StageSettings, +} from "@sendou/tournament-engine/types"; import type { ColumnType, GeneratedAlways, @@ -48,11 +61,6 @@ import type { TournamentMapPickingStyle, TournamentStaffRole, } from "~/features/tournament/tournament-constants"; -import type { - ParticipantResult, - Side, - StageSettings, -} from "~/features/tournament-bracket/core/engine/types"; import type { TournamentOrganizationRole } from "~/features/tournament-organization/tournament-organization-constants"; import type { HideableUserCardStat } from "~/features/user-card/user-card-types"; import type { StoredWidget } from "~/features/user-page/core/widgets/types"; @@ -60,14 +68,6 @@ import type { BuildSort } from "~/features/user-page/user-page-constants"; import type { UserReportCategory } from "~/features/user-report/user-report-constants"; import type { videoMatchTypes } from "~/features/vods/vods-constants"; import type { UnifiedLanguageCode } from "~/modules/i18n/config"; -import type { - Ability, - BuildAbilitiesTuple, - MainWeaponId, - ModeShort, - RankedModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import type { DBTournamentMaplistSource } from "~/modules/tournament-map-list-generator/types"; import type { JSONColumnTypeNullable } from "~/utils/kysely.server"; diff --git a/apps/web-react/app/features/api-public/schema.ts b/apps/web-react/app/features/api-public/schema.ts index 4fa9ca78c..379ce322b 100644 --- a/apps/web-react/app/features/api-public/schema.ts +++ b/apps/web-react/app/features/api-public/schema.ts @@ -1,6 +1,6 @@ +import type { BracketData } from "@sendou/tournament-engine/types"; import type { Pronouns } from "~/db/tables-json"; import type { TierName } from "~/features/mmr/mmr-constants"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; /** GET /api/user/{userId|discordId} */ diff --git a/apps/web-react/app/features/bracket-test/routes/bracket-test.tsx b/apps/web-react/app/features/bracket-test/routes/bracket-test.tsx index 750fbbfec..f081c773c 100644 --- a/apps/web-react/app/features/bracket-test/routes/bracket-test.tsx +++ b/apps/web-react/app/features/bracket-test/routes/bracket-test.tsx @@ -1,3 +1,5 @@ +import * as Engine from "@sendou/tournament-engine"; +import type { BracketData } from "@sendou/tournament-engine/types"; import { useState } from "react"; import { Outlet } from "react-router"; import { SendouButton } from "~/components/elements/Button"; @@ -8,8 +10,6 @@ import { Main } from "~/components/Main"; import type { Tables } from "~/db/tables"; import { TournamentProvider } from "~/features/tournament/tournament-context"; import type { Bracket as BracketType } from "~/features/tournament-bracket/core/Bracket"; -import * as Engine from "~/features/tournament-bracket/core/engine"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import type { Tournament as TournamentClass } from "~/features/tournament-bracket/core/Tournament"; import styles from "../bracket-test.module.css"; diff --git a/apps/web-react/app/features/build-analyzer/analyzer-hooks.ts b/apps/web-react/app/features/build-analyzer/analyzer-hooks.ts index 2626bfb24..9eab07fbb 100644 --- a/apps/web-react/app/features/build-analyzer/analyzer-hooks.ts +++ b/apps/web-react/app/features/build-analyzer/analyzer-hooks.ts @@ -1,12 +1,12 @@ -import { EMPTY_BUILD } from "~/features/builds/builds-constants"; -import { abilities } from "~/modules/in-game-lists/abilities"; +import { abilities } from "@sendou/in-game-lists/abilities"; import type { Ability, AbilityWithUnknown, BuildAbilitiesTupleWithUnknown, MainWeaponId, -} from "~/modules/in-game-lists/types"; -import { isAbility } from "~/modules/in-game-lists/utils"; +} from "@sendou/in-game-lists/types"; +import { isAbility } from "@sendou/in-game-lists/utils"; +import { EMPTY_BUILD } from "~/features/builds/builds-constants"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { analyzerSearchParams } from "./analyzer-search-params"; import type { SpecialEffectType } from "./analyzer-types"; diff --git a/apps/web-react/app/features/build-analyzer/analyzer-search-params.test.ts b/apps/web-react/app/features/build-analyzer/analyzer-search-params.test.ts index ca9e55a1a..3bb40f785 100644 --- a/apps/web-react/app/features/build-analyzer/analyzer-search-params.test.ts +++ b/apps/web-react/app/features/build-analyzer/analyzer-search-params.test.ts @@ -1,6 +1,6 @@ +import type { BuildAbilitiesTupleWithUnknown } from "@sendou/in-game-lists/types"; import { describe, test } from "vitest"; import { EMPTY_BUILD } from "~/features/builds/builds-constants"; -import type { BuildAbilitiesTupleWithUnknown } from "~/modules/in-game-lists/types"; import { assertDecodesToDefault, assertRoundTrips, diff --git a/apps/web-react/app/features/build-analyzer/analyzer-search-params.ts b/apps/web-react/app/features/build-analyzer/analyzer-search-params.ts index ded79e5bd..e0abc5a73 100644 --- a/apps/web-react/app/features/build-analyzer/analyzer-search-params.ts +++ b/apps/web-react/app/features/build-analyzer/analyzer-search-params.ts @@ -1,6 +1,6 @@ +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; import { EMPTY_BUILD } from "~/features/builds/builds-constants"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/build-analyzer/analyzer-types.ts b/apps/web-react/app/features/build-analyzer/analyzer-types.ts index b2d04c3d2..3eeb0fdbc 100644 --- a/apps/web-react/app/features/build-analyzer/analyzer-types.ts +++ b/apps/web-react/app/features/build-analyzer/analyzer-types.ts @@ -4,7 +4,7 @@ import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { DAMAGE_TYPE, TENACITY_PLAYER_DEFICITS, @@ -359,7 +359,4 @@ export interface AnalyzedBuild { export type SpecialEffectType = (typeof SPECIAL_EFFECTS)[number]["type"]; -export type AnyWeapon = - | { type: "MAIN"; id: MainWeaponId } - | { type: "SUB"; id: SubWeaponId } - | { type: "SPECIAL"; id: SpecialWeaponId }; +export type { AnyWeapon } from "@sendou/in-game-lists/types"; diff --git a/apps/web-react/app/features/build-analyzer/analyzer-urls.ts b/apps/web-react/app/features/build-analyzer/analyzer-urls.ts index bdb55a54d..56fe5e53f 100644 --- a/apps/web-react/app/features/build-analyzer/analyzer-urls.ts +++ b/apps/web-react/app/features/build-analyzer/analyzer-urls.ts @@ -2,7 +2,7 @@ import type { Ability, BuildAbilitiesTupleWithUnknown, MainWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { analyzerSearchParams } from "./analyzer-search-params"; export const analyzerPage = (args?: { diff --git a/apps/web-react/app/features/build-analyzer/components/PerInkTankGrid.tsx b/apps/web-react/app/features/build-analyzer/components/PerInkTankGrid.tsx index 4bffce303..c2638c2a2 100644 --- a/apps/web-react/app/features/build-analyzer/components/PerInkTankGrid.tsx +++ b/apps/web-react/app/features/build-analyzer/components/PerInkTankGrid.tsx @@ -1,8 +1,8 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { Ability } from "~/components/Ability"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { SendouButton } from "../../../components/elements/Button"; import { SendouPopover } from "../../../components/elements/Popover"; import { MAX_AP } from "../analyzer-constants"; diff --git a/apps/web-react/app/features/build-analyzer/core/ability-points.test.ts b/apps/web-react/app/features/build-analyzer/core/ability-points.test.ts index db3c6dbb6..255f77b5d 100644 --- a/apps/web-react/app/features/build-analyzer/core/ability-points.test.ts +++ b/apps/web-react/app/features/build-analyzer/core/ability-points.test.ts @@ -1,5 +1,5 @@ +import type { AbilityWithUnknown } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { AbilityWithUnknown } from "~/modules/in-game-lists/types"; import { buildToAbilityPoints } from "./ability-points"; describe("buildToAbilityPoints", () => { diff --git a/apps/web-react/app/features/build-analyzer/core/ability-points.ts b/apps/web-react/app/features/build-analyzer/core/ability-points.ts index dc298336d..023aff94a 100644 --- a/apps/web-react/app/features/build-analyzer/core/ability-points.ts +++ b/apps/web-react/app/features/build-analyzer/core/ability-points.ts @@ -1,9 +1,9 @@ -import { abilities } from "~/modules/in-game-lists/abilities"; +import { abilities } from "@sendou/in-game-lists/abilities"; import type { Ability, AbilityWithUnknown, BuildAbilitiesTupleWithUnknown, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import invariant from "~/utils/invariant"; import { MAIN_SLOT_AP, SUB_SLOT_AP } from "../analyzer-constants"; import type { AbilityPoints } from "../analyzer-types"; diff --git a/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.test.ts b/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.test.ts index 0cf946d8c..e4d84389d 100644 --- a/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.test.ts +++ b/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.test.ts @@ -1,8 +1,8 @@ -import { describe, expect, test } from "vitest"; import type { AbilityWithUnknown, BuildAbilitiesTupleWithUnknown, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import { describe, expect, test } from "vitest"; import { getAbilityChunksMapAsArray } from "./abilityChunksCalc"; // Utility function that performs an order-agnostic check to see diff --git a/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.ts b/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.ts index a3a3f9d16..76f7f7081 100644 --- a/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.ts +++ b/apps/web-react/app/features/build-analyzer/core/abilityChunksCalc.ts @@ -1,8 +1,8 @@ -import { abilities } from "~/modules/in-game-lists/abilities"; +import { abilities } from "@sendou/in-game-lists/abilities"; import type { AbilityWithUnknown, BuildAbilitiesTupleWithUnknown, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { AbilityChunks } from "../analyzer-types"; // Reference for Ability Chunks numbers: https://splatoonwiki.org/wiki/Ability_chunk#Splatoon_3 diff --git a/apps/web-react/app/features/build-analyzer/core/serializer.ts b/apps/web-react/app/features/build-analyzer/core/serializer.ts index 297648657..5d10913c8 100644 --- a/apps/web-react/app/features/build-analyzer/core/serializer.ts +++ b/apps/web-react/app/features/build-analyzer/core/serializer.ts @@ -1,9 +1,9 @@ -import { abilities } from "~/modules/in-game-lists/abilities"; +import { abilities } from "@sendou/in-game-lists/abilities"; import type { AbilityType, AbilityWithUnknown, BuildAbilitiesTupleWithUnknown, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { UNKNOWN_SHORT } from "../analyzer-constants"; /** diff --git a/apps/web-react/app/features/build-analyzer/core/stats.test.ts b/apps/web-react/app/features/build-analyzer/core/stats.test.ts index 5afb22dde..287c51ee5 100644 --- a/apps/web-react/app/features/build-analyzer/core/stats.test.ts +++ b/apps/web-react/app/features/build-analyzer/core/stats.test.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { describe, expect, test } from "vitest"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import { roundToNDecimalPlaces } from "~/utils/number"; import { damageTypeToWeaponType } from "../analyzer-constants"; import { buildStats } from "./stats"; diff --git a/apps/web-react/app/features/build-analyzer/core/stats.ts b/apps/web-react/app/features/build-analyzer/core/stats.ts index 19b137db4..235394533 100644 --- a/apps/web-react/app/features/build-analyzer/core/stats.ts +++ b/apps/web-react/app/features/build-analyzer/core/stats.ts @@ -1,10 +1,8 @@ -import { nanoid } from "nanoid"; -import * as R from "remeda"; import type { Ability, MainWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { ANGLE_SHOOTER_ID, AUTO_BOMB_ID, @@ -21,7 +19,9 @@ import { subWeaponIds, TORPEDO_ID, ZIPCASTER_ID, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { nanoid } from "nanoid"; +import * as R from "remeda"; import invariant from "~/utils/invariant"; import { cutToNDecimalPlaces, roundToNDecimalPlaces } from "~/utils/number"; import { assertUnreachable } from "~/utils/types"; diff --git a/apps/web-react/app/features/build-analyzer/core/utils.ts b/apps/web-react/app/features/build-analyzer/core/utils.ts index 7398a30fb..c9eea8210 100644 --- a/apps/web-react/app/features/build-analyzer/core/utils.ts +++ b/apps/web-react/app/features/build-analyzer/core/utils.ts @@ -3,8 +3,8 @@ import type { BuildAbilitiesTupleWithUnknown, MainWeaponId, SpecialWeaponId, -} from "~/modules/in-game-lists/types"; -import { weaponIdToBaseWeaponId } from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/types"; +import { weaponIdToBaseWeaponId } from "@sendou/in-game-lists/weapon-ids"; import invariant from "~/utils/invariant"; import type { Unpacked } from "~/utils/types"; import type { diff --git a/apps/web-react/app/features/build-analyzer/routes/analyzer.tsx b/apps/web-react/app/features/build-analyzer/routes/analyzer.tsx index 8833c816b..c11214f2d 100644 --- a/apps/web-react/app/features/build-analyzer/routes/analyzer.tsx +++ b/apps/web-react/app/features/build-analyzer/routes/analyzer.tsx @@ -1,3 +1,21 @@ +import { abilitiesShort } from "@sendou/in-game-lists/abilities"; +import type { + Ability as AbilityType, + BuildAbilitiesTupleWithUnknown, + MainWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; +import { isAbility } from "@sendou/in-game-lists/utils"; +import { + ANGLE_SHOOTER_ID, + BIG_BUBBLER_ID, + INK_MINE_ID, + INK_STORM_ID, + KILLER_WAIL_ID, + POINT_SENSOR_ID, + TORPEDO_ID, + TOXIC_MIST_ID, +} from "@sendou/in-game-lists/weapon-ids"; import clsx from "clsx"; import { FlaskConical, SlidersHorizontal } from "lucide-react"; import * as React from "react"; @@ -26,24 +44,6 @@ import { objectDamageCalculatorPage } from "~/features/object-damage-calculator/ import { FULL_GROUP_SIZE } from "~/features/sendouq/q-constants"; import { userNewBuildPage } from "~/features/user-page/user-page-urls"; import { useHydrated } from "~/hooks/useHydrated"; -import { abilitiesShort } from "~/modules/in-game-lists/abilities"; -import type { - Ability as AbilityType, - BuildAbilitiesTupleWithUnknown, - MainWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; -import { isAbility } from "~/modules/in-game-lists/utils"; -import { - ANGLE_SHOOTER_ID, - BIG_BUBBLER_ID, - INK_MINE_ID, - INK_STORM_ID, - KILLER_WAIL_ID, - POINT_SENSOR_ID, - TORPEDO_ID, - TOXIC_MIST_ID, -} from "~/modules/in-game-lists/weapon-ids"; import { nullFilledArray } from "~/utils/arrays"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; diff --git a/apps/web-react/app/features/build-stats/build-stats-utils.ts b/apps/web-react/app/features/build-stats/build-stats-utils.ts index 31c7a0165..be75774b1 100644 --- a/apps/web-react/app/features/build-stats/build-stats-utils.ts +++ b/apps/web-react/app/features/build-stats/build-stats-utils.ts @@ -1,5 +1,5 @@ -import { abilities } from "~/modules/in-game-lists/abilities"; -import type { Ability } from "~/modules/in-game-lists/types"; +import { abilities } from "@sendou/in-game-lists/abilities"; +import type { Ability } from "@sendou/in-game-lists/types"; import invariant from "~/utils/invariant"; import { roundToNDecimalPlaces } from "~/utils/number"; import { MAX_AP } from "../build-analyzer/analyzer-constants"; diff --git a/apps/web-react/app/features/build-stats/loaders/builds.$slug.popular.server.ts b/apps/web-react/app/features/build-stats/loaders/builds.$slug.popular.server.ts index 5b10a9724..98d4b9d13 100644 --- a/apps/web-react/app/features/build-stats/loaders/builds.$slug.popular.server.ts +++ b/apps/web-react/app/features/build-stats/loaders/builds.$slug.popular.server.ts @@ -1,8 +1,8 @@ import { cachified } from "@epic-web/cachified"; +import { weaponIdToType } from "@sendou/in-game-lists/weapon-ids"; import type { LoaderFunctionArgs } from "react-router"; import * as BuildRepository from "~/features/builds/BuildRepository.server"; import { getServerTFunction } from "~/modules/i18n/i18next.server"; -import { weaponIdToType } from "~/modules/in-game-lists/weapon-ids"; import { cache, IN_MILLISECONDS, ttl } from "~/utils/cache.server"; import { notFoundIfNullish } from "~/utils/remix.server"; import { weaponNameSlugToId } from "~/utils/unslugify.server"; diff --git a/apps/web-react/app/features/build-stats/loaders/builds.$slug.stats.server.ts b/apps/web-react/app/features/build-stats/loaders/builds.$slug.stats.server.ts index 50cd4a240..8b7e6ea91 100644 --- a/apps/web-react/app/features/build-stats/loaders/builds.$slug.stats.server.ts +++ b/apps/web-react/app/features/build-stats/loaders/builds.$slug.stats.server.ts @@ -1,8 +1,8 @@ import { cachified } from "@epic-web/cachified"; +import { weaponIdToType } from "@sendou/in-game-lists/weapon-ids"; import type { LoaderFunctionArgs } from "react-router"; import * as BuildRepository from "~/features/builds/BuildRepository.server"; import { getServerTFunction } from "~/modules/i18n/i18next.server"; -import { weaponIdToType } from "~/modules/in-game-lists/weapon-ids"; import { cache } from "~/utils/cache.server"; import { notFoundIfNullish } from "~/utils/remix.server"; import { weaponNameSlugToId } from "~/utils/unslugify.server"; diff --git a/apps/web-react/app/features/builds/BuildRepository.server.test.ts b/apps/web-react/app/features/builds/BuildRepository.server.test.ts index 6796fc522..49aafcada 100644 --- a/apps/web-react/app/features/builds/BuildRepository.server.test.ts +++ b/apps/web-react/app/features/builds/BuildRepository.server.test.ts @@ -1,13 +1,13 @@ +import type { + BuildAbilitiesTuple, + MainWeaponId, +} from "@sendou/in-game-lists/types"; import { beforeEach, describe, expect, test } from "vitest"; import * as BuildFactory from "~/db/seed/factories/BuildFactory"; import * as UserFactory from "~/db/seed/factories/UserFactory"; import * as XRankPlacementFactory from "~/db/seed/factories/XRankPlacementFactory"; import { db } from "~/db/sql"; import { buildToAbilityPoints } from "~/features/build-analyzer/core/ability-points"; -import type { - BuildAbilitiesTuple, - MainWeaponId, -} from "~/modules/in-game-lists/types"; import * as BuildRepository from "./BuildRepository.server"; const users = UserFactory.pool(); diff --git a/apps/web-react/app/features/builds/BuildRepository.server.ts b/apps/web-react/app/features/builds/BuildRepository.server.ts index f8eebc418..d7b3ec50c 100644 --- a/apps/web-react/app/features/builds/BuildRepository.server.ts +++ b/apps/web-react/app/features/builds/BuildRepository.server.ts @@ -1,14 +1,14 @@ -import { type NotNull, sql, type Transaction } from "kysely"; -import { db } from "~/db/sql"; -import type { BuildWeapon, DB, TablesInsertable } from "~/db/tables"; -import { modesShort } from "~/modules/in-game-lists/modes"; +import { modesShort } from "@sendou/in-game-lists/modes"; import type { Ability, BuildAbilitiesTuple, MainWeaponId, ModeShort, -} from "~/modules/in-game-lists/types"; -import { canonicalWeaponSplId } from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/types"; +import { canonicalWeaponSplId } from "@sendou/in-game-lists/weapon-ids"; +import { type NotNull, sql, type Transaction } from "kysely"; +import { db } from "~/db/sql"; +import type { BuildWeapon, DB, TablesInsertable } from "~/db/tables"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import { LimitReachedError } from "~/utils/errors"; import invariant from "~/utils/invariant"; diff --git a/apps/web-react/app/features/builds/builds-constants.ts b/apps/web-react/app/features/builds/builds-constants.ts index 10b268449..a40aeddc1 100644 --- a/apps/web-react/app/features/builds/builds-constants.ts +++ b/apps/web-react/app/features/builds/builds-constants.ts @@ -1,5 +1,5 @@ +import type { BuildAbilitiesTupleWithUnknown } from "@sendou/in-game-lists/types"; import { differenceInCalendarDays } from "date-fns"; -import type { BuildAbilitiesTupleWithUnknown } from "~/modules/in-game-lists/types"; export const MAX_BUILD_FILTERS = 6; diff --git a/apps/web-react/app/features/builds/builds-types.ts b/apps/web-react/app/features/builds/builds-types.ts index cc58f41c5..d08c6b8ef 100644 --- a/apps/web-react/app/features/builds/builds-types.ts +++ b/apps/web-react/app/features/builds/builds-types.ts @@ -1,4 +1,4 @@ -import type { Ability, MainWeaponId } from "~/modules/in-game-lists/types"; +import type { Ability, MainWeaponId } from "@sendou/in-game-lists/types"; export interface BuildWeaponWithTop500Info { weaponSplId: MainWeaponId; diff --git a/apps/web-react/app/features/builds/core/ability-sorting.server.test.ts b/apps/web-react/app/features/builds/core/ability-sorting.server.test.ts index 2171a843e..d6cd933c3 100644 --- a/apps/web-react/app/features/builds/core/ability-sorting.server.test.ts +++ b/apps/web-react/app/features/builds/core/ability-sorting.server.test.ts @@ -1,5 +1,5 @@ +import type { BuildAbilitiesTuple } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { BuildAbilitiesTuple } from "~/modules/in-game-lists/types"; import { sortAbilities } from "./ability-sorting.server"; describe("sortAbilities()", () => { diff --git a/apps/web-react/app/features/builds/core/ability-sorting.server.ts b/apps/web-react/app/features/builds/core/ability-sorting.server.ts index 156947a70..06118042a 100644 --- a/apps/web-react/app/features/builds/core/ability-sorting.server.ts +++ b/apps/web-react/app/features/builds/core/ability-sorting.server.ts @@ -1,11 +1,8 @@ import { abilities, mainOnlyAbilitiesShort, -} from "~/modules/in-game-lists/abilities"; -import type { - Ability, - BuildAbilitiesTuple, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/abilities"; +import type { Ability, BuildAbilitiesTuple } from "@sendou/in-game-lists/types"; const abilityToIndex = abilities.reduce( (acc, ability, index) => { diff --git a/apps/web-react/app/features/builds/core/filter.server.ts b/apps/web-react/app/features/builds/core/filter.server.ts index 6ae621b15..a772bd89f 100644 --- a/apps/web-react/app/features/builds/core/filter.server.ts +++ b/apps/web-react/app/features/builds/core/filter.server.ts @@ -1,9 +1,9 @@ -import type { Tables } from "~/db/tables"; -import { buildToAbilityPoints } from "~/features/build-analyzer/core/ability-points"; import type { BuildAbilitiesTuple, ModeShort, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import type { Tables } from "~/db/tables"; +import { buildToAbilityPoints } from "~/features/build-analyzer/core/ability-points"; import { databaseTimestampToDate } from "~/utils/dates"; import type { AbilityCondition } from "../builds-types"; diff --git a/apps/web-react/app/features/builds/core/filter.test.ts b/apps/web-react/app/features/builds/core/filter.test.ts index 85f1a623f..2c88a5337 100644 --- a/apps/web-react/app/features/builds/core/filter.test.ts +++ b/apps/web-react/app/features/builds/core/filter.test.ts @@ -1,10 +1,10 @@ -import { describe, expect, test } from "vitest"; -import type { Tables } from "~/db/tables"; import type { Ability, BuildAbilitiesTuple, ModeShort, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import { describe, expect, test } from "vitest"; +import type { Tables } from "~/db/tables"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import { filterBuilds } from "./filter.server"; diff --git a/apps/web-react/app/features/builds/loaders/builds.$slug.server.ts b/apps/web-react/app/features/builds/loaders/builds.$slug.server.ts index 350413512..2cd48fc26 100644 --- a/apps/web-react/app/features/builds/loaders/builds.$slug.server.ts +++ b/apps/web-react/app/features/builds/loaders/builds.$slug.server.ts @@ -1,7 +1,7 @@ +import { weaponIdToType } from "@sendou/in-game-lists/weapon-ids"; import type { LoaderFunctionArgs } from "react-router"; import { getUser } from "~/features/auth/core/user.server"; import { getFixedTForLanguage } from "~/modules/i18n/i18next.server"; -import { weaponIdToType } from "~/modules/in-game-lists/weapon-ids"; import { weaponNameSlugToId } from "~/utils/unslugify.server"; import { mySlugify } from "~/utils/urls"; import * as BuildRepository from "../BuildRepository.server"; diff --git a/apps/web-react/app/features/builds/routes/builds.$slug.tsx b/apps/web-react/app/features/builds/routes/builds.$slug.tsx index 6fd27a06f..272e3b69b 100644 --- a/apps/web-react/app/features/builds/routes/builds.$slug.tsx +++ b/apps/web-react/app/features/builds/routes/builds.$slug.tsx @@ -1,3 +1,6 @@ +import { abilities } from "@sendou/in-game-lists/abilities"; +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { Ability as AbilityType } from "@sendou/in-game-lists/types"; import { Calendar, ChartColumnBig, @@ -17,9 +20,6 @@ import { ModeImage } from "~/components/Image"; import { Main } from "~/components/Main"; import { possibleApValues } from "~/features/build-analyzer/analyzer-constants"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; -import { abilities } from "~/modules/in-game-lists/abilities"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { Ability as AbilityType } from "~/modules/in-game-lists/types"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { dateToYYYYMMDD, isValidDate } from "~/utils/dates"; import { metaTags, type SerializeFrom } from "~/utils/remix"; diff --git a/apps/web-react/app/features/builds/routes/builds.tsx b/apps/web-react/app/features/builds/routes/builds.tsx index 42c772b4a..b3c0720c4 100644 --- a/apps/web-react/app/features/builds/routes/builds.tsx +++ b/apps/web-react/app/features/builds/routes/builds.tsx @@ -1,14 +1,14 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { + weaponCategories, + weaponIdToType, +} from "@sendou/in-game-lists/weapon-ids"; import * as React from "react"; import { useTranslation } from "react-i18next"; import type { MetaFunction } from "react-router"; import { Link } from "react-router"; import { Image } from "~/components/Image"; import { Main } from "~/components/Main"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { - weaponCategories, - weaponIdToType, -} from "~/modules/in-game-lists/weapon-ids"; import type { SendouRouteHandle } from "~/utils/remix.server"; import { BUILDS_PAGE, diff --git a/apps/web-react/app/features/calendar/actions/calendar.new.server.ts b/apps/web-react/app/features/calendar/actions/calendar.new.server.ts index 5678dfbb0..46d9a6542 100644 --- a/apps/web-react/app/features/calendar/actions/calendar.new.server.ts +++ b/apps/web-react/app/features/calendar/actions/calendar.new.server.ts @@ -1,3 +1,4 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; import type { ActionFunction } from "react-router"; import { redirect } from "react-router"; import { requireUser } from "~/features/auth/core/user.server"; @@ -14,7 +15,6 @@ import { import * as TrophyRepository from "~/features/trophies/TrophyRepository.server"; import { canAccessTrophies } from "~/features/trophies/trophies-utils"; import { parseFormDataWithImages } from "~/form/parse.server"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; import { requirePermission, requireRole, diff --git a/apps/web-react/app/features/calendar/calendar-new-schemas.ts b/apps/web-react/app/features/calendar/calendar-new-schemas.ts index d07287993..a594a4138 100644 --- a/apps/web-react/app/features/calendar/calendar-new-schemas.ts +++ b/apps/web-react/app/features/calendar/calendar-new-schemas.ts @@ -1,3 +1,4 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; import { z } from "zod"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import { @@ -18,7 +19,6 @@ import { textFieldOptional, toggle, } from "~/form/fields"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; import { id } from "~/utils/zod"; import { CALENDAR_EVENT, REG_CLOSES_AT_OPTIONS } from "./calendar-constants"; import { diff --git a/apps/web-react/app/features/calendar/calendar-schemas.ts b/apps/web-react/app/features/calendar/calendar-schemas.ts index 6e93fdaf6..3bf3ead3c 100644 --- a/apps/web-react/app/features/calendar/calendar-schemas.ts +++ b/apps/web-react/app/features/calendar/calendar-schemas.ts @@ -1,11 +1,11 @@ +import { gamesShort, versusShort } from "@sendou/in-game-lists/games"; +import { modesShortWithSpecial } from "@sendou/in-game-lists/modes"; import { z } from "zod"; import type { CalendarEventTag } from "~/features/calendar/calendar-types"; import { BEST_TIER_NUMBER, WORST_TIER_NUMBER, } from "~/features/tournament/core/tiering"; -import { gamesShort, versusShort } from "~/modules/in-game-lists/games"; -import { modesShortWithSpecial } from "~/modules/in-game-lists/modes"; import { gamesShortSchema, id, modeShortWithSpecial } from "~/utils/zod"; import { CALENDAR_EVENT } from "./calendar-constants"; diff --git a/apps/web-react/app/features/calendar/calendar-search-params.ts b/apps/web-react/app/features/calendar/calendar-search-params.ts index 5dfb894b1..a27ad3120 100644 --- a/apps/web-react/app/features/calendar/calendar-search-params.ts +++ b/apps/web-react/app/features/calendar/calendar-search-params.ts @@ -1,10 +1,10 @@ +import { gamesShort, versusShort } from "@sendou/in-game-lists/games"; +import { modesShortWithSpecial } from "@sendou/in-game-lists/modes"; import { z } from "zod"; import { BEST_TIER_NUMBER, WORST_TIER_NUMBER, } from "~/features/tournament/core/tiering"; -import { gamesShort, versusShort } from "~/modules/in-game-lists/games"; -import { modesShortWithSpecial } from "~/modules/in-game-lists/modes"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { diff --git a/apps/web-react/app/features/calendar/calendar-types.ts b/apps/web-react/app/features/calendar/calendar-types.ts index 6fb7f683b..9c709e6fb 100644 --- a/apps/web-react/app/features/calendar/calendar-types.ts +++ b/apps/web-react/app/features/calendar/calendar-types.ts @@ -1,8 +1,8 @@ +import type { ModeShortWithSpecial } from "@sendou/in-game-lists/types"; import type { z } from "zod"; import type { Tables } from "~/db/tables"; import type { tags } from "~/features/calendar/calendar-constants"; import type { calendarFiltersSearchParamsSchema } from "~/features/calendar/calendar-schemas"; -import type { ModeShortWithSpecial } from "~/modules/in-game-lists/types"; import type { CommonUser } from "~/utils/kysely.server"; export type CalendarEventTag = keyof typeof tags; diff --git a/apps/web-react/app/features/calendar/components/BracketProgressionFormFields.tsx b/apps/web-react/app/features/calendar/components/BracketProgressionFormFields.tsx index 7a839c777..9241714ba 100644 --- a/apps/web-react/app/features/calendar/components/BracketProgressionFormFields.tsx +++ b/apps/web-react/app/features/calendar/components/BracketProgressionFormFields.tsx @@ -1,8 +1,8 @@ +import * as Swiss from "@sendou/tournament-engine/swiss/team-status"; import { useTranslation } from "react-i18next"; import { FormMessage } from "~/components/FormMessage"; import { InfoPopover } from "~/components/InfoPopover"; import { TOURNAMENT } from "~/features/tournament/tournament-constants"; -import * as Swiss from "~/features/tournament-bracket/core/engine/swiss/team-status"; import { FormField } from "~/form/FormField"; import { useFormFieldContext, useFormValue } from "~/form/SendouForm"; import type { ArrayItemRenderContext } from "~/form/types"; diff --git a/apps/web-react/app/features/calendar/components/FiltersBar.tsx b/apps/web-react/app/features/calendar/components/FiltersBar.tsx index 38040a790..7cfb0f11d 100644 --- a/apps/web-react/app/features/calendar/components/FiltersBar.tsx +++ b/apps/web-react/app/features/calendar/components/FiltersBar.tsx @@ -1,3 +1,5 @@ +import { gamesShort, versusShort } from "@sendou/in-game-lists/games"; +import { modesShortWithSpecial } from "@sendou/in-game-lists/modes"; import { Star, X } from "lucide-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -19,8 +21,6 @@ import { CheckboxGroupFormField, RadioGroupFormField, } from "~/form/fields/InputGroupFormField"; -import { gamesShort, versusShort } from "~/modules/in-game-lists/games"; -import { modesShortWithSpecial } from "~/modules/in-game-lists/modes"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import * as CalendarEvent from "../core/CalendarEvent"; import type { CalendarLoaderData } from "../loaders/calendar.server"; diff --git a/apps/web-react/app/features/calendar/core/CalendarEvent.ts b/apps/web-react/app/features/calendar/core/CalendarEvent.ts index 5009ad0bc..7a31b1f89 100644 --- a/apps/web-react/app/features/calendar/core/CalendarEvent.ts +++ b/apps/web-react/app/features/calendar/core/CalendarEvent.ts @@ -1,11 +1,11 @@ import { TZDate } from "@date-fns/tz"; +import { gamesShort, versusShort } from "@sendou/in-game-lists/games"; +import { modesShortWithSpecial } from "@sendou/in-game-lists/modes"; import { isWeekend } from "date-fns"; import { BEST_TIER_NUMBER, WORST_TIER_NUMBER, } from "~/features/tournament/core/tiering"; -import { gamesShort, versusShort } from "~/modules/in-game-lists/games"; -import { modesShortWithSpecial } from "~/modules/in-game-lists/modes"; import { assertType } from "~/utils/types"; import type { CalendarEvent, diff --git a/apps/web-react/app/features/calendar/routes/calendar.new.tsx b/apps/web-react/app/features/calendar/routes/calendar.new.tsx index 9cbd4f157..7ff17b57c 100644 --- a/apps/web-react/app/features/calendar/routes/calendar.new.tsx +++ b/apps/web-react/app/features/calendar/routes/calendar.new.tsx @@ -1,3 +1,4 @@ +import type { RankedModeShort } from "@sendou/in-game-lists/types"; import { Trash } from "lucide-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -19,7 +20,6 @@ import { existingImage } from "~/form/image-field"; import { SendouForm, useFormFieldContext } from "~/form/SendouForm"; import { errorMessageId } from "~/form/utils"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; -import type { RankedModeShort } from "~/modules/in-game-lists/types"; import { useHasRole } from "~/modules/permissions/hooks"; import { databaseTimestampToDate, getDateAtNextFullHour } from "~/utils/dates"; import { metaTags } from "~/utils/remix"; diff --git a/apps/web-react/app/features/comp-analyzer/comp-analyzer-constants.ts b/apps/web-react/app/features/comp-analyzer/comp-analyzer-constants.ts index 2b4a74283..acd991fe9 100644 --- a/apps/web-react/app/features/comp-analyzer/comp-analyzer-constants.ts +++ b/apps/web-react/app/features/comp-analyzer/comp-analyzer-constants.ts @@ -1,9 +1,9 @@ -import type { DamageType } from "~/features/build-analyzer/analyzer-types"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import type { DamageType } from "~/features/build-analyzer/analyzer-types"; export const MAX_WEAPONS = 4; diff --git a/apps/web-react/app/features/comp-analyzer/comp-analyzer-search-params.ts b/apps/web-react/app/features/comp-analyzer/comp-analyzer-search-params.ts index bd1c9fd9a..a8df76579 100644 --- a/apps/web-react/app/features/comp-analyzer/comp-analyzer-search-params.ts +++ b/apps/web-react/app/features/comp-analyzer/comp-analyzer-search-params.ts @@ -1,6 +1,6 @@ +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; import { MAX_AP } from "~/features/build-analyzer/analyzer-constants"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/comp-analyzer/comp-analyzer-types.ts b/apps/web-react/app/features/comp-analyzer/comp-analyzer-types.ts index cfc231b6b..3e328a1ea 100644 --- a/apps/web-react/app/features/comp-analyzer/comp-analyzer-types.ts +++ b/apps/web-react/app/features/comp-analyzer/comp-analyzer-types.ts @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { DamageType } from "~/features/build-analyzer/analyzer-types"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; export type CategorizationType = "category" | "sub" | "special"; diff --git a/apps/web-react/app/features/comp-analyzer/components/DamageComboBar.tsx b/apps/web-react/app/features/comp-analyzer/components/DamageComboBar.tsx index 4afd51853..336b87eae 100644 --- a/apps/web-react/app/features/comp-analyzer/components/DamageComboBar.tsx +++ b/apps/web-react/app/features/comp-analyzer/components/DamageComboBar.tsx @@ -1,14 +1,14 @@ +import type { + MainWeaponId, + SpecialWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { SendouSwitch } from "~/components/elements/Switch"; import { Image, WeaponImage } from "~/components/Image"; import { MAX_AP } from "~/features/build-analyzer/analyzer-constants"; import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; -import type { - MainWeaponId, - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; import { abilityImageUrl, specialWeaponImageUrl, diff --git a/apps/web-react/app/features/comp-analyzer/components/RangeVisualization.tsx b/apps/web-react/app/features/comp-analyzer/components/RangeVisualization.tsx index 7928eee4f..c70edf41c 100644 --- a/apps/web-react/app/features/comp-analyzer/components/RangeVisualization.tsx +++ b/apps/web-react/app/features/comp-analyzer/components/RangeVisualization.tsx @@ -1,7 +1,7 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { WeaponImage } from "~/components/Image"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { BENCHMARK_WEAPON_IDS, getBenchmarkTrajectories, diff --git a/apps/web-react/app/features/comp-analyzer/components/SelectedWeapons.tsx b/apps/web-react/app/features/comp-analyzer/components/SelectedWeapons.tsx index 35b7328d3..5186ed50e 100644 --- a/apps/web-react/app/features/comp-analyzer/components/SelectedWeapons.tsx +++ b/apps/web-react/app/features/comp-analyzer/components/SelectedWeapons.tsx @@ -14,11 +14,11 @@ import { verticalListSortingStrategy, } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { Image, WeaponImage } from "~/components/Image"; import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { abilityImageUrl, specialWeaponImageUrl, diff --git a/apps/web-react/app/features/comp-analyzer/components/WeaponCategories.tsx b/apps/web-react/app/features/comp-analyzer/components/WeaponCategories.tsx index 9951266cc..724b82893 100644 --- a/apps/web-react/app/features/comp-analyzer/components/WeaponCategories.tsx +++ b/apps/web-react/app/features/comp-analyzer/components/WeaponCategories.tsx @@ -1,11 +1,11 @@ -import { useTranslation } from "react-i18next"; -import { Image } from "~/components/Image"; -import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import { useTranslation } from "react-i18next"; +import { Image } from "~/components/Image"; +import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; import { specialWeaponImageUrl, subWeaponImageUrl } from "~/utils/urls"; import { SPECIAL_CATEGORY_ORDER, diff --git a/apps/web-react/app/features/comp-analyzer/components/WeaponGrid.tsx b/apps/web-react/app/features/comp-analyzer/components/WeaponGrid.tsx index a21407420..94b1bf7a6 100644 --- a/apps/web-react/app/features/comp-analyzer/components/WeaponGrid.tsx +++ b/apps/web-react/app/features/comp-analyzer/components/WeaponGrid.tsx @@ -1,18 +1,18 @@ -import { useTranslation } from "react-i18next"; -import { Image, WeaponImage } from "~/components/Image"; -import { Label } from "~/components/Label"; -import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { mainWeaponIds, specialWeaponIds, subWeaponIds, weaponCategories, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { useTranslation } from "react-i18next"; +import { Image, WeaponImage } from "~/components/Image"; +import { Label } from "~/components/Label"; +import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; import { specialWeaponImageUrl, subWeaponImageUrl, diff --git a/apps/web-react/app/features/comp-analyzer/core/damage-combinations.ts b/apps/web-react/app/features/comp-analyzer/core/damage-combinations.ts index 8caebc6ed..e7ab2355d 100644 --- a/apps/web-react/app/features/comp-analyzer/core/damage-combinations.ts +++ b/apps/web-react/app/features/comp-analyzer/core/damage-combinations.ts @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { damageTypeToWeaponType } from "~/features/build-analyzer/analyzer-constants"; import type { AbilityPoints, @@ -8,7 +9,6 @@ import { subWeaponDamageValue, } from "~/features/build-analyzer/core/stats"; import { weaponParams } from "~/features/build-analyzer/core/utils"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { COMBO_DAMAGE_THRESHOLD, LETHAL_DAMAGE, diff --git a/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.test.ts b/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.test.ts index 3acbba68c..bcee039bc 100644 --- a/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.test.ts +++ b/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.test.ts @@ -1,4 +1,3 @@ -import { describe, expect, test } from "vitest"; import { BIG_BUBBLER_ID, BOOYAH_BOMB_ID, @@ -7,7 +6,8 @@ import { specialWeaponIds, TRIZOOKA_ID, WAVE_BREAKER_ID, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { describe, expect, test } from "vitest"; import { getSpecialWeaponRange } from "./special-weapon-range"; describe("special weapon range", () => { diff --git a/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.ts b/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.ts index 4c22cb0b5..bb79c3025 100644 --- a/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.ts +++ b/apps/web-react/app/features/comp-analyzer/core/special-weapon-range.ts @@ -1,6 +1,6 @@ +import type { SpecialWeaponId } from "@sendou/in-game-lists/types"; +import { specialWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { specialWeaponParams } from "~/features/build-analyzer/core/utils"; -import type { SpecialWeaponId } from "~/modules/in-game-lists/types"; -import { specialWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import { calculateGroundRange, simulateTrajectoryPoints, diff --git a/apps/web-react/app/features/comp-analyzer/core/weapon-range.test.ts b/apps/web-react/app/features/comp-analyzer/core/weapon-range.test.ts index df7298485..4487f79f1 100644 --- a/apps/web-react/app/features/comp-analyzer/core/weapon-range.test.ts +++ b/apps/web-react/app/features/comp-analyzer/core/weapon-range.test.ts @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { getWeaponsWithRange } from "./weapon-range"; // [longerRangeWeaponId, shorterRangeWeaponId] diff --git a/apps/web-react/app/features/comp-analyzer/core/weapon-range.ts b/apps/web-react/app/features/comp-analyzer/core/weapon-range.ts index 8e3827b99..98040e4c3 100644 --- a/apps/web-react/app/features/comp-analyzer/core/weapon-range.ts +++ b/apps/web-react/app/features/comp-analyzer/core/weapon-range.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { weaponCategories } from "@sendou/in-game-lists/weapon-ids"; import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { weaponCategories } from "~/modules/in-game-lists/weapon-ids"; export interface TrajectoryParams { spawnSpeed: number; diff --git a/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.all-ranges.tsx b/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.all-ranges.tsx index b586d3f09..0c1eeeeff 100644 --- a/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.all-ranges.tsx +++ b/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.all-ranges.tsx @@ -1,9 +1,9 @@ -import { Main } from "~/components/Main"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { weaponCategories, weaponIdToType, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { Main } from "~/components/Main"; import { RangeVisualization } from "../components/RangeVisualization"; import { SpecialRangeVisualization } from "../components/SpecialRangeVisualization"; diff --git a/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.tsx b/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.tsx index e7b7ed91b..ab79fd648 100644 --- a/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.tsx +++ b/apps/web-react/app/features/comp-analyzer/routes/comp-analyzer.tsx @@ -1,9 +1,9 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { useState } from "react"; import type { MetaFunction, ShouldRevalidateFunction } from "react-router"; import { Main } from "~/components/Main"; import { Placeholder } from "~/components/Placeholder"; import { useHydrated } from "~/hooks/useHydrated"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { SendouRouteHandle } from "~/utils/remix.server"; import { COMP_ANALYZER_URL, navIconUrl } from "~/utils/urls"; import { metaTags } from "../../../utils/remix"; diff --git a/apps/web-react/app/features/components-showcase/routes/components.tsx b/apps/web-react/app/features/components-showcase/routes/components.tsx index e10168f46..a468eafb6 100644 --- a/apps/web-react/app/features/components-showcase/routes/components.tsx +++ b/apps/web-react/app/features/components-showcase/routes/components.tsx @@ -1,4 +1,5 @@ import { parseDate } from "@internationalized/date"; +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Check, Plus, RotateCcw, Search, SquarePen, Trash } from "lucide-react"; import { useState } from "react"; @@ -74,7 +75,6 @@ import { UserCard } from "~/features/user-card/components/UserCard"; import type { UserCardData } from "~/features/user-card/user-card-types"; import type { CustomFieldRenderProps } from "~/form/FormField"; import { SendouForm } from "~/form/SendouForm"; -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; import type { SendouRouteHandle } from "~/utils/remix.server"; import styles from "../components-showcase.module.css"; import { EXAMPLE_TROPHY_MODEL } from "../example-trophy-model"; diff --git a/apps/web-react/app/features/front-page/components/SplatoonRotations.tsx b/apps/web-react/app/features/front-page/components/SplatoonRotations.tsx index 857a258c1..dbfbf78de 100644 --- a/apps/web-react/app/features/front-page/components/SplatoonRotations.tsx +++ b/apps/web-react/app/features/front-page/components/SplatoonRotations.tsx @@ -1,3 +1,5 @@ +import { shortStageName } from "@sendou/in-game-lists/stage-ids"; +import type { StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { differenceInMinutes, differenceInSeconds } from "date-fns"; import * as React from "react"; @@ -11,8 +13,6 @@ import { ModeImage, StageImage } from "~/components/Image"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; import { useFormatDistanceToNow } from "~/hooks/intl/useFormatDistanceToNow"; import { useAutoRerender } from "~/hooks/useAutoRerender"; -import { shortStageName } from "~/modules/in-game-lists/stage-ids"; -import type { StageId } from "~/modules/in-game-lists/types"; import { databaseTimestampToDate, dateToDatabaseTimestamp, diff --git a/apps/web-react/app/features/img-export/components/BuildGraphic.tsx b/apps/web-react/app/features/img-export/components/BuildGraphic.tsx index 993ecf2e3..cfef1ad81 100644 --- a/apps/web-react/app/features/img-export/components/BuildGraphic.tsx +++ b/apps/web-react/app/features/img-export/components/BuildGraphic.tsx @@ -1,3 +1,9 @@ +import type { + Ability as AbilityType, + BuildAbilitiesTuple, + GearType, + ModeShort, +} from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { Ability } from "~/components/Ability"; @@ -9,12 +15,6 @@ import { buildToAbilityPoints } from "~/features/build-analyzer/core/ability-poi import { getAbilityChunksMapAsArray } from "~/features/build-analyzer/core/abilityChunksCalc"; import { apFromMap } from "~/features/build-analyzer/core/utils"; import type { BuildWeaponWithTop500Info } from "~/features/builds/builds-types"; -import type { - Ability as AbilityType, - BuildAbilitiesTuple, - GearType, - ModeShort, -} from "~/modules/in-game-lists/types"; import { gearImageUrl, navIconUrl, resolveAvatarUrl } from "~/utils/urls"; import styles from "./BuildGraphic.module.css"; import { diff --git a/apps/web-react/app/features/img-export/components/Graphic.tsx b/apps/web-react/app/features/img-export/components/Graphic.tsx index 6309fe5a4..2a2cf7f6c 100644 --- a/apps/web-react/app/features/img-export/components/Graphic.tsx +++ b/apps/web-react/app/features/img-export/components/Graphic.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { QRCodeSVG } from "qrcode.react"; import * as React from "react"; @@ -6,7 +7,6 @@ import { Flag } from "~/components/Flag"; import { SpecialWeaponImage, WeaponImage } from "~/components/Image"; import { Placement } from "~/components/Placement"; import { weaponParams } from "~/features/build-analyzer/core/utils"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import styles from "./Graphic.module.css"; export const GRAPHIC_DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = { diff --git a/apps/web-react/app/features/img-export/components/SeasonSummaryGraphic.tsx b/apps/web-react/app/features/img-export/components/SeasonSummaryGraphic.tsx index df623c600..1edbb881a 100644 --- a/apps/web-react/app/features/img-export/components/SeasonSummaryGraphic.tsx +++ b/apps/web-react/app/features/img-export/components/SeasonSummaryGraphic.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { eachDayOfInterval, @@ -17,7 +18,6 @@ import { TierPill } from "~/components/TierPill"; import type { TierName } from "~/features/mmr/mmr-constants"; import { userSeasonsPage } from "~/features/user-page/user-page-urls"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; import { GRAPHIC_DATE_FORMAT_OPTIONS, GraphicContainer, diff --git a/apps/web-react/app/features/img-export/core/RunComps.test.ts b/apps/web-react/app/features/img-export/core/RunComps.test.ts index d8ae327d2..b30a3fd04 100644 --- a/apps/web-react/app/features/img-export/core/RunComps.test.ts +++ b/apps/web-react/app/features/img-export/core/RunComps.test.ts @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import * as RunComps from "./RunComps"; const SHOOTER = 40 as MainWeaponId; diff --git a/apps/web-react/app/features/img-export/core/RunComps.ts b/apps/web-react/app/features/img-export/core/RunComps.ts index e88c8973d..6c6cb5c55 100644 --- a/apps/web-react/app/features/img-export/core/RunComps.ts +++ b/apps/web-react/app/features/img-export/core/RunComps.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import * as R from "remeda"; import { weaponParams } from "~/features/build-analyzer/core/utils"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; const TACTICOOLER_SPECIAL_WEAPON_ID = 15; const COMP_SIZE = 4; diff --git a/apps/web-react/app/features/img-export/core/SeasonSummary.ts b/apps/web-react/app/features/img-export/core/SeasonSummary.ts index 568b77778..fe851fea7 100644 --- a/apps/web-react/app/features/img-export/core/SeasonSummary.ts +++ b/apps/web-react/app/features/img-export/core/SeasonSummary.ts @@ -1,10 +1,10 @@ -import * as R from "remeda"; -import * as Seasons from "~/features/mmr/core/Seasons"; import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import * as R from "remeda"; +import * as Seasons from "~/features/mmr/core/Seasons"; import type { Role } from "~/modules/permissions/types"; const BEST_STAGE_MIN_MAPS_NEEDED = 10; diff --git a/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.test.ts b/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.test.ts index 7003c83d2..9fec9e232 100644 --- a/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.test.ts +++ b/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.test.ts @@ -7,6 +7,7 @@ vi.mock("~/features/chat/ChatSystemMessage.server", () => ({ setMetadata: vi.fn(), })); +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { actAs } from "~/db/seed/core/actAs"; import * as SQMatchFactory from "~/db/seed/factories/SQMatchFactory"; import * as SQReportedWeaponFactory from "~/db/seed/factories/SQReportedWeaponFactory"; @@ -16,7 +17,6 @@ import * as UserFactory from "~/db/seed/factories/UserFactory"; import * as Seasons from "~/features/mmr/core/Seasons"; import { userIdsToIdentifier } from "~/features/mmr/mmr-utils"; import { FULL_GROUP_SIZE } from "~/features/sendouq/q-constants"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import * as LeaderboardRepository from "./LeaderboardRepository.server"; import { MATCHES_COUNT_NEEDED_FOR_LEADERBOARD } from "./leaderboards-constants"; diff --git a/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.ts b/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.ts index e8e2d8fc4..6610be01b 100644 --- a/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.ts +++ b/apps/web-react/app/features/leaderboards/LeaderboardRepository.server.ts @@ -1,13 +1,13 @@ +import type { + MainWeaponId, + RankedModeShort, +} from "@sendou/in-game-lists/types"; import type { InferResult } from "kysely"; import { sql } from "kysely"; import * as R from "remeda"; import { db } from "~/db/sql"; import type { Tables } from "~/db/tables"; import { actorId } from "~/features/auth/core/user.server"; -import type { - MainWeaponId, - RankedModeShort, -} from "~/modules/in-game-lists/types"; import { commonUserSelect, concatUserSubmittedImagePrefix, diff --git a/apps/web-react/app/features/leaderboards/core/leaderboards.server.test.ts b/apps/web-react/app/features/leaderboards/core/leaderboards.server.test.ts index b88f3472f..63844f948 100644 --- a/apps/web-react/app/features/leaderboards/core/leaderboards.server.test.ts +++ b/apps/web-react/app/features/leaderboards/core/leaderboards.server.test.ts @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { DEFAULT_LEADERBOARD_MAX_SIZE } from "../leaderboards-constants"; import { filterByWeaponCategory, diff --git a/apps/web-react/app/features/leaderboards/core/leaderboards.server.ts b/apps/web-react/app/features/leaderboards/core/leaderboards.server.ts index f601ed1cc..24a6a0fc6 100644 --- a/apps/web-react/app/features/leaderboards/core/leaderboards.server.ts +++ b/apps/web-react/app/features/leaderboards/core/leaderboards.server.ts @@ -1,4 +1,6 @@ import { cachified } from "@epic-web/cachified"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { weaponCategories } from "@sendou/in-game-lists/weapon-ids"; import type { SeasonPopularUsersWeapon, UserSPLeaderboardItem, @@ -8,8 +10,6 @@ import * as Seasons from "~/features/mmr/core/Seasons"; import { USER_LEADERBOARD_MIN_ENTRIES_FOR_LEVIATHAN } from "~/features/mmr/mmr-constants"; import { freshUserSkills } from "~/features/mmr/tiered.server"; import * as UserRepository from "~/features/user-page/UserRepository.server"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { weaponCategories } from "~/modules/in-game-lists/weapon-ids"; import { cache, IN_MILLISECONDS, ttl } from "~/utils/cache.server"; import type { Unwrapped } from "~/utils/types"; import { DEFAULT_LEADERBOARD_MAX_SIZE } from "../leaderboards-constants"; diff --git a/apps/web-react/app/features/leaderboards/leaderboards-constants.ts b/apps/web-react/app/features/leaderboards/leaderboards-constants.ts index eea0b7ac3..c0f3c9943 100644 --- a/apps/web-react/app/features/leaderboards/leaderboards-constants.ts +++ b/apps/web-react/app/features/leaderboards/leaderboards-constants.ts @@ -1,8 +1,8 @@ -import { rankedModesShort } from "~/modules/in-game-lists/modes"; +import { rankedModesShort } from "@sendou/in-game-lists/modes"; import { mainWeaponIds, weaponCategories, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; export const MATCHES_COUNT_NEEDED_FOR_LEADERBOARD = 7; export const DEFAULT_LEADERBOARD_MAX_SIZE = 500; diff --git a/apps/web-react/app/features/leaderboards/loaders/leaderboards.server.ts b/apps/web-react/app/features/leaderboards/loaders/leaderboards.server.ts index 3399ab782..a5c37f26f 100644 --- a/apps/web-react/app/features/leaderboards/loaders/leaderboards.server.ts +++ b/apps/web-react/app/features/leaderboards/loaders/leaderboards.server.ts @@ -1,12 +1,12 @@ +import type { + MainWeaponId, + RankedModeShort, +} from "@sendou/in-game-lists/types"; +import type { weaponCategories } from "@sendou/in-game-lists/weapon-ids"; import type { LoaderFunctionArgs } from "react-router"; import { getUser } from "~/features/auth/core/user.server"; import * as LeaderboardRepository from "~/features/leaderboards/LeaderboardRepository.server"; import * as Seasons from "~/features/mmr/core/Seasons"; -import type { - MainWeaponId, - RankedModeShort, -} from "~/modules/in-game-lists/types"; -import type { weaponCategories } from "~/modules/in-game-lists/weapon-ids"; import { cachedFullUserLeaderboard, cachedTeamLeaderboard, diff --git a/apps/web-react/app/features/leaderboards/routes/leaderboards.tsx b/apps/web-react/app/features/leaderboards/routes/leaderboards.tsx index 39bced336..d6d9cc3df 100644 --- a/apps/web-react/app/features/leaderboards/routes/leaderboards.tsx +++ b/apps/web-react/app/features/leaderboards/routes/leaderboards.tsx @@ -1,3 +1,6 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { weaponCategories } from "@sendou/in-game-lists/weapon-ids"; import clsx from "clsx"; import { Ban, MoreHorizontal, RotateCcw } from "lucide-react"; import React from "react"; @@ -25,9 +28,6 @@ import * as Seasons from "~/features/mmr/core/Seasons"; import { ordinalToSp } from "~/features/mmr/mmr-utils"; import type { SkillTierInterval } from "~/features/mmr/tiered.server"; import { useActionSubmit } from "~/hooks/useActionSubmit"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { weaponCategories } from "~/modules/in-game-lists/weapon-ids"; import { useHasRole } from "~/modules/permissions/hooks"; import { useSearchParam, diff --git a/apps/web-react/app/features/lfg/core/filtering.ts b/apps/web-react/app/features/lfg/core/filtering.ts index 697f19196..7b1a1edef 100644 --- a/apps/web-react/app/features/lfg/core/filtering.ts +++ b/apps/web-react/app/features/lfg/core/filtering.ts @@ -1,11 +1,11 @@ -import type { TierName } from "~/features/mmr/mmr-constants"; -import { compareTwoTiers } from "~/features/mmr/mmr-utils"; -import type { TieredSkill } from "~/features/mmr/tiered.server"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { mainWeaponIds, weaponIdToBaseWeaponId, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import type { TierName } from "~/features/mmr/mmr-constants"; +import { compareTwoTiers } from "~/features/mmr/mmr-utils"; +import type { TieredSkill } from "~/features/mmr/tiered.server"; import type { Unpacked } from "~/utils/types"; import type * as LFGRepository from "../LFGRepository.server"; import type { LFGFilterValues } from "../lfg-types"; diff --git a/apps/web-react/app/features/lfg/lfg-search-params.ts b/apps/web-react/app/features/lfg/lfg-search-params.ts index b9992fd16..112603a60 100644 --- a/apps/web-react/app/features/lfg/lfg-search-params.ts +++ b/apps/web-react/app/features/lfg/lfg-search-params.ts @@ -1,10 +1,10 @@ +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; import { TIERS, type TierName } from "~/features/mmr/mmr-constants"; import { languagesUnified, type UnifiedLanguageCode, } from "~/modules/i18n/config"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/lfg/lfg-types.ts b/apps/web-react/app/features/lfg/lfg-types.ts index 3483ae4f2..43a2c7937 100644 --- a/apps/web-react/app/features/lfg/lfg-types.ts +++ b/apps/web-react/app/features/lfg/lfg-types.ts @@ -1,7 +1,7 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { LFGType } from "~/features/lfg/lfg-constants"; import type { TierName } from "~/features/mmr/mmr-constants"; import type { UnifiedLanguageCode } from "~/modules/i18n/config"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; export interface LFGFilterValues { weapons: MainWeaponId[]; diff --git a/apps/web-react/app/features/lfg/routes/lfg.tsx b/apps/web-react/app/features/lfg/routes/lfg.tsx index 689fb98f9..7bfa21139 100644 --- a/apps/web-react/app/features/lfg/routes/lfg.tsx +++ b/apps/web-react/app/features/lfg/routes/lfg.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { add, sub } from "date-fns"; import { useTranslation } from "react-i18next"; @@ -17,7 +18,6 @@ import { TIERS } from "~/features/mmr/mmr-constants"; import { timezoneMiddleware } from "~/features/timezone/timezone-middleware.server"; import { useSearchParamPagination } from "~/hooks/useSearchParamPagination"; import { languagesUnified } from "~/modules/i18n/config"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { databaseTimestampToDate } from "~/utils/dates"; import { metaTags, type SerializeFrom } from "~/utils/remix"; diff --git a/apps/web-react/app/features/map-list-generator/core/MapList.test.ts b/apps/web-react/app/features/map-list-generator/core/MapList.test.ts index 85818db5f..8c58254e0 100644 --- a/apps/web-react/app/features/map-list-generator/core/MapList.test.ts +++ b/apps/web-react/app/features/map-list-generator/core/MapList.test.ts @@ -1,6 +1,6 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { StageId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { StageId } from "~/modules/in-game-lists/types"; import { unwrap } from "~/utils/result"; import * as MapList from "./MapList"; import { MapPool } from "./map-pool"; diff --git a/apps/web-react/app/features/map-list-generator/core/MapList.ts b/apps/web-react/app/features/map-list-generator/core/MapList.ts index 8f56fb4b1..a70bae0e3 100644 --- a/apps/web-react/app/features/map-list-generator/core/MapList.ts +++ b/apps/web-react/app/features/map-list-generator/core/MapList.ts @@ -1,10 +1,10 @@ -import * as R from "remeda"; -import { modesShort } from "~/modules/in-game-lists/modes"; +import { modesShort } from "@sendou/in-game-lists/modes"; import type { ModeShort, ModeWithStage, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import * as R from "remeda"; import invariant from "~/utils/invariant"; import { err, ok, unwrapOr } from "~/utils/result"; import type { MapPool } from "./map-pool"; diff --git a/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/serializer.ts b/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/serializer.ts index 1f028fb0c..c1f1a1574 100644 --- a/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/serializer.ts +++ b/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/serializer.ts @@ -1,7 +1,7 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { StageId } from "@sendou/in-game-lists/types"; import invariant from "~/utils/invariant"; -import { modesShort } from "../../../../modules/in-game-lists/modes"; -import { stageIds } from "../../../../modules/in-game-lists/stage-ids"; -import type { StageId } from "../../../../modules/in-game-lists/types"; import type { MapPoolObject, ReadonlyMapPoolObject } from "./types"; export function mapPoolToSerializedString( diff --git a/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/types.ts b/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/types.ts index 2a203a711..9c2f140d7 100644 --- a/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/types.ts +++ b/apps/web-react/app/features/map-list-generator/core/map-pool-serializer/types.ts @@ -1,7 +1,4 @@ -import type { - ModeShort, - StageId, -} from "../../../../modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; export type MapPoolObject = Record; export type ReadonlyMapPoolObject = Readonly< diff --git a/apps/web-react/app/features/map-list-generator/core/map-pool.ts b/apps/web-react/app/features/map-list-generator/core/map-pool.ts index 5eaa9f6b6..50cdff72c 100644 --- a/apps/web-react/app/features/map-list-generator/core/map-pool.ts +++ b/apps/web-react/app/features/map-list-generator/core/map-pool.ts @@ -1,6 +1,6 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { mapPoolToSerializedString, serializedStringToMapPool, diff --git a/apps/web-react/app/features/map-list-generator/routes/maps.tsx b/apps/web-react/app/features/map-list-generator/routes/maps.tsx index 159d42807..f07a252c2 100644 --- a/apps/web-react/app/features/map-list-generator/routes/maps.tsx +++ b/apps/web-react/app/features/map-list-generator/routes/maps.tsx @@ -1,3 +1,5 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeWithStage } from "@sendou/in-game-lists/types"; import { Check, Clipboard } from "lucide-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -9,8 +11,6 @@ import { Main } from "~/components/Main"; import { MapPoolSelector, MapPoolStages } from "~/components/MapPoolSelector"; import type { Tables } from "~/db/tables"; import { useCopyToClipboard } from "~/hooks/useCopyToClipboard"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeWithStage } from "~/modules/in-game-lists/types"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import invariant from "~/utils/invariant"; import { metaTags } from "~/utils/remix"; diff --git a/apps/web-react/app/features/map-planner/components/Planner.tsx b/apps/web-react/app/features/map-planner/components/Planner.tsx index e400b1eb6..2447e6d9e 100644 --- a/apps/web-react/app/features/map-planner/components/Planner.tsx +++ b/apps/web-react/app/features/map-planner/components/Planner.tsx @@ -9,6 +9,20 @@ import { useSensors, } from "@dnd-kit/core"; import { snapCenterToCursor } from "@dnd-kit/modifiers"; +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds, stagesObj } from "@sendou/in-game-lists/stage-ids"; +import type { + MainWeaponId, + ModeShort, + SpecialWeaponId, + StageId, +} from "@sendou/in-game-lists/types"; +import { + mainWeaponIds, + specialWeaponIds, + subWeaponIds, + weaponCategories, +} from "@sendou/in-game-lists/weapon-ids"; import { AssetRecordType, createShapeId, @@ -37,20 +51,6 @@ import { getSpecialWeaponRange } from "~/features/comp-analyzer/core/special-wea import { getWeaponRange } from "~/features/comp-analyzer/core/weapon-range"; import { useTheme } from "~/features/theme/core/provider"; import type { LanguageCode } from "~/modules/i18n/config"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds, stagesObj } from "~/modules/in-game-lists/stage-ids"; -import type { - MainWeaponId, - ModeShort, - SpecialWeaponId, - StageId, -} from "~/modules/in-game-lists/types"; -import { - mainWeaponIds, - specialWeaponIds, - subWeaponIds, - weaponCategories, -} from "~/modules/in-game-lists/weapon-ids"; import { logger } from "~/utils/logger"; import { mainWeaponImageUrl, diff --git a/apps/web-react/app/features/match-profile/MatchProfileRepository.server.ts b/apps/web-react/app/features/match-profile/MatchProfileRepository.server.ts index 98f701b5a..d7cb29212 100644 --- a/apps/web-react/app/features/match-profile/MatchProfileRepository.server.ts +++ b/apps/web-react/app/features/match-profile/MatchProfileRepository.server.ts @@ -1,3 +1,4 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import * as R from "remeda"; import { db } from "~/db/sql"; import type { DBBoolean, Tables } from "~/db/tables"; @@ -5,7 +6,6 @@ import type { UserMapModePreferences } from "~/db/tables-json"; import { actorId } from "~/features/auth/core/user.server"; import type { WeaponPoolItem } from "~/form/fields/WeaponPoolFormField"; import type { UnifiedLanguageCode } from "~/modules/i18n/config"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { matchProfileWeapons } from "~/utils/kysely.server"; import { toDBBoolean } from "~/utils/sql"; diff --git a/apps/web-react/app/features/match-profile/banned-maps.ts b/apps/web-react/app/features/match-profile/banned-maps.ts index a07e06287..dbea8c8ef 100644 --- a/apps/web-react/app/features/match-profile/banned-maps.ts +++ b/apps/web-react/app/features/match-profile/banned-maps.ts @@ -1,5 +1,5 @@ -import { stagesObj as s, stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import { stagesObj as s, stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { MapPool } from "../map-list-generator/core/map-pool"; export const BANNED_MAPS: Record = { diff --git a/apps/web-react/app/features/object-damage-calculator/calculator-constants.ts b/apps/web-react/app/features/object-damage-calculator/calculator-constants.ts index ec2061d54..53c6b517b 100644 --- a/apps/web-react/app/features/object-damage-calculator/calculator-constants.ts +++ b/apps/web-react/app/features/object-damage-calculator/calculator-constants.ts @@ -1,9 +1,9 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { Namespace, TFunction } from "i18next"; import type { AnyWeapon, DamageType, } from "~/features/build-analyzer/analyzer-types"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { CombineWith, DamageReceiver } from "./calculator-types"; import type objectDamages from "./data/object-dmg.json"; diff --git a/apps/web-react/app/features/object-damage-calculator/calculator-hooks.ts b/apps/web-react/app/features/object-damage-calculator/calculator-hooks.ts index 8230c5361..d26cef19c 100644 --- a/apps/web-react/app/features/object-damage-calculator/calculator-hooks.ts +++ b/apps/web-react/app/features/object-damage-calculator/calculator-hooks.ts @@ -1,4 +1,4 @@ -import { exampleMainWeaponIdWithSpecialWeaponId } from "~/modules/in-game-lists/weapon-ids"; +import { exampleMainWeaponIdWithSpecialWeaponId } from "@sendou/in-game-lists/weapon-ids"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { assertType } from "~/utils/types"; import type { DAMAGE_TYPE } from "../build-analyzer/analyzer-constants"; diff --git a/apps/web-react/app/features/object-damage-calculator/calculator-search-params.ts b/apps/web-react/app/features/object-damage-calculator/calculator-search-params.ts index ff6933f78..adb586a1e 100644 --- a/apps/web-react/app/features/object-damage-calculator/calculator-search-params.ts +++ b/apps/web-react/app/features/object-damage-calculator/calculator-search-params.ts @@ -1,14 +1,8 @@ -import { z } from "zod"; -import { - DAMAGE_TYPE, - possibleApValues, -} from "~/features/build-analyzer/analyzer-constants"; -import type { AnyWeapon } from "~/features/build-analyzer/analyzer-types"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { mainWeaponIds, nonBombSubWeaponIds, @@ -16,7 +10,13 @@ import { specialWeaponIds, subWeaponIds, weaponCategories, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { z } from "zod"; +import { + DAMAGE_TYPE, + possibleApValues, +} from "~/features/build-analyzer/analyzer-constants"; +import type { AnyWeapon } from "~/features/build-analyzer/analyzer-types"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; diff --git a/apps/web-react/app/features/object-damage-calculator/calculator-urls.ts b/apps/web-react/app/features/object-damage-calculator/calculator-urls.ts index 307c40124..d20d14666 100644 --- a/apps/web-react/app/features/object-damage-calculator/calculator-urls.ts +++ b/apps/web-react/app/features/object-damage-calculator/calculator-urls.ts @@ -1,4 +1,4 @@ -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { calculatorSearchParams } from "./calculator-search-params"; export const objectDamageCalculatorPage = (weaponId?: MainWeaponId) => diff --git a/apps/web-react/app/features/object-damage-calculator/core/objectDamage.test.ts b/apps/web-react/app/features/object-damage-calculator/core/objectDamage.test.ts index 8566d73d2..1d6e6a4c1 100644 --- a/apps/web-react/app/features/object-damage-calculator/core/objectDamage.test.ts +++ b/apps/web-react/app/features/object-damage-calculator/core/objectDamage.test.ts @@ -1,3 +1,13 @@ +import type { + MainWeaponId, + SpecialWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; +import { + exampleMainWeaponIdWithSpecialWeaponId, + mainWeaponIds, + specialWeaponIds, +} from "@sendou/in-game-lists/weapon-ids"; import { describe, expect, test } from "vitest"; import type { AbilityPoints, @@ -5,16 +15,6 @@ import type { DamageType, } from "~/features/build-analyzer/analyzer-types"; import { buildStats } from "~/features/build-analyzer/core/stats"; -import type { - MainWeaponId, - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; -import { - exampleMainWeaponIdWithSpecialWeaponId, - mainWeaponIds, - specialWeaponIds, -} from "~/modules/in-game-lists/weapon-ids"; import { calculateDamage } from "./objectDamage"; function calculate({ diff --git a/apps/web-react/app/features/object-damage-calculator/core/objectDamage.ts b/apps/web-react/app/features/object-damage-calculator/core/objectDamage.ts index e7a23e7ad..913a9a50b 100644 --- a/apps/web-react/app/features/object-damage-calculator/core/objectDamage.ts +++ b/apps/web-react/app/features/object-damage-calculator/core/objectDamage.ts @@ -1,3 +1,9 @@ +import type { + MainWeaponId, + SpecialWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; +import { weaponIdToBaseWeaponId } from "@sendou/in-game-lists/weapon-ids"; import * as R from "remeda"; import type { AbilityPoints, @@ -6,12 +12,6 @@ import type { Damage, DamageType, } from "~/features/build-analyzer/analyzer-types"; -import type { - MainWeaponId, - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; -import { weaponIdToBaseWeaponId } from "~/modules/in-game-lists/weapon-ids"; import invariant from "~/utils/invariant"; import { roundToNDecimalPlaces } from "~/utils/number"; import { diff --git a/apps/web-react/app/features/object-damage-calculator/core/objectHitPoints.ts b/apps/web-react/app/features/object-damage-calculator/core/objectHitPoints.ts index d533d5e02..a42d028e5 100644 --- a/apps/web-react/app/features/object-damage-calculator/core/objectHitPoints.ts +++ b/apps/web-react/app/features/object-damage-calculator/core/objectHitPoints.ts @@ -1,3 +1,8 @@ +import { + BIG_BUBBLER_ID, + CRAB_TANK_ID, + SPLASH_WALL_ID, +} from "@sendou/in-game-lists/weapon-ids"; import type { AbilityPoints, SpecialWeaponParams, @@ -13,11 +18,6 @@ import { mainWeaponParams, weaponParams, } from "~/features/build-analyzer/core/utils"; -import { - BIG_BUBBLER_ID, - CRAB_TANK_ID, - SPLASH_WALL_ID, -} from "~/modules/in-game-lists/weapon-ids"; import invariant from "~/utils/invariant"; import type { HitPoints } from "../calculator-types"; diff --git a/apps/web-react/app/features/object-damage-calculator/routes/object-damage-calculator.tsx b/apps/web-react/app/features/object-damage-calculator/routes/object-damage-calculator.tsx index d701e2472..ec50b526f 100644 --- a/apps/web-react/app/features/object-damage-calculator/routes/object-damage-calculator.tsx +++ b/apps/web-react/app/features/object-damage-calculator/routes/object-damage-calculator.tsx @@ -1,3 +1,16 @@ +import { + BIG_BUBBLER_ID, + BOOYAH_BOMB_ID, + CRAB_TANK_ID, + INK_VAC_ID, + SPLASH_WALL_ID, + SPRINKLER_ID, + SQUID_BEAKON_ID, + SUPER_CHUMP_ID, + TORPEDO_ID, + TRIPLE_SPLASHDOWN_ID, + WAVE_BREAKER_ID, +} from "@sendou/in-game-lists/weapon-ids"; import clsx from "clsx"; import React, { type JSX } from "react"; import { Button } from "react-aria-components"; @@ -12,19 +25,6 @@ import { Main } from "~/components/Main"; import { WeaponSelect } from "~/components/WeaponSelect"; import { possibleApValues } from "~/features/build-analyzer/analyzer-constants"; import type { DamageType } from "~/features/build-analyzer/analyzer-types"; -import { - BIG_BUBBLER_ID, - BOOYAH_BOMB_ID, - CRAB_TANK_ID, - INK_VAC_ID, - SPLASH_WALL_ID, - SPRINKLER_ID, - SQUID_BEAKON_ID, - SUPER_CHUMP_ID, - TORPEDO_ID, - TRIPLE_SPLASHDOWN_ID, - WAVE_BREAKER_ID, -} from "~/modules/in-game-lists/weapon-ids"; import { roundToNDecimalPlaces } from "~/utils/number"; import { metaTags } from "~/utils/remix"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/params/components/WeaponParamsTable.tsx b/apps/web-react/app/features/params/components/WeaponParamsTable.tsx index e21fe7a10..6ce2a8b1d 100644 --- a/apps/web-react/app/features/params/components/WeaponParamsTable.tsx +++ b/apps/web-react/app/features/params/components/WeaponParamsTable.tsx @@ -1,3 +1,8 @@ +import type { + MainWeaponId, + SpecialWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { ChartColumnBig, @@ -19,11 +24,6 @@ import { import { InfoPopover } from "~/components/InfoPopover"; import { translateDamageReceiver } from "~/features/object-damage-calculator/calculator-constants"; import type { DamageReceiver } from "~/features/object-damage-calculator/calculator-types"; -import type { - MainWeaponId, - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; import { useSearchParam } from "~/modules/search-params/hooks"; import { mySlugify, weaponParamsPage } from "~/utils/urls"; import { getParamExplanation } from "../core/param-explanations"; diff --git a/apps/web-react/app/features/params/components/WeaponParamsView.tsx b/apps/web-react/app/features/params/components/WeaponParamsView.tsx index be34b3dad..33da22b48 100644 --- a/apps/web-react/app/features/params/components/WeaponParamsView.tsx +++ b/apps/web-react/app/features/params/components/WeaponParamsView.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { useTranslation } from "react-i18next"; import { SendouTab, @@ -6,7 +7,6 @@ import { SendouTabs, } from "~/components/elements/Tabs"; import { Main } from "~/components/Main"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { useSearchParam } from "~/modules/search-params/hooks"; import { weaponParamsSearchParams } from "../params-search-params"; import type { diff --git a/apps/web-react/app/features/params/components/WeaponPatchHistory.tsx b/apps/web-react/app/features/params/components/WeaponPatchHistory.tsx index 8101f153f..8100a5a50 100644 --- a/apps/web-react/app/features/params/components/WeaponPatchHistory.tsx +++ b/apps/web-react/app/features/params/components/WeaponPatchHistory.tsx @@ -1,3 +1,8 @@ +import type { + MainWeaponId, + SpecialWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { Divider } from "~/components/Divider"; @@ -17,11 +22,6 @@ import { translateDamageReceiver, } from "~/features/object-damage-calculator/calculator-constants"; import type { DamageReceiver } from "~/features/object-damage-calculator/calculator-types"; -import type { - MainWeaponId, - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; import { useSearchParam } from "~/modules/search-params/hooks"; import * as WeaponParams from "../core/WeaponParams"; import { weaponParamsSearchParams } from "../params-search-params"; diff --git a/apps/web-react/app/features/params/core/WeaponParams.ts b/apps/web-react/app/features/params/core/WeaponParams.ts index dfcf8ec82..76701c69d 100644 --- a/apps/web-react/app/features/params/core/WeaponParams.ts +++ b/apps/web-react/app/features/params/core/WeaponParams.ts @@ -1,12 +1,12 @@ -import { PATCHES } from "~/features/builds/builds-constants"; -import { DAMAGE_RECEIVERS } from "~/features/object-damage-calculator/calculator-constants"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { mainWeaponIds, weaponCategories, weaponIdToBaseWeaponId, weaponIdToType, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { PATCHES } from "~/features/builds/builds-constants"; +import { DAMAGE_RECEIVERS } from "~/features/object-damage-calculator/calculator-constants"; import { DAMAGE_MULTIPLIER_PARAM_KEY, INCOMING_DAMAGE_MULTIPLIER_PARAM_KEY, diff --git a/apps/web-react/app/features/params/loaders/params.$slug.server.ts b/apps/web-react/app/features/params/loaders/params.$slug.server.ts index 520dcdaa4..17711b72f 100644 --- a/apps/web-react/app/features/params/loaders/params.$slug.server.ts +++ b/apps/web-react/app/features/params/loaders/params.$slug.server.ts @@ -1,17 +1,17 @@ -import type { LoaderFunctionArgs } from "react-router"; -import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; -import { getFixedTForLanguage } from "~/modules/i18n/i18next.server"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { specialWeaponIds, subWeaponIds, weaponIdToBaseWeaponId, weaponIdToType, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import type { LoaderFunctionArgs } from "react-router"; +import { mainWeaponParams } from "~/features/build-analyzer/core/utils"; +import { getFixedTForLanguage } from "~/modules/i18n/i18next.server"; import { specialWeaponNameSlugToId, subWeaponNameSlugToId, diff --git a/apps/web-react/app/features/params/params-search-params.ts b/apps/web-react/app/features/params/params-search-params.ts index 202cb784b..f58fab969 100644 --- a/apps/web-react/app/features/params/params-search-params.ts +++ b/apps/web-react/app/features/params/params-search-params.ts @@ -1,5 +1,5 @@ +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/params/routes/params.$slug.tsx b/apps/web-react/app/features/params/routes/params.$slug.tsx index 970764939..3b2d1b651 100644 --- a/apps/web-react/app/features/params/routes/params.$slug.tsx +++ b/apps/web-react/app/features/params/routes/params.$slug.tsx @@ -1,10 +1,10 @@ -import type { MetaFunction } from "react-router"; -import { useLoaderData } from "react-router"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import type { MetaFunction } from "react-router"; +import { useLoaderData } from "react-router"; import type { SerializeFrom } from "~/utils/remix"; import { metaTags } from "~/utils/remix"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/params/weapon-params-types.ts b/apps/web-react/app/features/params/weapon-params-types.ts index b156e204f..b3437ef2d 100644 --- a/apps/web-react/app/features/params/weapon-params-types.ts +++ b/apps/web-react/app/features/params/weapon-params-types.ts @@ -2,7 +2,7 @@ import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { ParamChangeKind } from "./core/param-directions"; export interface WeaponKitInfo { diff --git a/apps/web-react/app/features/scanner-ingest/core/Matches.test.ts b/apps/web-react/app/features/scanner-ingest/core/Matches.test.ts index 341f852af..ee5623fff 100644 --- a/apps/web-react/app/features/scanner-ingest/core/Matches.test.ts +++ b/apps/web-react/app/features/scanner-ingest/core/Matches.test.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; import type { ScannerMatch } from "~/features/scanner/core/scanner-match"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import * as Matches from "./Matches"; import { NAMES, diff --git a/apps/web-react/app/features/scanner-ingest/core/Scoreboards.test.ts b/apps/web-react/app/features/scanner-ingest/core/Scoreboards.test.ts index 68143b709..45984dad1 100644 --- a/apps/web-react/app/features/scanner-ingest/core/Scoreboards.test.ts +++ b/apps/web-react/app/features/scanner-ingest/core/Scoreboards.test.ts @@ -1,3 +1,9 @@ +import type { + AbilityWithUnknown, + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; import type { ScannerMatch, @@ -6,12 +12,6 @@ import type { ScannerMatchPlayerStatus, } from "~/features/scanner/core/scanner-match"; import type { ScannerLobby } from "~/features/scanner/scanner-types"; -import type { - AbilityWithUnknown, - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import * as Scoreboards from "./Scoreboards"; import { NAMES } from "./tests/fixtures"; diff --git a/apps/web-react/app/features/scanner-ingest/core/Scoreboards.ts b/apps/web-react/app/features/scanner-ingest/core/Scoreboards.ts index 14dae73ec..442df586b 100644 --- a/apps/web-react/app/features/scanner-ingest/core/Scoreboards.ts +++ b/apps/web-react/app/features/scanner-ingest/core/Scoreboards.ts @@ -1,15 +1,15 @@ +import type { + AbilityWithUnknown, + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import type { ScannerMatch, ScannerMatchObjective, ScannerMatchPlayerStatus, } from "~/features/scanner/core/scanner-match"; import type { ScannerLobby } from "~/features/scanner/scanner-types"; -import type { - AbilityWithUnknown, - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { databaseTimestampToJavascriptTimestamp } from "~/utils/dates"; import * as Matches from "./Matches"; diff --git a/apps/web-react/app/features/scanner-ingest/core/VodMatches.ts b/apps/web-react/app/features/scanner-ingest/core/VodMatches.ts index 95d01a8dd..1f5072a85 100644 --- a/apps/web-react/app/features/scanner-ingest/core/VodMatches.ts +++ b/apps/web-react/app/features/scanner-ingest/core/VodMatches.ts @@ -2,7 +2,7 @@ import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { IngestVodMatchInput } from "../scanner-ingest-vod-schemas"; export interface PrefillVodMatch { diff --git a/apps/web-react/app/features/scanner-ingest/core/tests/fixtures.ts b/apps/web-react/app/features/scanner-ingest/core/tests/fixtures.ts index cdcb6132d..94fac9427 100644 --- a/apps/web-react/app/features/scanner-ingest/core/tests/fixtures.ts +++ b/apps/web-react/app/features/scanner-ingest/core/tests/fixtures.ts @@ -1,8 +1,8 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { ScannerMatch, ScannerMatchPlayer, } from "~/features/scanner/core/scanner-match"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; /** In-game names of the default roster, winners first. */ export const NAMES = ["w1", "w2", "w3", "w4", "l1", "l2", "l3", "l4"]; diff --git a/apps/web-react/app/features/scanner-ingest/tests/harness.ts b/apps/web-react/app/features/scanner-ingest/tests/harness.ts index 084d58a69..661a356bb 100644 --- a/apps/web-react/app/features/scanner-ingest/tests/harness.ts +++ b/apps/web-react/app/features/scanner-ingest/tests/harness.ts @@ -3,6 +3,12 @@ * ingest wrapper (act), page-loader wrappers and row fetchers (assert). * Cases import only from here, plus vitest. See README.md for the design. */ + +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import { addHours, addMinutes, subDays, subMinutes } from "date-fns"; import * as R from "remeda"; import { afterAll, beforeAll } from "vitest"; @@ -24,11 +30,6 @@ import { type TournamentMatchLoaderData, loader as tournamentMatchLoader, } from "~/features/tournament-match/loaders/to.$id.matches.$mid.server"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { databaseTimestampToJavascriptTimestamp } from "~/utils/dates"; import invariant from "~/utils/invariant"; import { wrappedAction, wrappedLoader } from "~/utils/Test"; diff --git a/apps/web-react/app/features/scanner/components/AbilityGrid.tsx b/apps/web-react/app/features/scanner/components/AbilityGrid.tsx index b669a2a39..6d0c3467d 100644 --- a/apps/web-react/app/features/scanner/components/AbilityGrid.tsx +++ b/apps/web-react/app/features/scanner/components/AbilityGrid.tsx @@ -3,10 +3,10 @@ * shared by the death card and the scoreboard player popover. */ +import type { AbilityWithUnknown } from "@sendou/in-game-lists/types"; import { Button } from "react-aria-components"; import { Ability } from "~/components/Ability"; import { SendouPopover } from "~/components/elements/Popover"; -import type { AbilityWithUnknown } from "~/modules/in-game-lists/types"; import styles from "./AbilityGrid.module.css"; import eventCardStyles from "./EventCard.module.css"; diff --git a/apps/web-react/app/features/scanner/components/DeathCard.tsx b/apps/web-react/app/features/scanner/components/DeathCard.tsx index 58cd4539a..9d1291beb 100644 --- a/apps/web-react/app/features/scanner/components/DeathCard.tsx +++ b/apps/web-react/app/features/scanner/components/DeathCard.tsx @@ -1,7 +1,7 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Ability } from "~/components/Ability"; import { WeaponImage } from "~/components/Image"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { DEATH_EVENT_TYPE, type DeathData, diff --git a/apps/web-react/app/features/scanner/components/MatchCard.tsx b/apps/web-react/app/features/scanner/components/MatchCard.tsx index 08f134cac..e529f35f2 100644 --- a/apps/web-react/app/features/scanner/components/MatchCard.tsx +++ b/apps/web-react/app/features/scanner/components/MatchCard.tsx @@ -5,6 +5,7 @@ * so the raw per-event view stays one click away. */ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { ChevronDown } from "lucide-react"; import type * as React from "react"; @@ -14,7 +15,6 @@ import { ModeImage, WeaponImage } from "~/components/Image"; import { matchScoresFromObjective } from "~/components/objective-timeline-utils"; import { StageBannerBox } from "~/components/StageBannerBox"; import type { IngestedMatchLink } from "~/features/scanner-ingest/scanner-ingest-schemas"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { sendouQMatchPage, tournamentMatchPage } from "~/utils/urls"; import type { IngestSkipReason } from "../core/match-builder"; import type { ScannerMatch } from "../core/scanner-match"; diff --git a/apps/web-react/app/features/scanner/components/MinimapCard.tsx b/apps/web-react/app/features/scanner/components/MinimapCard.tsx index aa3c55158..d73456b56 100644 --- a/apps/web-react/app/features/scanner/components/MinimapCard.tsx +++ b/apps/web-react/app/features/scanner/components/MinimapCard.tsx @@ -1,9 +1,9 @@ +import type { AbilityWithUnknown } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { ChevronUp } from "lucide-react"; import type { ReactNode } from "react"; import { Ability } from "~/components/Ability"; import { WeaponImage } from "~/components/Image"; -import type { AbilityWithUnknown } from "~/modules/in-game-lists/types"; import { MINIMAP_EVENT_TYPE, type MinimapData, diff --git a/apps/web-react/app/features/scanner/components/ScreenshotPage.tsx b/apps/web-react/app/features/scanner/components/ScreenshotPage.tsx index 87c6fa6e8..2fcc360f1 100644 --- a/apps/web-react/app/features/scanner/components/ScreenshotPage.tsx +++ b/apps/web-react/app/features/scanner/components/ScreenshotPage.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { type ReactNode, @@ -6,7 +7,6 @@ import { useRef, useState, } from "react"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { useSearchParam } from "~/modules/search-params/hooks"; import { mainWeaponImageUrl } from "~/utils/urls"; import { CANONICAL_HEIGHT, CANONICAL_WIDTH, type Roi } from "../core/canonical"; diff --git a/apps/web-react/app/features/scanner/components/events-csv.ts b/apps/web-react/app/features/scanner/components/events-csv.ts index 3586ff4f1..1608fff06 100644 --- a/apps/web-react/app/features/scanner/components/events-csv.ts +++ b/apps/web-react/app/features/scanner/components/events-csv.ts @@ -6,7 +6,7 @@ * into one cell, matching the compact per-event view of the live feed. */ -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { DEATH_EVENT_TYPE, type DeathData, diff --git a/apps/web-react/app/features/scanner/components/labels.ts b/apps/web-react/app/features/scanner/components/labels.ts index 2d0148be9..4f3363843 100644 --- a/apps/web-react/app/features/scanner/components/labels.ts +++ b/apps/web-react/app/features/scanner/components/labels.ts @@ -11,7 +11,7 @@ import type { SpecialWeaponId, StageId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import gameMisc from "../../../../locales/en/game-misc.json"; import { ALL_WEAPON_ENTRIES, diff --git a/apps/web-react/app/features/scanner/components/sendou-upload.ts b/apps/web-react/app/features/scanner/components/sendou-upload.ts index 9ace0e1cf..fb907e025 100644 --- a/apps/web-react/app/features/scanner/components/sendou-upload.ts +++ b/apps/web-react/app/features/scanner/components/sendou-upload.ts @@ -12,13 +12,14 @@ * flagged `modeAssumed` — the fabricated default lives here, not on * ScannerMatch. */ + +import type { MainWeaponId, ModeShort } from "@sendou/in-game-lists/types"; import type { IngestVodMatchInput, IngestVodPrefill, } from "~/features/scanner-ingest/scanner-ingest-vod-schemas"; import { vodsNewSearchParams } from "~/features/vods/vods-search-params"; import { newVodPage } from "~/features/vods/vods-urls"; -import type { MainWeaponId, ModeShort } from "~/modules/in-game-lists/types"; import type { DetectedEvent } from "../core/detectors/types"; import { buildScannerMatches } from "../core/match-builder"; import type { ScannerMatch } from "../core/scanner-match"; diff --git a/apps/web-react/app/features/scanner/core/ability-harvest.ts b/apps/web-react/app/features/scanner/core/ability-harvest.ts index 8c8ef049d..4511c0b98 100644 --- a/apps/web-react/app/features/scanner/core/ability-harvest.ts +++ b/apps/web-react/app/features/scanner/core/ability-harvest.ts @@ -10,7 +10,7 @@ import type { AbilityWithUnknown, MainWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { DEATH_EVENT_TYPE, type DeathData } from "./detectors/death/index"; import { SCOREBOARD_EVENT_TYPES } from "./detectors/registry"; import type { ScoreboardData } from "./detectors/scoreboard/index"; diff --git a/apps/web-react/app/features/scanner/core/detectors/death/index.ts b/apps/web-react/app/features/scanner/core/detectors/death/index.ts index 0136d934f..be7767390 100644 --- a/apps/web-react/app/features/scanner/core/detectors/death/index.ts +++ b/apps/web-react/app/features/scanner/core/detectors/death/index.ts @@ -16,7 +16,7 @@ import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { toAbilityWithUnknown } from "../../../scanner-types"; import { getCV, type Mat, minMaxLoc } from "../../cv"; import { diff --git a/apps/web-react/app/features/scanner/core/detectors/map-start/index.ts b/apps/web-react/app/features/scanner/core/detectors/map-start/index.ts index 2fbb18912..8379e2644 100644 --- a/apps/web-react/app/features/scanner/core/detectors/map-start/index.ts +++ b/apps/web-react/app/features/scanner/core/detectors/map-start/index.ts @@ -14,7 +14,7 @@ * min channel (drops blue-tinted water gray keeps) under several * binarizations, keeping the best-snapping one (see rois.ts). */ -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { getCV, type Mat, minMaxLoc } from "../../cv"; import { type GlyphSet, diff --git a/apps/web-react/app/features/scanner/core/detectors/minimap/index.ts b/apps/web-react/app/features/scanner/core/detectors/minimap/index.ts index 01740410c..59d35720f 100644 --- a/apps/web-react/app/features/scanner/core/detectors/minimap/index.ts +++ b/apps/web-react/app/features/scanner/core/detectors/minimap/index.ts @@ -26,7 +26,7 @@ import type { AbilityWithUnknown, MainWeaponId, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { toAbilityWithUnknown, toMainWeaponId } from "../../../scanner-types"; import { getCV, type Mat } from "../../cv"; import { type GlyphSet, scaleGlyphSet } from "../../glyphs"; diff --git a/apps/web-react/app/features/scanner/core/detectors/minimap/stage.ts b/apps/web-react/app/features/scanner/core/detectors/minimap/stage.ts index ace2d744d..7ee4d4bb1 100644 --- a/apps/web-react/app/features/scanner/core/detectors/minimap/stage.ts +++ b/apps/web-react/app/features/scanner/core/detectors/minimap/stage.ts @@ -15,7 +15,7 @@ * renders per stage and reports only the winning tile's stage; mode comes * from map-start/scoreboard header instead. */ -import type { StageId } from "~/modules/in-game-lists/types"; +import type { StageId } from "@sendou/in-game-lists/types"; import { getCV, type Mat } from "../../cv"; import type { FrameData } from "../../image"; diff --git a/apps/web-react/app/features/scanner/core/detectors/objective/strip-weapons.ts b/apps/web-react/app/features/scanner/core/detectors/objective/strip-weapons.ts index b02209139..4f9a9bb67 100644 --- a/apps/web-react/app/features/scanner/core/detectors/objective/strip-weapons.ts +++ b/apps/web-react/app/features/scanner/core/detectors/objective/strip-weapons.ts @@ -20,7 +20,7 @@ * candidate list per slot. Splatted slots grey the render out and are * skipped rather than guessed. */ -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { getCV, type Mat } from "../../cv"; import { copyRoi } from "../../image"; import { hueDistance, hueOf } from "../../ink-color"; diff --git a/apps/web-react/app/features/scanner/core/detectors/scoreboard-battle-log-replay/header.ts b/apps/web-react/app/features/scanner/core/detectors/scoreboard-battle-log-replay/header.ts index 1fc872ec3..c6bd71fa3 100644 --- a/apps/web-react/app/features/scanner/core/detectors/scoreboard-battle-log-replay/header.ts +++ b/apps/web-react/app/features/scanner/core/detectors/scoreboard-battle-log-replay/header.ts @@ -8,7 +8,7 @@ * shape and kept as a raw string; stage and lobby+mode snap to the closed * sets shared with the live header. */ -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../../../scanner-types"; import type { Roi } from "../../canonical"; import type { Mat } from "../../cv"; diff --git a/apps/web-react/app/features/scanner/core/detectors/scoreboard-own/index.ts b/apps/web-react/app/features/scanner/core/detectors/scoreboard-own/index.ts index 3954e28ac..94df27b29 100644 --- a/apps/web-react/app/features/scanner/core/detectors/scoreboard-own/index.ts +++ b/apps/web-react/app/features/scanner/core/detectors/scoreboard-own/index.ts @@ -16,7 +16,7 @@ import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { type ScannerLobby, toAbilityWithUnknown, diff --git a/apps/web-react/app/features/scanner/core/detectors/scoreboard/header.ts b/apps/web-react/app/features/scanner/core/detectors/scoreboard/header.ts index 03c7bd307..2b0ff173d 100644 --- a/apps/web-react/app/features/scanner/core/detectors/scoreboard/header.ts +++ b/apps/web-react/app/features/scanner/core/detectors/scoreboard/header.ts @@ -8,7 +8,7 @@ * line and snapped against every language's mode × stage combos * (core/localized.ts) — reported values are always sendou.ink ids. */ -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../../../scanner-types"; import { getCV, type Mat } from "../../cv"; import { diff --git a/apps/web-react/app/features/scanner/core/detectors/scoreboard/index.ts b/apps/web-react/app/features/scanner/core/detectors/scoreboard/index.ts index 0e9ae892c..aef443703 100644 --- a/apps/web-react/app/features/scanner/core/detectors/scoreboard/index.ts +++ b/apps/web-react/app/features/scanner/core/detectors/scoreboard/index.ts @@ -6,7 +6,7 @@ import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../../../scanner-types"; import { getCV, type Mat } from "../../cv"; import { type GlyphSet, scaleGlyphSet } from "../../glyphs"; diff --git a/apps/web-react/app/features/scanner/core/detectors/scoreboard/kits.ts b/apps/web-react/app/features/scanner/core/detectors/scoreboard/kits.ts index 4705a6b48..2077f6007 100644 --- a/apps/web-react/app/features/scanner/core/detectors/scoreboard/kits.ts +++ b/apps/web-react/app/features/scanner/core/detectors/scoreboard/kits.ts @@ -6,11 +6,9 @@ * near-tied weapon icon matches be disambiguated by kit. The minimap's * sub-tile disambiguation (assets/cv/sub-weapons) reads `sub` the same way. */ + +import type { SpecialWeaponId, SubWeaponId } from "@sendou/in-game-lists/types"; import { weaponParams } from "~/features/build-analyzer/data/weapon-params"; -import type { - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; export interface WeaponKit { /** sendou.ink sub weapon id */ diff --git a/apps/web-react/app/features/scanner/core/localized-entries.ts b/apps/web-react/app/features/scanner/core/localized-entries.ts index 0c9b07242..085ffadf3 100644 --- a/apps/web-react/app/features/scanner/core/localized-entries.ts +++ b/apps/web-react/app/features/scanner/core/localized-entries.ts @@ -5,7 +5,7 @@ * mapped to the sendou.ink id it means (core/localized.ts derives the * flattened match sets detectors snap OCR output against). */ -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../scanner-types"; export interface LocalizedLobby { diff --git a/apps/web-react/app/features/scanner/core/localized.ts b/apps/web-react/app/features/scanner/core/localized.ts index df2f1ac80..a3c9c8382 100644 --- a/apps/web-react/app/features/scanner/core/localized.ts +++ b/apps/web-react/app/features/scanner/core/localized.ts @@ -7,7 +7,7 @@ * languages — which keeps the cross product from inventing pairings no UI * would show. */ -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../scanner-types"; import { LANGUAGE_ENTRIES, diff --git a/apps/web-react/app/features/scanner/core/match-builder.ts b/apps/web-react/app/features/scanner/core/match-builder.ts index e45b0d484..4f2d51156 100644 --- a/apps/web-react/app/features/scanner/core/match-builder.ts +++ b/apps/web-react/app/features/scanner/core/match-builder.ts @@ -10,7 +10,7 @@ * `ingestSkipReasons` filters those. Deaths are harvested onto player rows * as enemy builds (ability-harvest.ts). */ -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import { harvestAbilities } from "./ability-harvest"; import { DEATH_EVENT_TYPE, type DeathData } from "./detectors/death/index"; import { diff --git a/apps/web-react/app/features/scanner/core/resources.ts b/apps/web-react/app/features/scanner/core/resources.ts index 3e7a9b752..3080a34a3 100644 --- a/apps/web-react/app/features/scanner/core/resources.ts +++ b/apps/web-react/app/features/scanner/core/resources.ts @@ -9,12 +9,12 @@ * builds alone are ~7k resizes) dominated startup. */ -import { abilities as abilityList } from "~/modules/in-game-lists/abilities"; +import { abilities as abilityList } from "@sendou/in-game-lists/abilities"; import { mainWeaponIds, specialWeaponIds, subWeaponIds, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; import { prepareAbilityTemplates } from "./detectors/death/abilities"; import { BURST_ICON_TEMPLATE_SIZES } from "./detectors/death/rois"; import { prepareMinimapAbilityTemplates } from "./detectors/minimap/abilities"; diff --git a/apps/web-react/app/features/scanner/core/scanner-match.ts b/apps/web-react/app/features/scanner/core/scanner-match.ts index 697cf017f..3c19c5872 100644 --- a/apps/web-react/app/features/scanner/core/scanner-match.ts +++ b/apps/web-react/app/features/scanner/core/scanner-match.ts @@ -10,7 +10,7 @@ import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../scanner-types"; export interface ScannerMatchPlayer { diff --git a/apps/web-react/app/features/scanner/core/slot-row-assignment.ts b/apps/web-react/app/features/scanner/core/slot-row-assignment.ts index a80a1211f..85bc35635 100644 --- a/apps/web-react/app/features/scanner/core/slot-row-assignment.ts +++ b/apps/web-react/app/features/scanner/core/slot-row-assignment.ts @@ -19,7 +19,7 @@ * keep their as-drawn relative order, and thin evidence degrades to the * as-drawn arrangement rather than a coin flip. */ -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; /** A slot→row permutation: `perm[slot]` is the scoreboard row the slot feeds. */ export type SlotRowPermutation = readonly [number, number, number, number]; diff --git a/apps/web-react/app/features/scanner/node/fixtures.ts b/apps/web-react/app/features/scanner/node/fixtures.ts index 9c4ad8996..69b7aa89e 100644 --- a/apps/web-react/app/features/scanner/node/fixtures.ts +++ b/apps/web-react/app/features/scanner/node/fixtures.ts @@ -12,7 +12,7 @@ import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { ScoreboardData } from "../core/detectors/scoreboard/index"; import type { DetectedEvent, diff --git a/apps/web-react/app/features/scanner/scanner-schemas.ts b/apps/web-react/app/features/scanner/scanner-schemas.ts index 5b39b9083..cbacdbd2d 100644 --- a/apps/web-react/app/features/scanner/scanner-schemas.ts +++ b/apps/web-react/app/features/scanner/scanner-schemas.ts @@ -9,12 +9,13 @@ * the other way), so zod never enters the worker bundle; runtime validation * happens at the boundaries (ingest action, prefill loader). */ + +import { abilities } from "@sendou/in-game-lists/abilities"; +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { Ability } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; -import { abilities } from "~/modules/in-game-lists/abilities"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { Ability } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import type { ScannerMatch, ScannerMatchObjective, diff --git a/apps/web-react/app/features/scanner/scanner-types.ts b/apps/web-react/app/features/scanner/scanner-types.ts index c127dc6b7..4a65302af 100644 --- a/apps/web-react/app/features/scanner/scanner-types.ts +++ b/apps/web-react/app/features/scanner/scanner-types.ts @@ -4,13 +4,13 @@ * Ability) — canonical English strings live only inside the OCR snap * layer and never leave a detector. */ -import { abilities } from "~/modules/in-game-lists/abilities"; +import { abilities } from "@sendou/in-game-lists/abilities"; import type { Ability, AbilityWithUnknown, MainWeaponId, -} from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; /** The scoreboard header's lobby tag. PRIVATE marks tournament games. */ export const SCANNER_LOBBIES = ["X", "SERIES", "OPEN", "PRIVATE"] as const; diff --git a/apps/web-react/app/features/scanner/tests/ability-harvest.test.ts b/apps/web-react/app/features/scanner/tests/ability-harvest.test.ts index c758e5fd8..296f44163 100644 --- a/apps/web-react/app/features/scanner/tests/ability-harvest.test.ts +++ b/apps/web-react/app/features/scanner/tests/ability-harvest.test.ts @@ -9,7 +9,7 @@ import assert from "node:assert/strict"; import type { AbilityWithUnknown, MainWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { connectAbilities } from "../core/ability-harvest"; import { DEATH_EVENT_TYPE, diff --git a/apps/web-react/app/features/scanner/tests/logic/dedupe-events.test.ts b/apps/web-react/app/features/scanner/tests/logic/dedupe-events.test.ts index 1bc72fddc..925ce236b 100644 --- a/apps/web-react/app/features/scanner/tests/logic/dedupe-events.test.ts +++ b/apps/web-react/app/features/scanner/tests/logic/dedupe-events.test.ts @@ -3,7 +3,7 @@ import type { AbilityWithUnknown, MainWeaponId, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { withoutRepeatEvents } from "../../components/dedupe-events"; import type { DeathData } from "../../core/detectors/death/index"; import type { diff --git a/apps/web-react/app/features/scanner/tests/logic/match-builder.test.ts b/apps/web-react/app/features/scanner/tests/logic/match-builder.test.ts index fc68a4bb5..e55c58d7c 100644 --- a/apps/web-react/app/features/scanner/tests/logic/match-builder.test.ts +++ b/apps/web-react/app/features/scanner/tests/logic/match-builder.test.ts @@ -4,7 +4,7 @@ import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import type { DeathData } from "../../core/detectors/death/index"; import type { MinimapData, diff --git a/apps/web-react/app/features/scanner/tests/sendou-upload.test.ts b/apps/web-react/app/features/scanner/tests/sendou-upload.test.ts index 4135fdb77..cf13c7847 100644 --- a/apps/web-react/app/features/scanner/tests/sendou-upload.test.ts +++ b/apps/web-react/app/features/scanner/tests/sendou-upload.test.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { vodsNewSearchParams } from "~/features/vods/vods-search-params"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { sendouUpload } from "../components/sendou-upload"; import type { MinimapData } from "../core/detectors/minimap/index"; import type { ScoreboardData } from "../core/detectors/scoreboard/index"; diff --git a/apps/web-react/app/features/scanner/tests/strip-weapons.test.ts b/apps/web-react/app/features/scanner/tests/strip-weapons.test.ts index f41db5957..6d74d51f0 100644 --- a/apps/web-react/app/features/scanner/tests/strip-weapons.test.ts +++ b/apps/web-react/app/features/scanner/tests/strip-weapons.test.ts @@ -10,7 +10,7 @@ */ import assert from "node:assert/strict"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { loadOpenCV } from "../core/cv"; import { createObjectiveDetector } from "../core/detectors/objective/index"; import { diff --git a/apps/web-react/app/features/scrims/ScrimMapListRepository.server.ts b/apps/web-react/app/features/scrims/ScrimMapListRepository.server.ts index 4a0617e78..e63e2101c 100644 --- a/apps/web-react/app/features/scrims/ScrimMapListRepository.server.ts +++ b/apps/web-react/app/features/scrims/ScrimMapListRepository.server.ts @@ -1,8 +1,8 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Transaction } from "kysely"; import { db } from "~/db/sql"; import type { DB, TablesInsertable } from "~/db/tables"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { databaseTimestampNow } from "~/utils/dates"; import { jsonArrayFrom } from "~/utils/kysely.server"; import * as ScrimMapRepository from "./ScrimMapRepository.server"; diff --git a/apps/web-react/app/features/scrims/ScrimMapRepository.server.ts b/apps/web-react/app/features/scrims/ScrimMapRepository.server.ts index 1310395c6..f624dc18d 100644 --- a/apps/web-react/app/features/scrims/ScrimMapRepository.server.ts +++ b/apps/web-react/app/features/scrims/ScrimMapRepository.server.ts @@ -1,8 +1,8 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Transaction } from "kysely"; import { db } from "~/db/sql"; import type { DB, TablesInsertable } from "~/db/tables"; import { actorId } from "~/features/auth/core/user.server"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { databaseTimestampNow } from "~/utils/dates"; import * as Scrim from "./core/Scrim"; import * as ScrimMapByMap from "./core/ScrimMapByMap"; diff --git a/apps/web-react/app/features/scrims/components/ScrimCard.tsx b/apps/web-react/app/features/scrims/components/ScrimCard.tsx index c5101b2ee..c1db1fa82 100644 --- a/apps/web-react/app/features/scrims/components/ScrimCard.tsx +++ b/apps/web-react/app/features/scrims/components/ScrimCard.tsx @@ -1,3 +1,4 @@ +import type { ModeShort } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { formatDistance } from "date-fns"; import { @@ -29,7 +30,6 @@ import { useUserCardData, } from "~/features/user-card/components/UserCard"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; -import type { ModeShort } from "~/modules/in-game-lists/types"; import { useSearchParam } from "~/modules/search-params/hooks"; import { databaseTimestampToDate } from "~/utils/dates"; import { scrimPage, tournamentRegisterPage } from "~/utils/urls"; diff --git a/apps/web-react/app/features/scrims/components/ScrimMatchStatsTab.tsx b/apps/web-react/app/features/scrims/components/ScrimMatchStatsTab.tsx index e090f50c0..777562a37 100644 --- a/apps/web-react/app/features/scrims/components/ScrimMatchStatsTab.tsx +++ b/apps/web-react/app/features/scrims/components/ScrimMatchStatsTab.tsx @@ -1,3 +1,4 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { useLoaderData } from "react-router"; @@ -11,7 +12,6 @@ import { ModeImage, StageImage } from "~/components/Image"; import { TAB_KEYS } from "~/components/match-page/MatchTabs"; import { Table } from "~/components/Table"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import * as ScrimMapByMap from "../core/ScrimMapByMap"; import type { loader } from "../loaders/scrims.$id.server"; import styles from "./ScrimMatchStatsTab.module.css"; diff --git a/apps/web-react/app/features/scrims/core/ScrimMapByMap.test.ts b/apps/web-react/app/features/scrims/core/ScrimMapByMap.test.ts index d793b23b3..34f0f97ae 100644 --- a/apps/web-react/app/features/scrims/core/ScrimMapByMap.test.ts +++ b/apps/web-react/app/features/scrims/core/ScrimMapByMap.test.ts @@ -1,8 +1,8 @@ +import { stagesObj } from "@sendou/in-game-lists/stage-ids"; +import type { StageId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; import type { Tables } from "~/db/tables"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; -import { stagesObj } from "~/modules/in-game-lists/stage-ids"; -import type { StageId } from "~/modules/in-game-lists/types"; import { canUndo, generateNextMap, stats, unionPool } from "./ScrimMapByMap"; type MapRow = Pick< diff --git a/apps/web-react/app/features/scrims/core/ScrimMapByMap.ts b/apps/web-react/app/features/scrims/core/ScrimMapByMap.ts index d0b7d6224..108925084 100644 --- a/apps/web-react/app/features/scrims/core/ScrimMapByMap.ts +++ b/apps/web-react/app/features/scrims/core/ScrimMapByMap.ts @@ -1,9 +1,9 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; import * as MapList from "~/features/map-list-generator/core/MapList"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import type { MapPoolObject } from "~/features/map-list-generator/core/map-pool-serializer/types"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; type ResolvedMapListRow = { mapList: Array<{ mode: ModeShort; stageId: StageId }>; diff --git a/apps/web-react/app/features/scrims/scrims-schemas.ts b/apps/web-react/app/features/scrims/scrims-schemas.ts index 5ccd08000..4491f01bc 100644 --- a/apps/web-react/app/features/scrims/scrims-schemas.ts +++ b/apps/web-react/app/features/scrims/scrims-schemas.ts @@ -1,3 +1,4 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import { add, sub } from "date-fns"; import { z } from "zod"; import { @@ -17,7 +18,6 @@ import { toggle, tournamentSearchOptional, } from "~/form/fields"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { _action, date, diff --git a/apps/web-react/app/features/sendouq-match/PlayerStatRepository.server.ts b/apps/web-react/app/features/sendouq-match/PlayerStatRepository.server.ts index 8a99943b4..233ee6fa7 100644 --- a/apps/web-react/app/features/sendouq-match/PlayerStatRepository.server.ts +++ b/apps/web-react/app/features/sendouq-match/PlayerStatRepository.server.ts @@ -1,3 +1,4 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { type ExpressionBuilder, type NotNull, @@ -7,7 +8,6 @@ import { import * as R from "remeda"; import { db } from "~/db/sql"; import type { DB, Tables } from "~/db/tables"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { commonUserJsonObject, jsonArrayFrom, diff --git a/apps/web-react/app/features/sendouq-match/ReportedWeaponRepository.server.ts b/apps/web-react/app/features/sendouq-match/ReportedWeaponRepository.server.ts index d445f9440..01d5f9ee8 100644 --- a/apps/web-react/app/features/sendouq-match/ReportedWeaponRepository.server.ts +++ b/apps/web-react/app/features/sendouq-match/ReportedWeaponRepository.server.ts @@ -1,13 +1,13 @@ +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import type { NotNull, Transaction } from "kysely"; import { db } from "~/db/sql"; import type { DB, Tables, TablesInsertable } from "~/db/tables"; import { actorId } from "~/features/auth/core/user.server"; import * as Seasons from "~/features/mmr/core/Seasons"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import { assertUnreachable } from "~/utils/types"; diff --git a/apps/web-react/app/features/sendouq-match/components/SendouQMatchActionTab.tsx b/apps/web-react/app/features/sendouq-match/components/SendouQMatchActionTab.tsx index 864a9e250..14b5cff6b 100644 --- a/apps/web-react/app/features/sendouq-match/components/SendouQMatchActionTab.tsx +++ b/apps/web-react/app/features/sendouq-match/components/SendouQMatchActionTab.tsx @@ -1,3 +1,4 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { TFunction } from "i18next"; import { Ban, Check, Undo2, X } from "lucide-react"; import { useTranslation } from "react-i18next"; @@ -16,7 +17,6 @@ import { useUser } from "~/features/auth/core/user"; import { FormField } from "~/form/FormField"; import { SendouForm } from "~/form/SendouForm"; import { useActionSubmit } from "~/hooks/useActionSubmit"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { resolveGroupNames, resolveTimelineMaps, diff --git a/apps/web-react/app/features/sendouq-match/core/match.server.test.ts b/apps/web-react/app/features/sendouq-match/core/match.server.test.ts index 50945ae82..c2fbcf8c2 100644 --- a/apps/web-react/app/features/sendouq-match/core/match.server.test.ts +++ b/apps/web-react/app/features/sendouq-match/core/match.server.test.ts @@ -1,5 +1,5 @@ +import type { StageId } from "@sendou/in-game-lists/types"; import { afterEach, describe, expect, test, vi } from "vitest"; -import type { StageId } from "~/modules/in-game-lists/types"; import * as Test from "~/utils/Test"; import { mapModePreferencesToModeList, diff --git a/apps/web-react/app/features/sendouq-match/core/match.server.ts b/apps/web-react/app/features/sendouq-match/core/match.server.ts index d072cd62e..a142d25d7 100644 --- a/apps/web-react/app/features/sendouq-match/core/match.server.ts +++ b/apps/web-react/app/features/sendouq-match/core/match.server.ts @@ -1,3 +1,5 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, ModeWithStage } from "@sendou/in-game-lists/types"; import * as R from "remeda"; import type { ParsedMemento, UserMapModePreferences } from "~/db/tables-json"; import * as MapList from "~/features/map-list-generator/core/MapList"; @@ -14,8 +16,6 @@ import type { SQUncensoredGroup, } from "~/features/sendouq/core/SendouQ.server"; import { SENDOUQ_BEST_OF } from "~/features/sendouq/q-constants"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, ModeWithStage } from "~/modules/in-game-lists/types"; import type { TournamentMapListMap, TournamentMaplistSource, diff --git a/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.test.ts b/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.test.ts index e15cf22fe..701b7a9af 100644 --- a/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.test.ts +++ b/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.test.ts @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { mergeReportedWeapons } from "./reported-weapons.server"; describe("mergeReportedWeapons()", () => { diff --git a/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.ts b/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.ts index 6aa2cac5e..3dbf403ae 100644 --- a/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.ts +++ b/apps/web-react/app/features/sendouq-match/core/reported-weapons.server.ts @@ -1,4 +1,4 @@ -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; export type ReportedWeaponForMerging = { weaponSplId?: MainWeaponId; diff --git a/apps/web-react/app/features/sendouq-match/core/summarizer.server.ts b/apps/web-react/app/features/sendouq-match/core/summarizer.server.ts index 61eade45c..6ad109b02 100644 --- a/apps/web-react/app/features/sendouq-match/core/summarizer.server.ts +++ b/apps/web-react/app/features/sendouq-match/core/summarizer.server.ts @@ -1,5 +1,5 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { winnersArrayToWinner } from "../q-match-utils"; type MatchForSummarizing = { diff --git a/apps/web-react/app/features/sendouq/components/GroupCard.tsx b/apps/web-react/app/features/sendouq/components/GroupCard.tsx index 0a6ea8005..b9a54ce9b 100644 --- a/apps/web-react/app/features/sendouq/components/GroupCard.tsx +++ b/apps/web-react/app/features/sendouq/components/GroupCard.tsx @@ -1,3 +1,4 @@ +import { SPLATTERCOLOR_SCREEN_ID } from "@sendou/in-game-lists/weapon-ids"; import clsx from "clsx"; import type { SqlBool } from "kysely"; import { Check, Hourglass, Mic, Volume2, VolumeX } from "lucide-react"; @@ -22,7 +23,6 @@ import { } from "~/features/user-card/components/UserCard"; import { SendouForm } from "~/form/SendouForm"; import { languagesUnified } from "~/modules/i18n/config"; -import { SPLATTERCOLOR_SCREEN_ID } from "~/modules/in-game-lists/weapon-ids"; import { nullFilledArray } from "~/utils/arrays"; import { inGameNameWithoutDiscriminator } from "~/utils/strings"; import { diff --git a/apps/web-react/app/features/sendouq/core/SendouQ.server.test.ts b/apps/web-react/app/features/sendouq/core/SendouQ.server.test.ts index 88dfed20b..b8e5ca5d9 100644 --- a/apps/web-react/app/features/sendouq/core/SendouQ.server.test.ts +++ b/apps/web-react/app/features/sendouq/core/SendouQ.server.test.ts @@ -1,3 +1,4 @@ +import type { ModeShort } from "@sendou/in-game-lists/types"; import { subSeconds } from "date-fns"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { backdate } from "~/db/seed/core/backdate"; @@ -12,7 +13,6 @@ import { freshUserSkills, refreshUserSkills, } from "~/features/mmr/tiered.server"; -import type { ModeShort } from "~/modules/in-game-lists/types"; import * as SQGroupRepository from "../SQGroupRepository.server"; import { refreshSendouQInstance, SendouQ } from "./SendouQ.server"; diff --git a/apps/web-react/app/features/sendouq/core/SendouQ.server.ts b/apps/web-react/app/features/sendouq/core/SendouQ.server.ts index 4dd066153..9284434a4 100644 --- a/apps/web-react/app/features/sendouq/core/SendouQ.server.ts +++ b/apps/web-react/app/features/sendouq/core/SendouQ.server.ts @@ -1,3 +1,5 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort } from "@sendou/in-game-lists/types"; import { isWithinInterval, sub } from "date-fns"; import { redirect } from "react-router"; import * as R from "remeda"; @@ -10,8 +12,6 @@ import { type TieredSkill, userSkills } from "~/features/mmr/tiered.server"; import * as SQGroupRepository from "~/features/sendouq/SQGroupRepository.server"; import * as SendouQMatch from "~/features/sendouq-match/core/SendouQMatch"; import type * as SQMatchRepository from "~/features/sendouq-match/SQMatchRepository.server"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort } from "~/modules/in-game-lists/types"; import { databaseTimestampToDate } from "~/utils/dates"; import { IS_E2E_TEST_RUN } from "~/utils/e2e"; import type { SerializeFrom } from "~/utils/remix"; diff --git a/apps/web-react/app/features/sendouq/core/default-maps.server.test.ts b/apps/web-react/app/features/sendouq/core/default-maps.server.test.ts index efcf0bbf9..188967d7b 100644 --- a/apps/web-react/app/features/sendouq/core/default-maps.server.test.ts +++ b/apps/web-react/app/features/sendouq/core/default-maps.server.test.ts @@ -1,9 +1,9 @@ +import type { StageId } from "@sendou/in-game-lists/types"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import * as SkillFactory from "~/db/seed/factories/SkillFactory"; import * as UserFactory from "~/db/seed/factories/UserFactory"; import { db } from "~/db/sql"; import type { UserMapModePreferences } from "~/db/tables-json"; -import type { StageId } from "~/modules/in-game-lists/types"; import { SENDOUQ_BEST_OF } from "../q-constants"; import { clearCacheForTesting, diff --git a/apps/web-react/app/features/sendouq/core/default-maps.server.ts b/apps/web-react/app/features/sendouq/core/default-maps.server.ts index 26547df26..e81946601 100644 --- a/apps/web-react/app/features/sendouq/core/default-maps.server.ts +++ b/apps/web-react/app/features/sendouq/core/default-maps.server.ts @@ -1,7 +1,7 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import { differenceInDays } from "date-fns"; import * as MapList from "~/features/map-list-generator/core/MapList"; import * as Seasons from "~/features/mmr/core/Seasons"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { logger } from "~/utils/logger"; import { SENDOUQ_BEST_OF } from "../q-constants"; import * as SQGroupRepository from "../SQGroupRepository.server"; diff --git a/apps/web-react/app/features/sendouq/q-search-params.ts b/apps/web-react/app/features/sendouq/q-search-params.ts index 2223e96a8..1a4eaee78 100644 --- a/apps/web-react/app/features/sendouq/q-search-params.ts +++ b/apps/web-react/app/features/sendouq/q-search-params.ts @@ -1,5 +1,5 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import { z } from "zod"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { modeShort, numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/sendouq/q-urls.ts b/apps/web-react/app/features/sendouq/q-urls.ts index 7930bd4ec..dc10d7191 100644 --- a/apps/web-react/app/features/sendouq/q-urls.ts +++ b/apps/web-react/app/features/sendouq/q-urls.ts @@ -1,4 +1,4 @@ -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { SENDOUQ_PAGE } from "~/utils/urls"; import { qSearchParams, weaponUsageSearchParams } from "./q-search-params"; diff --git a/apps/web-react/app/features/sendouq/q-utils.ts b/apps/web-react/app/features/sendouq/q-utils.ts index 530034958..f459f1db1 100644 --- a/apps/web-react/app/features/sendouq/q-utils.ts +++ b/apps/web-react/app/features/sendouq/q-utils.ts @@ -1,4 +1,4 @@ -import { modesShort } from "~/modules/in-game-lists/modes"; +import { modesShort } from "@sendou/in-game-lists/modes"; import { databaseTimestampToDate } from "~/utils/dates"; import { accountCreatedInTheLastSixMonths } from "~/utils/users"; import type { SQGroup } from "./core/SendouQ.server"; diff --git a/apps/web-react/app/features/sendouq/routes/q.looking.test.ts b/apps/web-react/app/features/sendouq/routes/q.looking.test.ts index 4f5430b99..188098737 100644 --- a/apps/web-react/app/features/sendouq/routes/q.looking.test.ts +++ b/apps/web-react/app/features/sendouq/routes/q.looking.test.ts @@ -7,6 +7,7 @@ vi.mock("~/features/chat/ChatSystemMessage.server", () => ({ setMetadata: vi.fn(), })); +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import * as SQGroupFactory from "~/db/seed/factories/SQGroupFactory"; import * as UserFactory from "~/db/seed/factories/UserFactory"; import { db } from "~/db/sql"; @@ -15,7 +16,6 @@ import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; import * as MatchProfileRepository from "~/features/match-profile/MatchProfileRepository.server"; import * as Seasons from "~/features/mmr/core/Seasons"; import * as SQGroupRepository from "~/features/sendouq/SQGroupRepository.server"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import invariant from "~/utils/invariant"; import { withUserId, wrappedAction } from "~/utils/Test"; diff --git a/apps/web-react/app/features/settings/components/MapModePreferencesField.tsx b/apps/web-react/app/features/settings/components/MapModePreferencesField.tsx index 4f4489fd8..ba1b8bb5a 100644 --- a/apps/web-react/app/features/settings/components/MapModePreferencesField.tsx +++ b/apps/web-react/app/features/settings/components/MapModePreferencesField.tsx @@ -1,10 +1,10 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import * as React from "react"; import { ModeImage } from "~/components/Image"; import type { Preference, UserMapModePreferences } from "~/db/tables-json"; import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; import { AMOUNT_OF_MAPS_IN_POOL_PER_MODE } from "~/features/match-profile/match-profile-constants"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { ModeMapPoolPicker } from "./ModeMapPoolPicker"; import { PreferenceRadioGroup } from "./PreferenceRadioGroup"; diff --git a/apps/web-react/app/features/settings/components/ModeMapPoolPicker.tsx b/apps/web-react/app/features/settings/components/ModeMapPoolPicker.tsx index 1b24dd886..a4dd85ef2 100644 --- a/apps/web-react/app/features/settings/components/ModeMapPoolPicker.tsx +++ b/apps/web-react/app/features/settings/components/ModeMapPoolPicker.tsx @@ -1,3 +1,5 @@ +import { shortStageName, stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Check } from "lucide-react"; import * as React from "react"; @@ -5,8 +7,6 @@ import { useTranslation } from "react-i18next"; import { Divider } from "~/components/Divider"; import { ModeImage } from "~/components/Image"; import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; -import { shortStageName, stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { nullFilledArray } from "~/utils/arrays"; import { stageImageUrl } from "~/utils/urls"; import styles from "./ModeMapPoolPicker.module.css"; diff --git a/apps/web-react/app/features/splatoon-rotations/splatoon-rotations.server.ts b/apps/web-react/app/features/splatoon-rotations/splatoon-rotations.server.ts index 62ad7870e..bb5d84b0b 100644 --- a/apps/web-react/app/features/splatoon-rotations/splatoon-rotations.server.ts +++ b/apps/web-react/app/features/splatoon-rotations/splatoon-rotations.server.ts @@ -1,8 +1,8 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { RankedModeShort } from "@sendou/in-game-lists/types"; import { z } from "zod"; import gameMisc from "~/../locales/en/game-misc.json"; import type { TablesInsertable } from "~/db/tables"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { RankedModeShort } from "~/modules/in-game-lists/types"; import { SPLATOON3_INK_SCHEDULES_URL } from "~/utils/urls"; const STAGE_NAME_TO_ID = Object.fromEntries( diff --git a/apps/web-react/app/features/tier-list-maker/components/TierListItemImage.tsx b/apps/web-react/app/features/tier-list-maker/components/TierListItemImage.tsx index 86f352e30..4b4534b8f 100644 --- a/apps/web-react/app/features/tier-list-maker/components/TierListItemImage.tsx +++ b/apps/web-react/app/features/tier-list-maker/components/TierListItemImage.tsx @@ -1,3 +1,4 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { Ability } from "~/components/Ability"; import { ModeImage, @@ -6,7 +7,6 @@ import { SubWeaponImage, WeaponImage, } from "~/components/Image"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import type { TierListItem } from "../tier-list-maker-schemas"; import styles from "./TierListItemImage.module.css"; diff --git a/apps/web-react/app/features/tier-list-maker/hooks/useTierList.ts b/apps/web-react/app/features/tier-list-maker/hooks/useTierList.ts index 48b20780a..12c4987ab 100644 --- a/apps/web-react/app/features/tier-list-maker/hooks/useTierList.ts +++ b/apps/web-react/app/features/tier-list-maker/hooks/useTierList.ts @@ -4,16 +4,16 @@ import type { DragStartEvent, } from "@dnd-kit/core"; import { arrayMove } from "@dnd-kit/sortable"; -import * as React from "react"; -import { abilitiesShort } from "~/modules/in-game-lists/abilities"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; +import { abilitiesShort } from "@sendou/in-game-lists/abilities"; +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import { mainWeaponIds, specialWeaponIds, subWeaponIds, weaponIdToType, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import * as React from "react"; import { useSearchParam } from "~/modules/search-params/hooks"; import { assertUnreachable } from "~/utils/types"; import { DEFAULT_TIERS } from "../tier-list-maker-constants"; diff --git a/apps/web-react/app/features/tier-list-maker/routes/tier-list-maker.tsx b/apps/web-react/app/features/tier-list-maker/routes/tier-list-maker.tsx index 1fc1c1b1a..7229cb55f 100644 --- a/apps/web-react/app/features/tier-list-maker/routes/tier-list-maker.tsx +++ b/apps/web-react/app/features/tier-list-maker/routes/tier-list-maker.tsx @@ -9,6 +9,7 @@ import { useSensors, } from "@dnd-kit/core"; import { sortableKeyboardCoordinates } from "@dnd-kit/sortable"; +import { modesShort } from "@sendou/in-game-lists/modes"; import clsx from "clsx"; import { HardDriveDownload, Plus, RefreshCcw } from "lucide-react"; import { useState } from "react"; @@ -33,7 +34,6 @@ import { Placeholder } from "~/components/Placeholder"; import { useUser } from "~/features/auth/core/user"; import { ImageExportDialog } from "~/features/img-export/components/ImageExportDialog"; import { useHydrated } from "~/hooks/useHydrated"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { metaTags } from "~/utils/remix"; import type { SendouRouteHandle } from "~/utils/remix.server"; import { navIconUrl, TIER_LIST_MAKER_URL } from "~/utils/urls"; diff --git a/apps/web-react/app/features/tier-list-maker/tier-list-maker-search-params.ts b/apps/web-react/app/features/tier-list-maker/tier-list-maker-search-params.ts index 6525e3565..cd6e9846d 100644 --- a/apps/web-react/app/features/tier-list-maker/tier-list-maker-search-params.ts +++ b/apps/web-react/app/features/tier-list-maker/tier-list-maker-search-params.ts @@ -1,5 +1,5 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; import { z } from "zod"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { modeShort } from "~/utils/zod"; diff --git a/apps/web-react/app/features/top-search/XRankPlacementRepository.server.test.ts b/apps/web-react/app/features/top-search/XRankPlacementRepository.server.test.ts index 290a9a49a..c60a4511d 100644 --- a/apps/web-react/app/features/top-search/XRankPlacementRepository.server.test.ts +++ b/apps/web-react/app/features/top-search/XRankPlacementRepository.server.test.ts @@ -1,8 +1,8 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { beforeEach, describe, expect, test } from "vitest"; import * as UserFactory from "~/db/seed/factories/UserFactory"; import * as XRankPlacementFactory from "~/db/seed/factories/XRankPlacementFactory"; import { db } from "~/db/sql"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import * as XRankPlacementRepository from "./XRankPlacementRepository.server"; const SPLOOSH_O_MATIC: MainWeaponId = 0; diff --git a/apps/web-react/app/features/top-search/XRankPlacementRepository.server.ts b/apps/web-react/app/features/top-search/XRankPlacementRepository.server.ts index c1a1b29be..faaca2438 100644 --- a/apps/web-react/app/features/top-search/XRankPlacementRepository.server.ts +++ b/apps/web-react/app/features/top-search/XRankPlacementRepository.server.ts @@ -1,9 +1,9 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { InferResult } from "kysely"; import { sql } from "kysely"; import { db } from "~/db/sql"; import type { Tables } from "~/db/tables"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { peakXpOverallSql } from "~/utils/kysely.server"; export type XRankPlacementInsertArgs = Omit< diff --git a/apps/web-react/app/features/top-search/routes/xsearch.tsx b/apps/web-react/app/features/top-search/routes/xsearch.tsx index 1bc77f267..b5503147e 100644 --- a/apps/web-react/app/features/top-search/routes/xsearch.tsx +++ b/apps/web-react/app/features/top-search/routes/xsearch.tsx @@ -1,3 +1,4 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; import { useTranslation } from "react-i18next"; import type { MetaFunction } from "react-router"; import { useLoaderData } from "react-router"; @@ -14,7 +15,6 @@ import { Image, ModeImage } from "~/components/Image"; import { LocaleTimeRange } from "~/components/LocaleTimeRange"; import { Main } from "~/components/Main"; import { topSearchPage } from "~/features/top-search/top-search-urls"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { metaTags } from "~/utils/remix"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/top-search/top-search-search-params.ts b/apps/web-react/app/features/top-search/top-search-search-params.ts index 09c997e8f..55bab6d1d 100644 --- a/apps/web-react/app/features/top-search/top-search-search-params.ts +++ b/apps/web-react/app/features/top-search/top-search-search-params.ts @@ -1,5 +1,5 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; import { z } from "zod"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; diff --git a/apps/web-react/app/features/top-search/top-search-urls.ts b/apps/web-react/app/features/top-search/top-search-urls.ts index a4714f5ed..cf1f7c2ff 100644 --- a/apps/web-react/app/features/top-search/top-search-urls.ts +++ b/apps/web-react/app/features/top-search/top-search-urls.ts @@ -1,5 +1,5 @@ +import type { ModeShort, RankedModeShort } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; -import type { ModeShort, RankedModeShort } from "~/modules/in-game-lists/types"; import { topSearchSearchParams } from "./top-search-search-params"; export const topSearchPage = (args?: { diff --git a/apps/web-react/app/features/tournament-admin/tournament-admin-schemas.ts b/apps/web-react/app/features/tournament-admin/tournament-admin-schemas.ts index 72c2a9e32..b4d73dd44 100644 --- a/apps/web-react/app/features/tournament-admin/tournament-admin-schemas.ts +++ b/apps/web-react/app/features/tournament-admin/tournament-admin-schemas.ts @@ -1,9 +1,9 @@ +import * as Swiss from "@sendou/tournament-engine/swiss/team-status"; import { z } from "zod"; import { TOURNAMENT, TOURNAMENT_STAGE_TYPES, } from "~/features/tournament/tournament-constants"; -import * as Swiss from "~/features/tournament-bracket/core/engine/swiss/team-status"; import * as Progression from "~/features/tournament-bracket/core/Progression"; import type { Tournament } from "~/features/tournament-bracket/core/Tournament"; import { _action, id, safeJSONParse } from "~/utils/zod"; diff --git a/apps/web-react/app/features/tournament-bracket/BracketRepository.server.ts b/apps/web-react/app/features/tournament-bracket/BracketRepository.server.ts index 262ae20d3..4d1276a89 100644 --- a/apps/web-react/app/features/tournament-bracket/BracketRepository.server.ts +++ b/apps/web-react/app/features/tournament-bracket/BracketRepository.server.ts @@ -1,16 +1,16 @@ +import { matchStatuses } from "@sendou/tournament-engine/status"; +import type { + BracketData, + EngineResult, + GeneratedRound, + ParticipantResult, +} from "@sendou/tournament-engine/types"; import { sql as kyselySql, type RawBuilder, type Transaction } from "kysely"; import { db } from "~/db/sql"; import type { DB } from "~/db/tables"; import { databaseTimestampNow } from "~/utils/dates"; import { shortNanoid } from "~/utils/id"; import { jsonArrayFrom } from "~/utils/kysely.server"; -import { matchStatuses } from "./core/engine/status"; -import type { - BracketData, - EngineResult, - GeneratedRound, - ParticipantResult, -} from "./core/engine/types"; /** * Loads the full BracketData for a tournament (all stages). Includes the diff --git a/apps/web-react/app/features/tournament-bracket/actions/to.$id.brackets.server.ts b/apps/web-react/app/features/tournament-bracket/actions/to.$id.brackets.server.ts index a68433594..ee3973b1f 100644 --- a/apps/web-react/app/features/tournament-bracket/actions/to.$id.brackets.server.ts +++ b/apps/web-react/app/features/tournament-bracket/actions/to.$id.brackets.server.ts @@ -1,3 +1,4 @@ +import * as Engine from "@sendou/tournament-engine"; import type { ActionFunction } from "react-router"; import type { PreparedMaps } from "~/db/tables-json"; import * as ChatSystemMessage from "~/features/chat/ChatSystemMessage.server"; @@ -20,7 +21,6 @@ import { import { assertUnreachable } from "~/utils/types"; import * as BracketRepository from "../BracketRepository.server"; import * as AbDivisions from "../core/AbDivisions"; -import * as Engine from "../core/engine"; import * as PreparedMapsUtils from "../core/PreparedMaps"; import type { Tournament } from "../core/Tournament"; import { diff --git a/apps/web-react/app/features/tournament-bracket/components/Bracket/Bracket.browser.test.tsx b/apps/web-react/app/features/tournament-bracket/components/Bracket/Bracket.browser.test.tsx index 3257dbe50..3440a60d1 100644 --- a/apps/web-react/app/features/tournament-bracket/components/Bracket/Bracket.browser.test.tsx +++ b/apps/web-react/app/features/tournament-bracket/components/Bracket/Bracket.browser.test.tsx @@ -1,8 +1,8 @@ +import type { BracketData } from "@sendou/tournament-engine/types"; import { createMemoryRouter, RouterProvider } from "react-router"; import { describe, expect, test, vi } from "vitest"; import { render } from "vitest-browser-react"; import styles from "~/features/tournament-bracket/components/Bracket/bracket.module.css"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import type { Bracket as BracketType } from "../../core/Bracket"; import { EliminationBracketSide } from "./Elimination"; import { Bracket } from "./index"; diff --git a/apps/web-react/app/features/tournament-bracket/components/Bracket/Match.tsx b/apps/web-react/app/features/tournament-bracket/components/Bracket/Match.tsx index 28c006e73..be81072dc 100644 --- a/apps/web-react/app/features/tournament-bracket/components/Bracket/Match.tsx +++ b/apps/web-react/app/features/tournament-bracket/components/Bracket/Match.tsx @@ -1,3 +1,4 @@ +import { matchEndedEarly } from "@sendou/tournament-engine"; import clsx from "clsx"; import { Eye } from "lucide-react"; import type * as React from "react"; @@ -9,7 +10,6 @@ import { useUser } from "~/features/auth/core/user"; import { TournamentStream } from "~/features/tournament/components/TournamentStream"; import { useTournamentVods } from "~/features/tournament/routes/to.$id"; import { useTournament } from "~/features/tournament/tournament-context"; -import { matchEndedEarly } from "~/features/tournament-bracket/core/engine"; import { useAutoRerender } from "~/hooks/useAutoRerender"; import { databaseTimestampToDate } from "~/utils/dates"; import type { Unpacked } from "~/utils/types"; diff --git a/apps/web-react/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx b/apps/web-react/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx index ad0920ab4..a9dab6790 100644 --- a/apps/web-react/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx +++ b/apps/web-react/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx @@ -1,3 +1,4 @@ +import * as Swiss from "@sendou/tournament-engine/swiss/team-status"; import clsx from "clsx"; import { Check, SquarePen, X } from "lucide-react"; import * as React from "react"; @@ -10,7 +11,6 @@ import { logger } from "../../../../utils/logger"; import { tournamentTeamPage } from "../../../../utils/urls"; import { useUser } from "../../../auth/core/user"; import type { Bracket, Standing } from "../../core/Bracket"; -import * as Swiss from "../../core/engine/swiss/team-status"; import * as Progression from "../../core/Progression"; import type { BracketMeta } from "../../core/Tournament"; import { bracketSchema } from "../../tournament-bracket-schemas"; diff --git a/apps/web-react/app/features/tournament-bracket/components/Bracket/RoundRobin.tsx b/apps/web-react/app/features/tournament-bracket/components/Bracket/RoundRobin.tsx index 0d16754fb..67389776e 100644 --- a/apps/web-react/app/features/tournament-bracket/components/Bracket/RoundRobin.tsx +++ b/apps/web-react/app/features/tournament-bracket/components/Bracket/RoundRobin.tsx @@ -1,4 +1,4 @@ -import type { MatchData as MatchType } from "~/features/tournament-bracket/core/engine/types"; +import type { MatchData as MatchType } from "@sendou/tournament-engine/types"; import type { Bracket as BracketType } from "../../core/Bracket"; import { groupNumberToLetters } from "../../tournament-bracket-utils"; import styles from "./bracket.module.css"; diff --git a/apps/web-react/app/features/tournament-bracket/components/Bracket/Swiss.tsx b/apps/web-react/app/features/tournament-bracket/components/Bracket/Swiss.tsx index 94b25383c..5c8c2ce65 100644 --- a/apps/web-react/app/features/tournament-bracket/components/Bracket/Swiss.tsx +++ b/apps/web-react/app/features/tournament-bracket/components/Bracket/Swiss.tsx @@ -1,11 +1,11 @@ +import * as Engine from "@sendou/tournament-engine"; +import type { MatchData as MatchType } from "@sendou/tournament-engine/types"; import clsx from "clsx"; import { ActionButton } from "~/components/ActionButton"; import { SendouButton } from "~/components/elements/Button"; import { useUser } from "~/features/auth/core/user"; import { useBracketExpanded } from "~/features/tournament/routes/to.$id"; import { useTournament } from "~/features/tournament/tournament-context"; -import * as Engine from "~/features/tournament-bracket/core/engine"; -import type { MatchData as MatchType } from "~/features/tournament-bracket/core/engine/types"; import { useSearchParam } from "~/modules/search-params/hooks"; import type { Bracket as BracketType } from "../../core/Bracket"; import styles from "../../tournament-bracket.module.css"; diff --git a/apps/web-react/app/features/tournament-bracket/components/BracketMapListDialog.tsx b/apps/web-react/app/features/tournament-bracket/components/BracketMapListDialog.tsx index 51f25c612..1151b931d 100644 --- a/apps/web-react/app/features/tournament-bracket/components/BracketMapListDialog.tsx +++ b/apps/web-react/app/features/tournament-bracket/components/BracketMapListDialog.tsx @@ -1,3 +1,7 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; +import * as Engine from "@sendou/tournament-engine"; +import type { BracketData } from "@sendou/tournament-engine/types"; import clsx from "clsx"; import { Link as LinkIcon, @@ -28,17 +32,13 @@ import { calendarEditPage } from "~/features/calendar/calendar-urls"; import { useTournamentPreparedMaps } from "~/features/tournament/routes/to.$id"; import { TOURNAMENT } from "~/features/tournament/tournament-constants"; import { useTournament } from "~/features/tournament/tournament-context"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import * as PickBan from "~/features/tournament-bracket/core/PickBan"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { nullFilledArray } from "~/utils/arrays"; import invariant from "~/utils/invariant"; import { assertUnreachable } from "~/utils/types"; import { SendouButton } from "../../../components/elements/Button"; import { logger } from "../../../utils/logger"; import type { Bracket } from "../core/Bracket"; -import * as Engine from "../core/engine"; import * as PreparedMaps from "../core/PreparedMaps"; import { getRounds } from "../core/rounds"; import type { Tournament } from "../core/Tournament"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket.test.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket.test.ts index 03c17db6d..c2db9e643 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket.test.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket.test.ts @@ -1,9 +1,9 @@ +import * as Engine from "@sendou/tournament-engine"; +import { createResolved } from "@sendou/tournament-engine/create"; +import type { BracketData, MatchData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; import { describe, expect, test } from "vitest"; import invariant from "../../../utils/invariant"; -import * as Engine from "./engine"; -import { createResolved } from "./engine/create"; -import type { BracketData, MatchData } from "./engine/types"; import { Tournament } from "./Tournament"; import { PADDLING_POOL_255 } from "./tests/mocks"; import { LOW_INK_DECEMBER_2024 } from "./tests/mocks-li"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket/Bracket.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket/Bracket.ts index 22bd8eb21..89b8007fe 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket/Bracket.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket/Bracket.ts @@ -1,15 +1,12 @@ +import * as Engine from "@sendou/tournament-engine"; +import type { BracketData, RoundData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; import type { Tables } from "~/db/tables"; import type { TournamentStageSettings } from "~/db/tables-json"; import { TOURNAMENT } from "~/features/tournament/tournament-constants"; -import type { - BracketData, - RoundData, -} from "~/features/tournament-bracket/core/engine/types"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import * as AbDivisions from "../AbDivisions"; -import * as Engine from "../engine"; import * as Progression from "../Progression"; import type { OptionalIdObject, Tournament } from "../Tournament"; import type { TournamentDataTeam } from "../Tournament.server"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket/DoubleEliminationBracket.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket/DoubleEliminationBracket.ts index 54ca5e9fb..1bbfaba78 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket/DoubleEliminationBracket.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket/DoubleEliminationBracket.ts @@ -1,9 +1,6 @@ +import type { BracketData, RoundData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; import type { Tables } from "~/db/tables"; -import type { - BracketData, - RoundData, -} from "~/features/tournament-bracket/core/engine/types"; import invariant from "~/utils/invariant"; import type { BracketMapCounts } from "../toMapList"; import { Bracket, type Standing } from "./Bracket"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket/RoundRobinBracket.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket/RoundRobinBracket.ts index 4881e1b3a..4d9451ee5 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket/RoundRobinBracket.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket/RoundRobinBracket.ts @@ -1,7 +1,7 @@ +import type { BracketData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; import type { Tables } from "~/db/tables"; import * as Standings from "~/features/tournament/core/Standings"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import invariant from "~/utils/invariant"; import type { BracketMapCounts } from "../toMapList"; import { Bracket, type Standing } from "./Bracket"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket/SingleEliminationBracket.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket/SingleEliminationBracket.ts index 841abacfc..de0ebceb4 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket/SingleEliminationBracket.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket/SingleEliminationBracket.ts @@ -1,10 +1,10 @@ -import * as R from "remeda"; -import type { Tables } from "~/db/tables"; import type { BracketData, MatchData, RoundData, -} from "~/features/tournament-bracket/core/engine/types"; +} from "@sendou/tournament-engine/types"; +import * as R from "remeda"; +import type { Tables } from "~/db/tables"; import invariant from "~/utils/invariant"; import type { BracketMapCounts } from "../toMapList"; import { Bracket, type Standing } from "./Bracket"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket/SwissBracket.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket/SwissBracket.ts index dc7bd2180..d02d74eff 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket/SwissBracket.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket/SwissBracket.ts @@ -1,12 +1,12 @@ +import * as Engine from "@sendou/tournament-engine"; +import { calculateTeamStatus } from "@sendou/tournament-engine/swiss/team-status"; +import type { BracketData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; import type { Tables } from "~/db/tables"; import * as Standings from "~/features/tournament/core/Standings"; -import * as Engine from "~/features/tournament-bracket/core/engine"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { cutToNDecimalPlaces } from "../../../../utils/number"; -import { calculateTeamStatus } from "../engine/swiss/team-status"; import type { BracketMapCounts } from "../toMapList"; import { Bracket, type Standing, type TeamTrackRecord } from "./Bracket"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Bracket/utils.ts b/apps/web-react/app/features/tournament-bracket/core/Bracket/utils.ts index 07f59f1d8..dc77c15d4 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Bracket/utils.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Bracket/utils.ts @@ -1,5 +1,5 @@ +import type { BracketData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; /** * Maps each roundId to the cumulative number of teams eliminated by the end of diff --git a/apps/web-react/app/features/tournament-bracket/core/PickBan.test.ts b/apps/web-react/app/features/tournament-bracket/core/PickBan.test.ts index da9653338..68ad1a58d 100644 --- a/apps/web-react/app/features/tournament-bracket/core/PickBan.test.ts +++ b/apps/web-react/app/features/tournament-bracket/core/PickBan.test.ts @@ -1,6 +1,6 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; import type { TournamentRoundMaps } from "~/db/tables-json"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import type { WhoSide } from "../tournament-bracket-constants"; import { CUSTOM_FLOW_VALIDATION_ERRORS, diff --git a/apps/web-react/app/features/tournament-bracket/core/PickBan.ts b/apps/web-react/app/features/tournament-bracket/core/PickBan.ts index 31311cbe6..87ff185ee 100644 --- a/apps/web-react/app/features/tournament-bracket/core/PickBan.ts +++ b/apps/web-react/app/features/tournament-bracket/core/PickBan.ts @@ -1,3 +1,8 @@ +import type { + ModeShort, + ModeWithStage, + StageId, +} from "@sendou/in-game-lists/types"; import * as R from "remeda"; import type { CustomPickBanStep, TournamentRoundMaps } from "~/db/tables-json"; import type { @@ -5,24 +10,14 @@ import type { WhoSide, } from "~/features/tournament-bracket/tournament-bracket-constants"; import { isSetOverByResults } from "~/features/tournament-match/tournament-match-utils"; -import type { - ModeShort, - ModeWithStage, - StageId, -} from "~/modules/in-game-lists/types"; import type { TournamentMapListMap } from "~/modules/tournament-map-list-generator/types"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { seededRandom } from "~/utils/random"; import { assertUnreachable } from "~/utils/types"; -export const types = [ - "COUNTERPICK", - "COUNTERPICK_MODE_REPEAT_OK", - "BAN_2", - "CUSTOM", -] as const; -export type Type = (typeof types)[number]; +export type { PickBanType as Type } from "@sendou/tournament-engine/types"; +export { PICK_BAN_TYPES as types } from "@sendou/tournament-engine/types"; export interface PickBanTeam { id: number; diff --git a/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.test.ts b/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.test.ts index 0c80d1af1..921d472d7 100644 --- a/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.test.ts +++ b/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.test.ts @@ -1,3 +1,5 @@ +import * as Engine from "@sendou/tournament-engine"; +import type { BracketData } from "@sendou/tournament-engine/types"; import { addHours, addMinutes, subHours, subMinutes } from "date-fns"; import * as R from "remeda"; import { describe, expect, test } from "vitest"; @@ -5,8 +7,6 @@ import type { PreparedMaps as PreparedMapsType } from "~/db/tables-json"; import { TOURNAMENT } from "~/features/tournament/tournament-constants"; import { nullFilledArray } from "~/utils/arrays"; import { dateToDatabaseTimestamp } from "~/utils/dates"; -import * as Engine from "./engine"; -import type { BracketData } from "./engine/types"; import * as PreparedMaps from "./PreparedMaps"; import type * as Progression from "./Progression"; import { getRounds } from "./rounds"; diff --git a/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.ts b/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.ts index cc7811596..8725d2e5c 100644 --- a/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.ts +++ b/apps/web-react/app/features/tournament-bracket/core/PreparedMaps.ts @@ -1,3 +1,5 @@ +import * as Engine from "@sendou/tournament-engine"; +import type { BracketData } from "@sendou/tournament-engine/types"; import { hoursToMilliseconds } from "date-fns"; import * as R from "remeda"; import type { PreparedMaps } from "~/db/tables-json"; @@ -5,8 +7,6 @@ import { TOURNAMENT } from "~/features/tournament/tournament-constants"; import { nullFilledArray } from "~/utils/arrays"; import invariant from "~/utils/invariant"; import type { Bracket } from "./Bracket"; -import * as Engine from "./engine"; -import type { BracketData } from "./engine/types"; import * as Progression from "./Progression"; import type { BracketMeta, Tournament } from "./Tournament"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Seeding.ts b/apps/web-react/app/features/tournament-bracket/core/Seeding.ts index 2bb4d3f54..1c0e3c95b 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Seeding.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Seeding.ts @@ -1,4 +1,4 @@ -import { ordering } from "./engine/create/seeding"; +import { ordering } from "@sendou/tournament-engine/create/seeding"; export interface FollowUpBracketSource { /** Standings of the source bracket, best placements first. Tied placements (e.g. the winner of each group) form the tiers that seeding keeps intact. */ diff --git a/apps/web-react/app/features/tournament-bracket/core/Swiss.test.ts b/apps/web-react/app/features/tournament-bracket/core/Swiss.test.ts index dfc07e236..dadb57cc6 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Swiss.test.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Swiss.test.ts @@ -1,3 +1,6 @@ +import * as Engine from "@sendou/tournament-engine"; +import { pairUp } from "@sendou/tournament-engine/swiss/pairing"; +import * as TeamStatus from "@sendou/tournament-engine/swiss/team-status"; import { describe, expect, test } from "vitest"; import type { TournamentStageSettings } from "~/db/tables-json"; import { Tournament } from "~/features/tournament-bracket/core/Tournament"; @@ -8,9 +11,6 @@ import { import { ZONES_WEEKLY_38 } from "~/features/tournament-bracket/core/tests/mocks-zones-weekly"; import invariant from "~/utils/invariant"; import { unwrap } from "~/utils/result"; -import * as Engine from "./engine"; -import { pairUp } from "./engine/swiss/pairing"; -import * as TeamStatus from "./engine/swiss/team-status"; const Swiss = { ...TeamStatus, diff --git a/apps/web-react/app/features/tournament-bracket/core/Tournament.server.test.ts b/apps/web-react/app/features/tournament-bracket/core/Tournament.server.test.ts index f4ba5da56..2d5db4c28 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Tournament.server.test.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Tournament.server.test.ts @@ -1,5 +1,5 @@ +import * as Engine from "@sendou/tournament-engine"; import { describe, expect, test } from "vitest"; -import * as Engine from "./engine"; import { serializeBracket } from "./Tournament.server"; import { testTournament } from "./tests/test-utils"; diff --git a/apps/web-react/app/features/tournament-bracket/core/Tournament.test.ts b/apps/web-react/app/features/tournament-bracket/core/Tournament.test.ts index 3cb494749..38209548a 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Tournament.test.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Tournament.test.ts @@ -1,11 +1,11 @@ -import { describe, expect, test } from "vitest"; +import * as Engine from "@sendou/tournament-engine"; import type { BracketData, GeneratedRound, MatchData, -} from "~/features/tournament-bracket/core/engine/types"; +} from "@sendou/tournament-engine/types"; +import { describe, expect, test } from "vitest"; import { unwrap } from "~/utils/result"; -import * as Engine from "./engine"; import type * as Progression from "./Progression"; import { Tournament } from "./Tournament"; import { diff --git a/apps/web-react/app/features/tournament-bracket/core/Tournament.ts b/apps/web-react/app/features/tournament-bracket/core/Tournament.ts index add928928..125bd9654 100644 --- a/apps/web-react/app/features/tournament-bracket/core/Tournament.ts +++ b/apps/web-react/app/features/tournament-bracket/core/Tournament.ts @@ -1,3 +1,6 @@ +import type { ModeShort } from "@sendou/in-game-lists/types"; +import { calculateTeamStatus } from "@sendou/tournament-engine/swiss/team-status"; +import type { MatchData } from "@sendou/tournament-engine/types"; import { sub } from "date-fns"; import type { Tables } from "~/db/tables"; import type { TournamentStageSettings } from "~/db/tables-json"; @@ -11,9 +14,7 @@ import { tournamentInWeaponReportingWindow, tournamentIsRanked, } from "~/features/tournament/tournament-utils"; -import type { MatchData } from "~/features/tournament-bracket/core/engine/types"; import * as Progression from "~/features/tournament-bracket/core/Progression"; -import type { ModeShort } from "~/modules/in-game-lists/types"; import { hasPermission } from "~/modules/permissions/utils"; import { databaseTimestampToDate, @@ -24,7 +25,6 @@ import { logger } from "~/utils/logger"; import { assertUnreachable } from "~/utils/types"; import { groupNumberToLetters } from "../tournament-bracket-utils"; import { type Bracket, createBracket } from "./Bracket"; -import { calculateTeamStatus } from "./engine/swiss/team-status"; import { getRounds } from "./rounds"; import * as Seeding from "./Seeding"; import type { TournamentData } from "./Tournament.server"; diff --git a/apps/web-react/app/features/tournament-bracket/core/executeBracketOperation.server.ts b/apps/web-react/app/features/tournament-bracket/core/executeBracketOperation.server.ts index 6b87d6c7c..c44102052 100644 --- a/apps/web-react/app/features/tournament-bracket/core/executeBracketOperation.server.ts +++ b/apps/web-react/app/features/tournament-bracket/core/executeBracketOperation.server.ts @@ -1,9 +1,9 @@ +import type * as Engine from "@sendou/tournament-engine"; import type { Transaction } from "kysely"; import { db } from "~/db/sql"; import type { DB } from "~/db/tables"; import { endDroppedTeamMatches } from "~/features/tournament/tournament-utils.server"; import * as BracketRepository from "../BracketRepository.server"; -import type * as Engine from "./engine"; import type { Tournament } from "./Tournament"; /** diff --git a/apps/web-react/app/features/tournament-bracket/core/rounds.ts b/apps/web-react/app/features/tournament-bracket/core/rounds.ts index d708da2db..4e7f6a82e 100644 --- a/apps/web-react/app/features/tournament-bracket/core/rounds.ts +++ b/apps/web-react/app/features/tournament-bracket/core/rounds.ts @@ -1,5 +1,5 @@ +import type { BracketData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import { TOURNAMENT } from "../../tournament/tournament-constants"; export function getRounds(args: { diff --git a/apps/web-react/app/features/tournament-bracket/core/summarizer.server.ts b/apps/web-react/app/features/tournament-bracket/core/summarizer.server.ts index 8a7ced1f4..476fda56d 100644 --- a/apps/web-react/app/features/tournament-bracket/core/summarizer.server.ts +++ b/apps/web-react/app/features/tournament-bracket/core/summarizer.server.ts @@ -1,3 +1,4 @@ +import { matchEndedEarly } from "@sendou/tournament-engine"; import { ordinal } from "openskill"; import * as R from "remeda"; import type { WinLossParticipationArray } from "~/db/tables-json"; @@ -16,7 +17,6 @@ import { roundToNDecimalPlaces } from "~/utils/number"; import type { Tables } from "../../../db/tables"; import { ensureOneStandingPerUser } from "../tournament-bracket-utils"; import type { Standing } from "./Bracket"; -import { matchEndedEarly } from "./engine"; import type { ParsedBracket } from "./Progression"; import * as Progression from "./Progression"; diff --git a/apps/web-react/app/features/tournament-bracket/core/tests/test-utils.ts b/apps/web-react/app/features/tournament-bracket/core/tests/test-utils.ts index 7f6c0ecac..e644b0cfc 100644 --- a/apps/web-react/app/features/tournament-bracket/core/tests/test-utils.ts +++ b/apps/web-react/app/features/tournament-bracket/core/tests/test-utils.ts @@ -1,5 +1,5 @@ +import type { BracketData } from "@sendou/tournament-engine/types"; import * as R from "remeda"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import type * as Progression from "../Progression"; import { Tournament } from "../Tournament"; import type { TournamentData } from "../Tournament.server"; diff --git a/apps/web-react/app/features/tournament-bracket/core/toMapList.ts b/apps/web-react/app/features/tournament-bracket/core/toMapList.ts index 5722b0e34..ccac9fa9e 100644 --- a/apps/web-react/app/features/tournament-bracket/core/toMapList.ts +++ b/apps/web-react/app/features/tournament-bracket/core/toMapList.ts @@ -1,11 +1,11 @@ /** Map list generation logic for "TO pick" as in the map list is defined beforehand by TO and teams don't pick */ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; +import type { RoundData } from "@sendou/tournament-engine/types"; import type { Tables } from "~/db/tables"; import type { TournamentRoundMaps } from "~/db/tables-json"; import * as MapList from "~/features/map-list-generator/core/MapList"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; -import type { RoundData } from "~/features/tournament-bracket/core/engine/types"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { logger } from "~/utils/logger"; import { assertUnreachable } from "~/utils/types"; diff --git a/apps/web-react/app/features/tournament-bracket/tournament-bracket-constants.ts b/apps/web-react/app/features/tournament-bracket/tournament-bracket-constants.ts index 135a40f76..9e9d1331c 100644 --- a/apps/web-react/app/features/tournament-bracket/tournament-bracket-constants.ts +++ b/apps/web-react/app/features/tournament-bracket/tournament-bracket-constants.ts @@ -1,25 +1,8 @@ -/** Who picks or bans in a custom pick/ban flow step. */ -export const WHO_SIDES = [ - "RANDOM", - "RANDOM_OTHER", - "ALPHA", - "BRAVO", - "HIGHER_SEED", - "LOWER_SEED", - "WINNER", - "LOSER", -] as const; - -export type WhoSide = (typeof WHO_SIDES)[number]; - -/** What happens in a custom pick/ban flow step. */ -export const ACTION_TYPES = [ - "ROLL", - "PICK", - "PICK_NO_MODE_REPEAT", - "BAN", - "MODE_PICK", - "MODE_BAN", -] as const; - -export type ActionType = (typeof ACTION_TYPES)[number]; +export type { + ActionType, + WhoSide, +} from "@sendou/tournament-engine/types"; +export { + ACTION_TYPES, + WHO_SIDES, +} from "@sendou/tournament-engine/types"; diff --git a/apps/web-react/app/features/tournament-lfg/components/LFGGroupCard.tsx b/apps/web-react/app/features/tournament-lfg/components/LFGGroupCard.tsx index 0dec0a556..6c1f63bfd 100644 --- a/apps/web-react/app/features/tournament-lfg/components/LFGGroupCard.tsx +++ b/apps/web-react/app/features/tournament-lfg/components/LFGGroupCard.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Mic, Star, Trash, Volume2, VolumeX } from "lucide-react"; import * as React from "react"; @@ -22,7 +23,6 @@ import { SendouForm } from "~/form/SendouForm"; import { useMainContentWidth } from "~/hooks/useMainContentWidth"; import type { UnifiedLanguageCode } from "~/modules/i18n/config"; import { languagesUnified } from "~/modules/i18n/config"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { navIconUrl } from "~/utils/urls"; import { lookingSchema, diff --git a/apps/web-react/app/features/tournament-lfg/loaders/to.$id.looking.server.ts b/apps/web-react/app/features/tournament-lfg/loaders/to.$id.looking.server.ts index 7577a6f74..48a11cb63 100644 --- a/apps/web-react/app/features/tournament-lfg/loaders/to.$id.looking.server.ts +++ b/apps/web-react/app/features/tournament-lfg/loaders/to.$id.looking.server.ts @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { LoaderFunctionArgs } from "react-router"; import * as R from "remeda"; import type { getUser } from "~/features/auth/core/user.server"; @@ -9,7 +10,6 @@ import { } from "~/features/tournament-bracket/core/Tournament.server"; import * as UserCardRepository from "~/features/user-card/UserCardRepository.server"; import * as UserRepository from "~/features/user-page/UserRepository.server"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { SerializeFrom } from "~/utils/remix"; import type { LFGGroup, LFGGroupMember } from "../components/LFGGroupCard"; import * as TournamentLFGRepository from "../TournamentLFGRepository.server"; diff --git a/apps/web-react/app/features/tournament-match/TournamentMatchRepository.server.ts b/apps/web-react/app/features/tournament-match/TournamentMatchRepository.server.ts index f33195310..73e2a2462 100644 --- a/apps/web-react/app/features/tournament-match/TournamentMatchRepository.server.ts +++ b/apps/web-react/app/features/tournament-match/TournamentMatchRepository.server.ts @@ -1,9 +1,9 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; +import type { Side } from "@sendou/tournament-engine/types"; import { type Insertable, sql, type Transaction } from "kysely"; import { db } from "~/db/sql"; import type { DB } from "~/db/tables"; import type { TournamentRoundMaps } from "~/db/tables-json"; -import type { Side } from "~/features/tournament-bracket/core/engine/types"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import invariant from "~/utils/invariant"; import { commonUserSelect, jsonArrayFrom } from "~/utils/kysely.server"; import { toDBBoolean } from "~/utils/sql"; diff --git a/apps/web-react/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts b/apps/web-react/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts index c117adf28..1fd2609e4 100644 --- a/apps/web-react/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts +++ b/apps/web-react/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts @@ -1,10 +1,10 @@ +import * as Engine from "@sendou/tournament-engine"; import type { ActionFunction } from "react-router"; import { db } from "~/db/sql"; import * as ChatSystemMessage from "~/features/chat/ChatSystemMessage.server"; import * as ReportedWeaponRepository from "~/features/sendouq-match/ReportedWeaponRepository.server"; import * as TournamentRepository from "~/features/tournament/TournamentRepository.server"; import * as TournamentTeamRepository from "~/features/tournament/TournamentTeamRepository.server"; -import * as Engine from "~/features/tournament-bracket/core/engine"; import { executeBracketOperation } from "~/features/tournament-bracket/core/executeBracketOperation.server"; import * as PickBan from "~/features/tournament-bracket/core/PickBan"; import type { Tournament } from "~/features/tournament-bracket/core/Tournament"; diff --git a/apps/web-react/app/features/tournament-match/components/TournamentMatchActionPickBanTab.tsx b/apps/web-react/app/features/tournament-match/components/TournamentMatchActionPickBanTab.tsx index 2738a0f41..0f87e8886 100644 --- a/apps/web-react/app/features/tournament-match/components/TournamentMatchActionPickBanTab.tsx +++ b/apps/web-react/app/features/tournament-match/components/TournamentMatchActionPickBanTab.tsx @@ -1,3 +1,5 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { MatchActionPickBanTab, type PickBanMapOption, @@ -7,8 +9,6 @@ import { useTournament } from "~/features/tournament/tournament-context"; import * as PickBan from "~/features/tournament-bracket/core/PickBan"; import { matchSchema } from "~/features/tournament-bracket/tournament-bracket-schemas"; import { useActionSubmit } from "~/hooks/useActionSubmit"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import type { TournamentMatchLoaderData } from "../loaders/to.$id.matches.$mid.server"; import { type MatchPageTeam, useMatch } from "../match-page-context"; import { UndoReportButton } from "./TournamentMatchActionTab"; diff --git a/apps/web-react/app/features/tournament-match/components/TournamentMatchActionTab.tsx b/apps/web-react/app/features/tournament-match/components/TournamentMatchActionTab.tsx index bedcbafc9..4ace44904 100644 --- a/apps/web-react/app/features/tournament-match/components/TournamentMatchActionTab.tsx +++ b/apps/web-react/app/features/tournament-match/components/TournamentMatchActionTab.tsx @@ -1,3 +1,4 @@ +import { isSetOverByScore } from "@sendou/tournament-engine"; import { Undo2 } from "lucide-react"; import { useTranslation } from "react-i18next"; import { SendouButton } from "~/components/elements/Button"; @@ -8,7 +9,6 @@ import { useMatchWeaponReport } from "~/components/match-page/useMatchWeaponRepo import { WeaponReporter } from "~/components/match-page/WeaponReporter"; import { useUser } from "~/features/auth/core/user"; import { useTournament } from "~/features/tournament/tournament-context"; -import { isSetOverByScore } from "~/features/tournament-bracket/core/engine"; import { matchSchema } from "~/features/tournament-bracket/tournament-bracket-schemas"; import { tournamentTeamToActiveRosterUserIds } from "~/features/tournament-bracket/tournament-bracket-utils"; import { useActionSubmit } from "~/hooks/useActionSubmit"; diff --git a/apps/web-react/app/features/tournament-match/components/TournamentMatchAdminTab.tsx b/apps/web-react/app/features/tournament-match/components/TournamentMatchAdminTab.tsx index e727eb680..ebaec4f36 100644 --- a/apps/web-react/app/features/tournament-match/components/TournamentMatchAdminTab.tsx +++ b/apps/web-react/app/features/tournament-match/components/TournamentMatchAdminTab.tsx @@ -1,3 +1,4 @@ +import type { MatchStatus } from "@sendou/tournament-engine"; import { Ban, Lock, LockOpen, RotateCcw, SquarePen } from "lucide-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -17,7 +18,6 @@ import { TAB_KEYS } from "~/components/match-page/MatchTabs"; import { SubmitButton } from "~/components/SubmitButton"; import { useUser } from "~/features/auth/core/user"; import { useTournament } from "~/features/tournament/tournament-context"; -import type { MatchStatus } from "~/features/tournament-bracket/core/engine"; import { matchSchema } from "~/features/tournament-bracket/tournament-bracket-schemas"; import { useActionSubmit } from "~/hooks/useActionSubmit"; import type { TournamentMatchLoaderData } from "../loaders/to.$id.matches.$mid.server"; diff --git a/apps/web-react/app/features/tournament-match/components/TournamentMatchBanner.tsx b/apps/web-react/app/features/tournament-match/components/TournamentMatchBanner.tsx index 0cffed821..8967e7ac6 100644 --- a/apps/web-react/app/features/tournament-match/components/TournamentMatchBanner.tsx +++ b/apps/web-react/app/features/tournament-match/components/TournamentMatchBanner.tsx @@ -1,3 +1,4 @@ +import type { ModeShort } from "@sendou/in-game-lists/types"; import { differenceInMinutes } from "date-fns"; import { Flag, @@ -28,7 +29,6 @@ import { useTournament } from "~/features/tournament/tournament-context"; import * as PickBan from "~/features/tournament-bracket/core/PickBan"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; import { useAutoRerender } from "~/hooks/useAutoRerender"; -import type { ModeShort } from "~/modules/in-game-lists/types"; import type { TournamentMaplistSource } from "~/modules/tournament-map-list-generator/types"; import { databaseTimestampToDate } from "~/utils/dates"; import type { TournamentMatchLoaderData } from "../loaders/to.$id.matches.$mid.server"; diff --git a/apps/web-react/app/features/tournament-match/core/executeRoll.server.ts b/apps/web-react/app/features/tournament-match/core/executeRoll.server.ts index ce33aa7e9..a079eb95e 100644 --- a/apps/web-react/app/features/tournament-match/core/executeRoll.server.ts +++ b/apps/web-react/app/features/tournament-match/core/executeRoll.server.ts @@ -1,7 +1,7 @@ +import type { ModeWithStage } from "@sendou/in-game-lists/types"; import type { TournamentRoundMaps } from "~/db/tables-json"; import * as TournamentRepository from "~/features/tournament/TournamentRepository.server"; import * as PickBan from "~/features/tournament-bracket/core/PickBan"; -import type { ModeWithStage } from "~/modules/in-game-lists/types"; import invariant from "~/utils/invariant"; import { seededRandom } from "~/utils/random"; import { errorIsSqliteUniqueConstraintFailure } from "~/utils/sql"; diff --git a/apps/web-react/app/features/tournament-match/core/mapList.server.ts b/apps/web-react/app/features/tournament-match/core/mapList.server.ts index 35645faa7..2909035cd 100644 --- a/apps/web-react/app/features/tournament-match/core/mapList.server.ts +++ b/apps/web-react/app/features/tournament-match/core/mapList.server.ts @@ -1,3 +1,4 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; import type { TournamentRoundMaps } from "~/db/tables-json"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; @@ -6,7 +7,6 @@ import * as TournamentTeamRepository from "~/features/tournament/TournamentTeamR import { mapPickingStyleToModes } from "~/features/tournament/tournament-utils"; import type * as PickBan from "~/features/tournament-bracket/core/PickBan"; import type { Tournament } from "~/features/tournament-bracket/core/Tournament"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { generateBalancedMapList } from "~/modules/tournament-map-list-generator/balanced-map-list"; import { parseMaplistSource } from "~/modules/tournament-map-list-generator/source"; import { starterMap } from "~/modules/tournament-map-list-generator/starter-map"; diff --git a/apps/web-react/app/features/tournament-match/core/reportScore.server.ts b/apps/web-react/app/features/tournament-match/core/reportScore.server.ts index f2338e332..7c12e44ea 100644 --- a/apps/web-react/app/features/tournament-match/core/reportScore.server.ts +++ b/apps/web-react/app/features/tournament-match/core/reportScore.server.ts @@ -1,5 +1,5 @@ +import * as Engine from "@sendou/tournament-engine"; import * as ReportedWeaponRepository from "~/features/sendouq-match/ReportedWeaponRepository.server"; -import * as Engine from "~/features/tournament-bracket/core/engine"; import { executeBracketOperation } from "~/features/tournament-bracket/core/executeBracketOperation.server"; import type { Tournament } from "~/features/tournament-bracket/core/Tournament"; import { tournamentTeamToActiveRosterUserIds } from "~/features/tournament-bracket/tournament-bracket-utils"; diff --git a/apps/web-react/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts b/apps/web-react/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts index a38dd1262..3c342bd81 100644 --- a/apps/web-react/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts +++ b/apps/web-react/app/features/tournament-match/loaders/to.$id.matches.$mid.server.ts @@ -1,4 +1,5 @@ import cachified from "@epic-web/cachified"; +import { matchEndedEarly } from "@sendou/tournament-engine"; import type { LoaderFunctionArgs } from "react-router"; import * as ChatSystemMessage from "~/features/chat/ChatSystemMessage.server"; import { chatAccessible } from "~/features/chat/chat-utils"; @@ -10,7 +11,6 @@ import { isLeagueRoundLocked, resolveLeagueRoundStartDate, } from "~/features/tournament/tournament-utils"; -import { matchEndedEarly } from "~/features/tournament-bracket/core/engine"; import * as PickBan from "~/features/tournament-bracket/core/PickBan"; import { tournamentFromParams, diff --git a/apps/web-react/app/features/tournament-match/tournament-match-utils.ts b/apps/web-react/app/features/tournament-match/tournament-match-utils.ts index d7ba71bdd..128343cb2 100644 --- a/apps/web-react/app/features/tournament-match/tournament-match-utils.ts +++ b/apps/web-react/app/features/tournament-match/tournament-match-utils.ts @@ -1,9 +1,9 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { TFunction } from "i18next"; import * as R from "remeda"; import type { TournamentRoundMaps } from "~/db/tables-json"; import type { Tournament } from "~/features/tournament-bracket/core/Tournament"; import type { TournamentDataTeam } from "~/features/tournament-bracket/core/Tournament.server"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import type { TournamentMaplistSource } from "~/modules/tournament-map-list-generator/types"; import { logger } from "~/utils/logger"; diff --git a/apps/web-react/app/features/tournament/TournamentRepository.server.ts b/apps/web-react/app/features/tournament/TournamentRepository.server.ts index e6c6dddc5..bccd24e73 100644 --- a/apps/web-react/app/features/tournament/TournamentRepository.server.ts +++ b/apps/web-react/app/features/tournament/TournamentRepository.server.ts @@ -1,3 +1,4 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import { sub } from "date-fns"; import { type Insertable, type NotNull, sql, type Transaction } from "kysely"; import { ordinal } from "openskill"; @@ -18,7 +19,6 @@ import type { TournamentTrophyReceiver, } from "~/features/tournament-bracket/tournament-bracket-schemas"; import type { TournamentOrganizationRole } from "~/features/tournament-organization/tournament-organization-constants"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { isSupporter } from "~/modules/permissions/utils"; import { nullFilledArray, nullifyingAvg } from "~/utils/arrays"; import { databaseTimestampNow, dateToDatabaseTimestamp } from "~/utils/dates"; diff --git a/apps/web-react/app/features/tournament/TournamentTeamRepository.server.ts b/apps/web-react/app/features/tournament/TournamentTeamRepository.server.ts index 9511f317d..743c6b3c1 100644 --- a/apps/web-react/app/features/tournament/TournamentTeamRepository.server.ts +++ b/apps/web-react/app/features/tournament/TournamentTeamRepository.server.ts @@ -1,10 +1,10 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { NotNull, Transaction } from "kysely"; import { sql } from "kysely"; import { db } from "~/db/sql"; import type { DB, Tables } from "~/db/tables"; import { actorId } from "~/features/auth/core/user.server"; import type { MapPool } from "~/features/map-list-generator/core/map-pool"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { flatZip } from "~/utils/arrays"; import { databaseTimestampNow, dateToDatabaseTimestamp } from "~/utils/dates"; import { shortNanoid } from "~/utils/id"; diff --git a/apps/web-react/app/features/tournament/components/CounterPickMapPoolPicker.tsx b/apps/web-react/app/features/tournament/components/CounterPickMapPoolPicker.tsx index e9ca7d28c..a3eefbb89 100644 --- a/apps/web-react/app/features/tournament/components/CounterPickMapPoolPicker.tsx +++ b/apps/web-react/app/features/tournament/components/CounterPickMapPoolPicker.tsx @@ -1,9 +1,9 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { useTranslation } from "react-i18next"; import { Alert } from "~/components/Alert"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import { ModeMapPoolPicker } from "~/features/settings/components/ModeMapPoolPicker"; import type { Tournament } from "~/features/tournament-bracket/core/Tournament"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { TOURNAMENT } from "../tournament-constants"; import { useTournament } from "../tournament-context"; import { diff --git a/apps/web-react/app/features/tournament/core/Standings.test.ts b/apps/web-react/app/features/tournament/core/Standings.test.ts index 7cf25a284..6a3303481 100644 --- a/apps/web-react/app/features/tournament/core/Standings.test.ts +++ b/apps/web-react/app/features/tournament/core/Standings.test.ts @@ -1,7 +1,7 @@ +import * as Engine from "@sendou/tournament-engine"; +import { createResolved } from "@sendou/tournament-engine/create"; +import type { BracketData } from "@sendou/tournament-engine/types"; import { describe, expect, test } from "vitest"; -import * as Engine from "~/features/tournament-bracket/core/engine"; -import { createResolved } from "~/features/tournament-bracket/core/engine/create"; -import type { BracketData } from "~/features/tournament-bracket/core/engine/types"; import { mergeStages, progressions, diff --git a/apps/web-react/app/features/tournament/core/sets.server.ts b/apps/web-react/app/features/tournament/core/sets.server.ts index 01f4cae7c..ff14c5b8b 100644 --- a/apps/web-react/app/features/tournament/core/sets.server.ts +++ b/apps/web-react/app/features/tournament/core/sets.server.ts @@ -1,6 +1,6 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; import type { FindByTournamentTeamIdItem } from "~/features/tournament-match/TournamentMatchRepository.server"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { parseMaplistSource } from "~/modules/tournament-map-list-generator/source"; import type { TournamentMaplistSource } from "~/modules/tournament-map-list-generator/types"; import { logger } from "~/utils/logger"; diff --git a/apps/web-react/app/features/tournament/loaders/to.$id.teams.$tid.comps.server.ts b/apps/web-react/app/features/tournament/loaders/to.$id.teams.$tid.comps.server.ts index ff804aa23..ca76fbe98 100644 --- a/apps/web-react/app/features/tournament/loaders/to.$id.teams.$tid.comps.server.ts +++ b/apps/web-react/app/features/tournament/loaders/to.$id.teams.$tid.comps.server.ts @@ -1,3 +1,4 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { LoaderFunctionArgs } from "react-router"; import { requireUser } from "~/features/auth/core/user.server"; import * as RunComps from "~/features/img-export/core/RunComps"; @@ -6,7 +7,6 @@ import * as ReportedWeaponRepository from "~/features/sendouq-match/ReportedWeap import { tournamentDataCached } from "~/features/tournament-bracket/core/Tournament.server"; import { tournamentTeamPageParamsSchema } from "~/features/tournament-bracket/tournament-bracket-schemas"; import * as TournamentMatchRepository from "~/features/tournament-match/TournamentMatchRepository.server"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { SerializeFrom } from "~/utils/remix"; import { forbidden, parseParams } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/tournament/routes/to.$id.rules.tsx b/apps/web-react/app/features/tournament/routes/to.$id.rules.tsx index ab14439d8..bf8603e49 100644 --- a/apps/web-react/app/features/tournament/routes/to.$id.rules.tsx +++ b/apps/web-react/app/features/tournament/routes/to.$id.rules.tsx @@ -1,3 +1,4 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { useLoaderData } from "react-router"; @@ -10,7 +11,6 @@ import { Section } from "~/components/Section"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import { mapsPageWithMapPool } from "~/features/map-list-generator/map-list-generator-urls"; import { useTournament } from "~/features/tournament/tournament-context"; -import { modesShort } from "~/modules/in-game-lists/modes"; import type { SendouRouteHandle } from "~/utils/remix.server"; import { navIconUrl } from "~/utils/urls"; import { loader } from "../loaders/to.$id.rules.server"; diff --git a/apps/web-react/app/features/tournament/tournament-constants.ts b/apps/web-react/app/features/tournament/tournament-constants.ts index c8cbbb0b9..932f1e2bc 100644 --- a/apps/web-react/app/features/tournament/tournament-constants.ts +++ b/apps/web-react/app/features/tournament/tournament-constants.ts @@ -1,6 +1,9 @@ +import { ENGINE_DEFAULTS } from "@sendou/tournament-engine"; import { Config } from "~/config"; import { TEAM } from "../team/team-constants"; +export { TOURNAMENT_STAGE_TYPES } from "@sendou/tournament-engine/types"; + export const TOURNAMENT = { TEAM_NAME_MAX_LENGTH: TEAM.NAME_MAX_LENGTH, COUNTERPICK_MAPS_PER_MODE: 2, @@ -14,12 +17,14 @@ export const TOURNAMENT = { BRACKET_NAME_MAX_LENGTH: 32, PLACEMENT_MAX: 100, // just a fallback, normally this should be set by user explicitly - RR_DEFAULT_TEAM_COUNT_PER_GROUP: 4, + RR_DEFAULT_TEAM_COUNT_PER_GROUP: + ENGINE_DEFAULTS.RR_DEFAULT_TEAM_COUNT_PER_GROUP, RR_TEAMS_PER_GROUP_OPTIONS: [3, 4, 5, 6], RR_AB_DIVISIONS_TEAMS_PER_GROUP_OPTIONS: [4, 6, 8, 10, 12], - SWISS_DEFAULT_GROUP_COUNT: 1, - SWISS_DEFAULT_ROUND_COUNT: 5, - SE_DEFAULT_HAS_THIRD_PLACE_MATCH: true, + SWISS_DEFAULT_GROUP_COUNT: ENGINE_DEFAULTS.SWISS_DEFAULT_GROUP_COUNT, + SWISS_DEFAULT_ROUND_COUNT: ENGINE_DEFAULTS.SWISS_DEFAULT_ROUND_COUNT, + SE_DEFAULT_HAS_THIRD_PLACE_MATCH: + ENGINE_DEFAULTS.SE_DEFAULT_HAS_THIRD_PLACE_MATCH, MAX_SAVED_COUNT: 20, /** How many days after a tournament ends VOD links are shown on the bracket */ VOD_VISIBILITY_DAYS: 7, @@ -35,13 +40,6 @@ export const TOURNAMENT = { }, } as const; -export const TOURNAMENT_STAGE_TYPES = [ - "single_elimination", - "double_elimination", - "round_robin", - "swiss", -] as const; - // AUTO = style where teams pick their map pool ahead of time and the map lists are automatically made for each round // could also have the traditional style where TO picks the maps later export type TournamentMapPickingStyle = diff --git a/apps/web-react/app/features/tournament/tournament-utils.server.ts b/apps/web-react/app/features/tournament/tournament-utils.server.ts index 6c6d5a2c6..639085c97 100644 --- a/apps/web-react/app/features/tournament/tournament-utils.server.ts +++ b/apps/web-react/app/features/tournament/tournament-utils.server.ts @@ -1,5 +1,5 @@ +import * as Engine from "@sendou/tournament-engine"; import * as LeaderboardRepository from "~/features/leaderboards/LeaderboardRepository.server"; -import * as Engine from "~/features/tournament-bracket/core/engine"; import * as TournamentOrganizationRepository from "~/features/tournament-organization/TournamentOrganizationRepository.server"; import { logger } from "~/utils/logger"; import { errorToast, errorToastIfFalsy } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/tournament/tournament-utils.ts b/apps/web-react/app/features/tournament/tournament-utils.ts index cec1ea16c..8fde6fd22 100644 --- a/apps/web-react/app/features/tournament/tournament-utils.ts +++ b/apps/web-react/app/features/tournament/tournament-utils.ts @@ -1,8 +1,8 @@ +import { modesShort, rankedModesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { sub } from "date-fns"; import * as R from "remeda"; import type { CastedMatchesInfo } from "~/db/tables-json"; -import { modesShort, rankedModesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { weekNumberToDate } from "~/utils/dates"; import { SHORT_NANOID_LENGTH } from "~/utils/id"; import type { Tables } from "../../db/tables"; diff --git a/apps/web-react/app/features/user-card/UserCardRepository.server.ts b/apps/web-react/app/features/user-card/UserCardRepository.server.ts index 0a4e7cbb2..fc2a6345f 100644 --- a/apps/web-react/app/features/user-card/UserCardRepository.server.ts +++ b/apps/web-react/app/features/user-card/UserCardRepository.server.ts @@ -1,3 +1,4 @@ +import type { StageId } from "@sendou/in-game-lists/types"; import { sub } from "date-fns"; import type { Expression, ExpressionBuilder } from "kysely"; import { sql } from "kysely"; @@ -14,7 +15,6 @@ import type { TieredSkill } from "~/features/mmr/tiered.server"; import { userSkills } from "~/features/mmr/tiered.server"; import type { XRankPlacementRegion } from "~/features/top-search/top-search-types"; import { LRUCache } from "~/modules/cache"; -import type { StageId } from "~/modules/in-game-lists/types"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import { asJson, diff --git a/apps/web-react/app/features/user-card/components/UserCard.tsx b/apps/web-react/app/features/user-card/components/UserCard.tsx index 886e951f4..8aaa88654 100644 --- a/apps/web-react/app/features/user-card/components/UserCard.tsx +++ b/apps/web-react/app/features/user-card/components/UserCard.tsx @@ -1,3 +1,4 @@ +import type { BrandId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { BadgeCheck, @@ -36,7 +37,6 @@ import { MutualFriends } from "~/features/user-page/components/MutualFriends"; import { ReportUserDialog } from "~/features/user-report/components/ReportUserDialog"; import { useActionSubmit } from "~/hooks/useActionSubmit"; import { useLayoutSize } from "~/hooks/useMainContentWidth"; -import type { BrandId } from "~/modules/in-game-lists/types"; import { assertUnreachable } from "~/utils/types"; import { brandImageUrl, diff --git a/apps/web-react/app/features/user-card/user-card-types.ts b/apps/web-react/app/features/user-card/user-card-types.ts index 2a4df76a5..822e6e1cf 100644 --- a/apps/web-react/app/features/user-card/user-card-types.ts +++ b/apps/web-react/app/features/user-card/user-card-types.ts @@ -1,7 +1,7 @@ +import type { StageId } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; import type { CustomTheme } from "~/db/tables-json"; import type { XRankPlacementRegion } from "~/features/top-search/top-search-types"; -import type { StageId } from "~/modules/in-game-lists/types"; import type { CommonUser } from "~/utils/kysely.server"; import type { TieredSkill } from "../mmr/tiered.server"; diff --git a/apps/web-react/app/features/user-page/actions/u.$identifier.builds.new.server.ts b/apps/web-react/app/features/user-page/actions/u.$identifier.builds.new.server.ts index 18bff73c8..adeaec17c 100644 --- a/apps/web-react/app/features/user-page/actions/u.$identifier.builds.new.server.ts +++ b/apps/web-react/app/features/user-page/actions/u.$identifier.builds.new.server.ts @@ -1,8 +1,8 @@ +import type { BuildAbilitiesTuple } from "@sendou/in-game-lists/types"; import { type ActionFunction, redirect } from "react-router"; import { requireUser } from "~/features/auth/core/user.server"; import * as BuildRepository from "~/features/builds/BuildRepository.server"; import { parseFormData } from "~/form/parse.server"; -import type { BuildAbilitiesTuple } from "~/modules/in-game-lists/types"; import { toDBBoolean } from "~/utils/sql"; import { userBuildsPage } from "~/utils/urls"; import { newBuildSchemaServer } from "../user-page-schemas.server"; diff --git a/apps/web-react/app/features/user-page/components/GameBadgeSelectField.tsx b/apps/web-react/app/features/user-page/components/GameBadgeSelectField.tsx index 98188bdb6..5dfb8fea4 100644 --- a/apps/web-react/app/features/user-page/components/GameBadgeSelectField.tsx +++ b/apps/web-react/app/features/user-page/components/GameBadgeSelectField.tsx @@ -1,10 +1,10 @@ -import { useState } from "react"; -import { useTranslation } from "react-i18next"; -import type { CustomFieldRenderProps } from "~/form/FormField"; import { GAME_BADGE_IDS, type GameBadgeId, -} from "~/modules/in-game-lists/game-badge-ids"; +} from "@sendou/in-game-lists/game-badge-ids"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import type { CustomFieldRenderProps } from "~/form/FormField"; import { gameBadgeUrl } from "~/utils/urls"; import styles from "./GameBadgeSelectField.module.css"; diff --git a/apps/web-react/app/features/user-page/components/NewBuildForm.browser.test.tsx b/apps/web-react/app/features/user-page/components/NewBuildForm.browser.test.tsx index 4f0638037..8863e6681 100644 --- a/apps/web-react/app/features/user-page/components/NewBuildForm.browser.test.tsx +++ b/apps/web-react/app/features/user-page/components/NewBuildForm.browser.test.tsx @@ -1,8 +1,8 @@ +import type { BuildAbilitiesTupleWithUnknown } from "@sendou/in-game-lists/types"; import { createMemoryRouter, RouterProvider } from "react-router"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { userEvent } from "vitest/browser"; import { render } from "vitest-browser-react"; -import type { BuildAbilitiesTupleWithUnknown } from "~/modules/in-game-lists/types"; import { NewBuildForm } from "./NewBuildForm"; let mockFetcherData: { fieldErrors?: Record } | undefined; diff --git a/apps/web-react/app/features/user-page/components/NewBuildForm.tsx b/apps/web-react/app/features/user-page/components/NewBuildForm.tsx index ce5ec634f..a45283dd6 100644 --- a/apps/web-react/app/features/user-page/components/NewBuildForm.tsx +++ b/apps/web-react/app/features/user-page/components/NewBuildForm.tsx @@ -1,3 +1,8 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import type { + BuildAbilitiesTupleWithUnknown, + GearType, +} from "@sendou/in-game-lists/types"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { AbilitiesSelector } from "~/components/AbilitiesSelector"; @@ -5,11 +10,6 @@ import { GearSelect } from "~/components/GearSelect"; import type { CustomFieldRenderProps } from "~/form/FormField"; import { FormFieldWrapper } from "~/form/fields/FormFieldWrapper"; import { SendouForm, useFormFieldContext } from "~/form/SendouForm"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; -import type { - BuildAbilitiesTupleWithUnknown, - GearType, -} from "~/modules/in-game-lists/types"; import { newBuildSchema } from "../user-page-schemas"; interface NewBuildFormProps { diff --git a/apps/web-react/app/features/user-page/components/Widget.tsx b/apps/web-react/app/features/user-page/components/Widget.tsx index 9b68ae6bc..ba07542cb 100644 --- a/apps/web-react/app/features/user-page/components/Widget.tsx +++ b/apps/web-react/app/features/user-page/components/Widget.tsx @@ -1,3 +1,9 @@ +import type { GameBadgeId } from "@sendou/in-game-lists/game-badge-ids"; +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { Link2 as LinkIcon } from "lucide-react"; import { useTranslation } from "react-i18next"; @@ -30,12 +36,6 @@ import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; import { useAutoRerender } from "~/hooks/useAutoRerender"; import { useMainContentWidth } from "~/hooks/useMainContentWidth"; import { usePagination } from "~/hooks/usePagination"; -import type { GameBadgeId } from "~/modules/in-game-lists/game-badge-ids"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { logger } from "~/utils/logger"; import type { SerializeFrom } from "~/utils/remix"; import { assertUnreachable } from "~/utils/types"; diff --git a/apps/web-react/app/features/user-page/core/build-sorting.server.test.ts b/apps/web-react/app/features/user-page/core/build-sorting.server.test.ts index d04e5bade..abba64fee 100644 --- a/apps/web-react/app/features/user-page/core/build-sorting.server.test.ts +++ b/apps/web-react/app/features/user-page/core/build-sorting.server.test.ts @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { databaseTimestampNow } from "~/utils/dates"; import { sortBuilds } from "./build-sorting.server"; diff --git a/apps/web-react/app/features/user-page/core/build-sorting.server.ts b/apps/web-react/app/features/user-page/core/build-sorting.server.ts index 3f1fd76a3..188113d9a 100644 --- a/apps/web-react/app/features/user-page/core/build-sorting.server.ts +++ b/apps/web-react/app/features/user-page/core/build-sorting.server.ts @@ -1,8 +1,8 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { weaponIdToBaseWeaponId } from "@sendou/in-game-lists/weapon-ids"; import type * as BuildRepository from "~/features/builds/BuildRepository.server"; import type { BuildSort } from "~/features/user-page/user-page-constants"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { weaponIdToBaseWeaponId } from "~/modules/in-game-lists/weapon-ids"; import { DEFAULT_BUILD_SORT } from "../user-page-constants"; interface SortBuildsArgs { diff --git a/apps/web-react/app/features/user-page/core/widgets/portfolio-loaders.server.ts b/apps/web-react/app/features/user-page/core/widgets/portfolio-loaders.server.ts index 24e005e4e..e2e776ca4 100644 --- a/apps/web-react/app/features/user-page/core/widgets/portfolio-loaders.server.ts +++ b/apps/web-react/app/features/user-page/core/widgets/portfolio-loaders.server.ts @@ -1,3 +1,4 @@ +import { weaponCategories } from "@sendou/in-game-lists/weapon-ids"; import * as ArtRepository from "~/features/art/ArtRepository.server"; import { getUser } from "~/features/auth/core/user.server"; import * as BadgeRepository from "~/features/badges/BadgeRepository.server"; @@ -14,7 +15,6 @@ import * as TrophyRepository from "~/features/trophies/TrophyRepository.server"; import { canAccessTrophies } from "~/features/trophies/trophies-utils"; import * as UserRepository from "~/features/user-page/UserRepository.server"; import * as VodRepository from "~/features/vods/VodRepository.server"; -import { weaponCategories } from "~/modules/in-game-lists/weapon-ids"; import type { ExtractWidgetSettings } from "./types"; import { cachedUserSQLeaderboardTopData } from "./utils.server"; diff --git a/apps/web-react/app/features/user-page/core/widgets/widget-form-schemas.ts b/apps/web-react/app/features/user-page/core/widgets/widget-form-schemas.ts index cfab696fe..10807c6c9 100644 --- a/apps/web-react/app/features/user-page/core/widgets/widget-form-schemas.ts +++ b/apps/web-react/app/features/user-page/core/widgets/widget-form-schemas.ts @@ -1,3 +1,4 @@ +import { GAME_BADGE_IDS } from "@sendou/in-game-lists/game-badge-ids"; import { z } from "zod"; import { ART_SOURCES } from "~/features/art/art-types"; import { TIMEZONES } from "~/features/lfg/lfg-constants"; @@ -13,7 +14,6 @@ import { weaponSelect, } from "~/form/fields"; import type { SelectOption } from "~/form/types"; -import { GAME_BADGE_IDS } from "~/modules/in-game-lists/game-badge-ids"; import { USER } from "../../user-page-constants"; export const bioSchema = z.object({ diff --git a/apps/web-react/app/features/user-page/loaders/u.$identifier.builds.new.server.ts b/apps/web-react/app/features/user-page/loaders/u.$identifier.builds.new.server.ts index 4958fe40a..1d4871caf 100644 --- a/apps/web-react/app/features/user-page/loaders/u.$identifier.builds.new.server.ts +++ b/apps/web-react/app/features/user-page/loaders/u.$identifier.builds.new.server.ts @@ -1,9 +1,9 @@ +import type { Ability, MainWeaponId } from "@sendou/in-game-lists/types"; import type { LoaderFunctionArgs } from "react-router"; import type { z } from "zod"; import { requireUser } from "~/features/auth/core/user.server"; import * as BuildRepository from "~/features/builds/BuildRepository.server"; import type { WeaponPoolItem } from "~/form/fields/WeaponPoolFormField"; -import type { Ability, MainWeaponId } from "~/modules/in-game-lists/types"; import type { SearchParamsValues } from "~/modules/search-params/search-params"; import type { newBuildBaseSchema } from "../user-page-schemas"; import { userBuildsNewSearchParams } from "../user-page-search-params"; diff --git a/apps/web-react/app/features/user-page/routes/u.$identifier.builds.tsx b/apps/web-react/app/features/user-page/routes/u.$identifier.builds.tsx index 673c57527..9d8412f19 100644 --- a/apps/web-react/app/features/user-page/routes/u.$identifier.builds.tsx +++ b/apps/web-react/app/features/user-page/routes/u.$identifier.builds.tsx @@ -1,3 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { ArrowDownNarrowWide, Lock, LockOpen, Trash } from "lucide-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -15,8 +17,6 @@ import { type BuildSort, } from "~/features/user-page/user-page-constants"; import { buildsActionSchema } from "~/features/user-page/user-page-schemas"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import { hasPermission } from "~/modules/permissions/utils"; import { useSearchParam } from "~/modules/search-params/hooks"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/user-page/routes/u.$identifier.edit.test.ts b/apps/web-react/app/features/user-page/routes/u.$identifier.edit.test.ts index 42bf9c052..b2d76e82f 100644 --- a/apps/web-react/app/features/user-page/routes/u.$identifier.edit.test.ts +++ b/apps/web-react/app/features/user-page/routes/u.$identifier.edit.test.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { beforeEach, describe, expect, test } from "vitest"; import * as UserFactory from "~/db/seed/factories/UserFactory"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import { wrappedAction } from "~/utils/Test"; import type { userEditProfileBaseSchema } from "../user-page-schemas"; import { action as editUserProfileAction } from "./u.$identifier.edit"; diff --git a/apps/web-react/app/features/user-page/routes/u.$identifier.index.tsx b/apps/web-react/app/features/user-page/routes/u.$identifier.index.tsx index 8291fb81f..4a5fd8410 100644 --- a/apps/web-react/app/features/user-page/routes/u.$identifier.index.tsx +++ b/apps/web-react/app/features/user-page/routes/u.$identifier.index.tsx @@ -1,3 +1,4 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import clsx from "clsx"; import { Pencil as EditIcon, Puzzle as PuzzleIcon } from "lucide-react"; import { useTranslation } from "react-i18next"; @@ -23,7 +24,6 @@ import { BadgeDisplay } from "~/features/badges/components/BadgeDisplay"; import { topSearchPlayerPage } from "~/features/top-search/top-search-urls"; import { TrophyDisplay } from "~/features/trophies/components/TrophyDisplay"; import { UserCard } from "~/features/user-card/components/UserCard"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { countryCodeToTranslatedName } from "~/utils/i18n"; import invariant from "~/utils/invariant"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/user-page/routes/u.$identifier.seasons.stats.tsx b/apps/web-react/app/features/user-page/routes/u.$identifier.seasons.stats.tsx index 6d85d2637..8d656d984 100644 --- a/apps/web-react/app/features/user-page/routes/u.$identifier.seasons.stats.tsx +++ b/apps/web-react/app/features/user-page/routes/u.$identifier.seasons.stats.tsx @@ -1,3 +1,6 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -14,9 +17,6 @@ import { import { ModeImage, StageImage, WeaponImage } from "~/components/Image"; import { userSeasonsPage } from "~/features/user-page/user-page-urls"; import { useWeaponUsage } from "~/hooks/swr"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import invariant from "~/utils/invariant"; import { cutToNDecimalPlaces } from "~/utils/number"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/user-page/user-page-schemas.ts b/apps/web-react/app/features/user-page/user-page-schemas.ts index 75ec3539f..97eeadf7f 100644 --- a/apps/web-react/app/features/user-page/user-page-schemas.ts +++ b/apps/web-react/app/features/user-page/user-page-schemas.ts @@ -1,3 +1,8 @@ +import { + clothesGearIds, + headGearIds, + shoesGearIds, +} from "@sendou/in-game-lists/gear-ids"; import { z } from "zod"; import { BADGE } from "~/features/badges/badges-constants"; import { SMALL_TROPHIES_PER_DISPLAY_PAGE } from "~/features/trophies/trophies-constants"; @@ -23,11 +28,6 @@ import { trophies, weaponPool, } from "~/form/fields"; -import { - clothesGearIds, - headGearIds, - shoesGearIds, -} from "~/modules/in-game-lists/gear-ids"; import { rawSensToString } from "~/utils/strings"; import { isCustomUrl } from "~/utils/urls"; import { diff --git a/apps/web-react/app/features/user-page/user-page-search-params.ts b/apps/web-react/app/features/user-page/user-page-search-params.ts index 431390763..60f943dab 100644 --- a/apps/web-react/app/features/user-page/user-page-search-params.ts +++ b/apps/web-react/app/features/user-page/user-page-search-params.ts @@ -1,3 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; import { ART_SOURCES } from "~/features/art/art-types"; import { serializedBuildCodec } from "~/features/build-analyzer/analyzer-search-params"; @@ -8,8 +10,6 @@ import { TIER_NUMBERS, WORST_TIER_NUMBER, } from "~/features/tournament/core/tiering"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/user-page/user-page-urls.ts b/apps/web-react/app/features/user-page/user-page-urls.ts index 747ed254e..fec5dcd10 100644 --- a/apps/web-react/app/features/user-page/user-page-urls.ts +++ b/apps/web-react/app/features/user-page/user-page-urls.ts @@ -1,7 +1,7 @@ import type { BuildAbilitiesTupleWithUnknown, MainWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { type UserLinkArgs, userBuildsPage, userPage } from "~/utils/urls"; import { userBuildsNewSearchParams, diff --git a/apps/web-react/app/features/vods/VodRepository.server.ts b/apps/web-react/app/features/vods/VodRepository.server.ts index cad2cee69..2b0eccb06 100644 --- a/apps/web-react/app/features/vods/VodRepository.server.ts +++ b/apps/web-react/app/features/vods/VodRepository.server.ts @@ -1,13 +1,13 @@ -import { sql } from "kysely"; -import * as R from "remeda"; -import { db } from "~/db/sql"; -import type { Tables } from "~/db/tables"; import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; -import { weaponIdToArrayWithAlts } from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/types"; +import { weaponIdToArrayWithAlts } from "@sendou/in-game-lists/weapon-ids"; +import { sql } from "kysely"; +import * as R from "remeda"; +import { db } from "~/db/sql"; +import type { Tables } from "~/db/tables"; import { dateToDatabaseTimestamp, dayMonthYearToDatabaseTimestamp, diff --git a/apps/web-react/app/features/vods/actions/vods.new.server.ts b/apps/web-react/app/features/vods/actions/vods.new.server.ts index ba8c8b053..e93f2cdc6 100644 --- a/apps/web-react/app/features/vods/actions/vods.new.server.ts +++ b/apps/web-react/app/features/vods/actions/vods.new.server.ts @@ -1,9 +1,9 @@ +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import { type ActionFunction, redirect } from "react-router"; import type { z } from "zod"; import { requireUser } from "~/features/auth/core/user.server"; import type { WeaponPoolItem } from "~/form/fields/WeaponPoolFormField"; import { parseFormData } from "~/form/parse.server"; -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; import { requireRole } from "~/modules/permissions/guards.server"; import { vodVideoPage } from "~/utils/urls"; import * as VodRepository from "../VodRepository.server"; diff --git a/apps/web-react/app/features/vods/routes/vods.$id.tsx b/apps/web-react/app/features/vods/routes/vods.$id.tsx index 5845d67ea..02ffe3642 100644 --- a/apps/web-react/app/features/vods/routes/vods.$id.tsx +++ b/apps/web-react/app/features/vods/routes/vods.$id.tsx @@ -1,3 +1,4 @@ +import { shortStageName } from "@sendou/in-game-lists/stage-ids"; import clsx from "clsx"; import { Check, ClipboardCopy, Copy, SquarePen, Trash } from "lucide-react"; import * as React from "react"; @@ -14,7 +15,6 @@ import { YouTubeEmbed } from "~/components/YouTubeEmbed"; import { useUser } from "~/features/auth/core/user"; import { newVodPage } from "~/features/vods/vods-urls"; import { useCopyToClipboard } from "~/hooks/useCopyToClipboard"; -import { shortStageName } from "~/modules/in-game-lists/stage-ids"; import { useHasPermission } from "~/modules/permissions/hooks"; import { useSearchParam } from "~/modules/search-params/hooks"; import { metaTags, type SerializeFrom } from "~/utils/remix"; diff --git a/apps/web-react/app/features/vods/routes/vods.new.browser.test.tsx b/apps/web-react/app/features/vods/routes/vods.new.browser.test.tsx index d20b16d32..3666f36e4 100644 --- a/apps/web-react/app/features/vods/routes/vods.new.browser.test.tsx +++ b/apps/web-react/app/features/vods/routes/vods.new.browser.test.tsx @@ -1,3 +1,8 @@ +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import { createMemoryRouter, RouterProvider } from "react-router"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { userEvent } from "vitest/browser"; @@ -5,11 +10,6 @@ import { render } from "vitest-browser-react"; import { FormField } from "~/form/FormField"; import type { WeaponPoolItem } from "~/form/fields/WeaponPoolFormField"; import { SendouForm, useFormFieldContext } from "~/form/SendouForm"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { vodFormBaseSchema } from "../vods-schemas"; let mockFetcherData: { fieldErrors?: Record } | undefined; diff --git a/apps/web-react/app/features/vods/routes/vods.new.tsx b/apps/web-react/app/features/vods/routes/vods.new.tsx index ff44c4651..1f9ae12cb 100644 --- a/apps/web-react/app/features/vods/routes/vods.new.tsx +++ b/apps/web-react/app/features/vods/routes/vods.new.tsx @@ -1,3 +1,4 @@ +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import clsx from "clsx"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; @@ -19,7 +20,6 @@ import { } from "~/form/SendouForm"; import { useIsomorphicLayoutEffect } from "~/hooks/useIsomorphicLayoutEffect"; import { useRecentlyReportedWeapons } from "~/hooks/useRecentlyReportedWeapons"; -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; import { useHasRole } from "~/modules/permissions/hooks"; import type { SendouRouteHandle } from "~/utils/remix.server"; import { Alert } from "../../../components/Alert"; diff --git a/apps/web-react/app/features/vods/routes/vods.tsx b/apps/web-react/app/features/vods/routes/vods.tsx index 133d4c3f4..3b1a928b5 100644 --- a/apps/web-react/app/features/vods/routes/vods.tsx +++ b/apps/web-react/app/features/vods/routes/vods.tsx @@ -1,3 +1,6 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { useTranslation } from "react-i18next"; import type { MetaFunction } from "react-router"; import { useLoaderData } from "react-router"; @@ -11,9 +14,6 @@ import { Main } from "~/components/Main"; import { Pagination } from "~/components/Pagination"; import { WeaponSelect } from "~/components/WeaponSelect"; import { useSearchParamPagination } from "~/hooks/useSearchParamPagination"; -import { modesShort } from "~/modules/in-game-lists/modes"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { metaTags } from "~/utils/remix"; import type { SendouRouteHandle } from "~/utils/remix.server"; diff --git a/apps/web-react/app/features/vods/vods-schemas.ts b/apps/web-react/app/features/vods/vods-schemas.ts index c9a1d6da6..886965453 100644 --- a/apps/web-react/app/features/vods/vods-schemas.ts +++ b/apps/web-react/app/features/vods/vods-schemas.ts @@ -1,3 +1,4 @@ +import { modesShort } from "@sendou/in-game-lists/modes"; import { add } from "date-fns"; import { z } from "zod"; import { @@ -14,7 +15,6 @@ import { weaponPool, weaponSelectOptional, } from "~/form/fields"; -import { modesShort } from "~/modules/in-game-lists/modes"; import { dayMonthYear, id, diff --git a/apps/web-react/app/features/vods/vods-search-params.ts b/apps/web-react/app/features/vods/vods-search-params.ts index 790a3fcf2..08f97027d 100644 --- a/apps/web-react/app/features/vods/vods-search-params.ts +++ b/apps/web-react/app/features/vods/vods-search-params.ts @@ -1,7 +1,7 @@ +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; import { ingestVodPrefillSchema } from "~/features/scanner-ingest/scanner-ingest-vod-schemas"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import * as SearchParams from "~/modules/search-params/search-params"; import { SP } from "~/modules/search-params/search-params"; import { modeShort, numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/features/vods/vods-types.ts b/apps/web-react/app/features/vods/vods-types.ts index e22f4fc80..4bf0df022 100644 --- a/apps/web-react/app/features/vods/vods-types.ts +++ b/apps/web-react/app/features/vods/vods-types.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import type { z } from "zod"; import type { Tables } from "~/db/tables"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { videoSchema } from "./vods-schemas"; export type VideoBeingAdded = z.infer; diff --git a/apps/web-react/app/features/vods/vods-utils.test.ts b/apps/web-react/app/features/vods/vods-utils.test.ts index b19f87aec..35e5832a1 100644 --- a/apps/web-react/app/features/vods/vods-utils.test.ts +++ b/apps/web-react/app/features/vods/vods-utils.test.ts @@ -1,9 +1,9 @@ -import { afterAll, beforeAll, describe, expect, test } from "vitest"; import type { MainWeaponId, ModeShort, StageId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; +import { afterAll, beforeAll, describe, expect, test } from "vitest"; import { dayMonthYearToDatabaseTimestamp } from "~/utils/dates"; import type { Vod } from "./vods-types"; import { diff --git a/apps/web-react/app/form/FormField.tsx b/apps/web-react/app/form/FormField.tsx index da39ba11a..f7ea0194b 100644 --- a/apps/web-react/app/form/FormField.tsx +++ b/apps/web-react/app/form/FormField.tsx @@ -1,6 +1,6 @@ +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import * as React from "react"; import type { z } from "zod"; -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; import { formRegistry } from "./fields"; import { ArrayFormField } from "./fields/ArrayFormField"; import { BadgesFormField } from "./fields/BadgesFormField"; diff --git a/apps/web-react/app/form/fields.ts b/apps/web-react/app/form/fields.ts index 327556665..978695ef0 100644 --- a/apps/web-react/app/form/fields.ts +++ b/apps/web-react/app/form/fields.ts @@ -1,10 +1,10 @@ +import { canonicalWeaponSplId } from "@sendou/in-game-lists/weapon-ids"; import * as R from "remeda"; import { z } from "zod"; import { IN_GAME_NAME_MAX_LENGTH, inGameNameIsValid, } from "~/features/user-page/in-game-name"; -import { canonicalWeaponSplId } from "~/modules/in-game-lists/weapon-ids"; import { date, falsyToNull, diff --git a/apps/web-react/app/form/fields/StageSelectFormField.tsx b/apps/web-react/app/form/fields/StageSelectFormField.tsx index 95bed6ec5..764e90e6b 100644 --- a/apps/web-react/app/form/fields/StageSelectFormField.tsx +++ b/apps/web-react/app/form/fields/StageSelectFormField.tsx @@ -1,5 +1,5 @@ +import type { StageId } from "@sendou/in-game-lists/types"; import { StageSelect } from "~/components/StageSelect"; -import type { StageId } from "~/modules/in-game-lists/types"; import type { FormFieldProps } from "../types"; import { FormFieldMessages, useTranslatedTexts } from "./FormFieldWrapper"; import styles from "./StageSelectFormField.module.css"; diff --git a/apps/web-react/app/form/fields/WeaponPoolFormField.tsx b/apps/web-react/app/form/fields/WeaponPoolFormField.tsx index 62a0556a7..e0eee4571 100644 --- a/apps/web-react/app/form/fields/WeaponPoolFormField.tsx +++ b/apps/web-react/app/form/fields/WeaponPoolFormField.tsx @@ -14,6 +14,8 @@ import { verticalListSortingStrategy, } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { weaponIdToArrayWithAlts } from "@sendou/in-game-lists/weapon-ids"; import clsx from "clsx"; import { Star, Trash } from "lucide-react"; import * as React from "react"; @@ -21,8 +23,6 @@ import { useTranslation } from "react-i18next"; import { SendouButton } from "~/components/elements/Button"; import { WeaponImage } from "~/components/Image"; import { WeaponSelect } from "~/components/WeaponSelect"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { weaponIdToArrayWithAlts } from "~/modules/in-game-lists/weapon-ids"; import type { FormFieldProps } from "../types"; import { FormFieldWrapper } from "./FormFieldWrapper"; diff --git a/apps/web-react/app/form/fields/WeaponSelectFormField.tsx b/apps/web-react/app/form/fields/WeaponSelectFormField.tsx index 625a8029b..649d4bb40 100644 --- a/apps/web-react/app/form/fields/WeaponSelectFormField.tsx +++ b/apps/web-react/app/form/fields/WeaponSelectFormField.tsx @@ -1,5 +1,5 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { WeaponSelect } from "~/components/WeaponSelect"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; import type { FormFieldProps } from "../types"; import { FormFieldMessages, useTranslatedTexts } from "./FormFieldWrapper"; import styles from "./WeaponSelectFormField.module.css"; diff --git a/apps/web-react/app/hooks/swr.ts b/apps/web-react/app/hooks/swr.ts index f2bc1073f..fe7fff520 100644 --- a/apps/web-react/app/hooks/swr.ts +++ b/apps/web-react/app/hooks/swr.ts @@ -1,9 +1,9 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import useSWRImmutable from "swr/immutable"; import type { PatronsListLoaderData } from "~/features/front-page/routes/patrons-list"; import { getWeaponUsage } from "~/features/sendouq/q-urls"; import type { FriendsForAddingLoaderData } from "~/features/sendouq/routes/friends-for-adding"; import type { WeaponUsageLoaderData } from "~/features/sendouq/routes/weapon-usage"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { logger } from "~/utils/logger"; import { GET_FRIENDS_FOR_ADDING_ROUTE, PATRONS_LIST_ROUTE } from "~/utils/urls"; diff --git a/apps/web-react/app/hooks/useRecentlyReportedWeapons.ts b/apps/web-react/app/hooks/useRecentlyReportedWeapons.ts index 2651972b9..c05ff859e 100644 --- a/apps/web-react/app/hooks/useRecentlyReportedWeapons.ts +++ b/apps/web-react/app/hooks/useRecentlyReportedWeapons.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import { usePersistedState } from "~/modules/persisted-state/hooks"; import * as PersistedState from "~/modules/persisted-state/persisted-state"; import { numericEnum } from "~/utils/zod"; diff --git a/apps/web-react/app/modules/tournament-map-list-generator/balanced-map-list.ts b/apps/web-react/app/modules/tournament-map-list-generator/balanced-map-list.ts index 43e0fcdb4..909f3f124 100644 --- a/apps/web-react/app/modules/tournament-map-list-generator/balanced-map-list.ts +++ b/apps/web-react/app/modules/tournament-map-list-generator/balanced-map-list.ts @@ -1,9 +1,9 @@ -import { stageIds } from "~/modules/in-game-lists/stage-ids"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { seededRandom } from "~/utils/random"; import { err, ok, type Result } from "~/utils/result"; -import type { ModeShort, StageId } from "../in-game-lists/types"; import { DEFAULT_MAP_POOL } from "./constants"; import type { TournamentMapListMap, diff --git a/apps/web-react/app/modules/tournament-map-list-generator/generation.test.ts b/apps/web-react/app/modules/tournament-map-list-generator/generation.test.ts index 9b75267eb..e845a463c 100644 --- a/apps/web-react/app/modules/tournament-map-list-generator/generation.test.ts +++ b/apps/web-react/app/modules/tournament-map-list-generator/generation.test.ts @@ -1,8 +1,8 @@ +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import type { RankedModeShort } from "@sendou/in-game-lists/types"; import { describe, expect, test } from "vitest"; import { MapPool } from "~/features/map-list-generator/core/map-pool"; import { unwrap, unwrapErr } from "~/utils/result"; -import { rankedModesShort } from "../in-game-lists/modes"; -import type { RankedModeShort } from "../in-game-lists/types"; import { generateBalancedMapList } from "./balanced-map-list"; import { DEFAULT_MAP_POOL } from "./constants"; import type { TournamentMaplistInput } from "./types"; diff --git a/apps/web-react/app/modules/tournament-map-list-generator/starter-map.ts b/apps/web-react/app/modules/tournament-map-list-generator/starter-map.ts index 593d55195..56426abf3 100644 --- a/apps/web-react/app/modules/tournament-map-list-generator/starter-map.ts +++ b/apps/web-react/app/modules/tournament-map-list-generator/starter-map.ts @@ -2,11 +2,11 @@ // if a tie breaker -> random tiebreaker // seed = always same -import { stageIds } from "~/modules/in-game-lists/stage-ids"; +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeWithStage } from "@sendou/in-game-lists/types"; import { logger } from "~/utils/logger"; import { seededRandom } from "~/utils/random"; -import { modesShort } from "../in-game-lists/modes"; -import type { ModeWithStage } from "../in-game-lists/types"; import type { TournamentMapListMap, TournamentMaplistInput } from "./types"; type StarterMapArgs = Pick< diff --git a/apps/web-react/app/modules/tournament-map-list-generator/types.ts b/apps/web-react/app/modules/tournament-map-list-generator/types.ts index e576ea2f1..df941d0c5 100644 --- a/apps/web-react/app/modules/tournament-map-list-generator/types.ts +++ b/apps/web-react/app/modules/tournament-map-list-generator/types.ts @@ -1,5 +1,5 @@ +import type { ModeShort, ModeWithStage } from "@sendou/in-game-lists/types"; import type { MapPool } from "~/features/map-list-generator/core/map-pool"; -import type { ModeShort, ModeWithStage } from "../in-game-lists/types"; import type { sourceTypes } from "./constants"; export interface TournamentMaplistInput { diff --git a/apps/web-react/app/utils/strings.ts b/apps/web-react/app/utils/strings.ts index 6632ae8b5..8e44d56fd 100644 --- a/apps/web-react/app/utils/strings.ts +++ b/apps/web-react/app/utils/strings.ts @@ -1,4 +1,4 @@ -import type { GearType } from "~/modules/in-game-lists/types"; +import type { GearType } from "@sendou/in-game-lists/types"; import { assertUnreachable } from "./types"; export function inGameNameWithoutDiscriminator(inGameName: string) { diff --git a/apps/web-react/app/utils/unslugify.server.ts b/apps/web-react/app/utils/unslugify.server.ts index e0dade059..523e0e2fb 100644 --- a/apps/web-react/app/utils/unslugify.server.ts +++ b/apps/web-react/app/utils/unslugify.server.ts @@ -2,7 +2,7 @@ import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import weaponTranslations from "../../locales/en/weapons.json"; import { mySlugify } from "./urls"; diff --git a/apps/web-react/app/utils/urls.ts b/apps/web-react/app/utils/urls.ts index 5e8f13c23..86896e465 100644 --- a/apps/web-react/app/utils/urls.ts +++ b/apps/web-react/app/utils/urls.ts @@ -1,13 +1,3 @@ -import slugify from "slugify"; -import { Config } from "~/config"; -import type { Tables } from "~/db/tables"; -import type { Preference } from "~/db/tables-json"; -import type { AuthErrorCode } from "~/features/auth/core/errors"; -import type { - StageBackgroundStyle, - StageWaterLevel, -} from "~/features/map-planner/plans-types"; -import type { TierName } from "~/features/mmr/mmr-constants"; import type { AbilityWithUnknown, BrandId, @@ -18,8 +8,18 @@ import type { SpecialWeaponId, StageId, SubWeaponId, -} from "~/modules/in-game-lists/types"; -import type { weaponCategories } from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/types"; +import type { weaponCategories } from "@sendou/in-game-lists/weapon-ids"; +import slugify from "slugify"; +import { Config } from "~/config"; +import type { Tables } from "~/db/tables"; +import type { Preference } from "~/db/tables-json"; +import type { AuthErrorCode } from "~/features/auth/core/errors"; +import type { + StageBackgroundStyle, + StageWaterLevel, +} from "~/features/map-planner/plans-types"; +import type { TierName } from "~/features/mmr/mmr-constants"; export const discordAvatarUrl = ({ discordId, diff --git a/apps/web-react/app/utils/zod.ts b/apps/web-react/app/utils/zod.ts index 8f639645f..a51ecefa6 100644 --- a/apps/web-react/app/utils/zod.ts +++ b/apps/web-react/app/utils/zod.ts @@ -1,15 +1,15 @@ -import type { ZodType } from "zod"; -import { z } from "zod"; import { abilities, type abilitiesShort, -} from "~/modules/in-game-lists/abilities"; -import { stageIds } from "~/modules/in-game-lists/stage-ids"; +} from "@sendou/in-game-lists/abilities"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; import { mainWeaponIds, specialWeaponIds, subWeaponIds, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import type { ZodType } from "zod"; +import { z } from "zod"; import { SHORT_NANOID_LENGTH } from "./id"; import type { Unpacked } from "./types"; import { assertType } from "./types"; diff --git a/apps/web-react/e2e/builds.spec.ts b/apps/web-react/e2e/builds.spec.ts index be3813309..06e3b4a6d 100644 --- a/apps/web-react/e2e/builds.spec.ts +++ b/apps/web-react/e2e/builds.spec.ts @@ -1,7 +1,7 @@ +import type { BuildAbilitiesTuple } from "@sendou/in-game-lists/types"; import { subDays } from "date-fns"; import { NZAP_TEST_DISCORD_ID, NZAP_TEST_ID } from "~/db/seed/constants"; import { ADMIN_DISCORD_ID, ADMIN_ID } from "~/features/admin/admin-constants"; -import type { BuildAbilitiesTuple } from "~/modules/in-game-lists/types"; import { expect, impersonate, test } from "./helpers/playwright"; import { BuildFormPage } from "./pages/builds/build-form-page"; import { BuildsPage } from "./pages/builds/builds-page"; diff --git a/apps/web-react/e2e/helpers/counterpick-map-pool.ts b/apps/web-react/e2e/helpers/counterpick-map-pool.ts index dbca8bc6a..4b2f77ee1 100644 --- a/apps/web-react/e2e/helpers/counterpick-map-pool.ts +++ b/apps/web-react/e2e/helpers/counterpick-map-pool.ts @@ -1,8 +1,8 @@ import type { Page } from "@playwright/test"; +import { rankedModesShort } from "@sendou/in-game-lists/modes"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { BANNED_MAPS } from "~/features/match-profile/banned-maps"; import { TOURNAMENT } from "~/features/tournament/tournament-constants"; -import { rankedModesShort } from "~/modules/in-game-lists/modes"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; /** Stage the counterpick picking starts from, leaving the lowest ids to tiebreakers. */ const FIRST_COUNTERPICK_STAGE_ID = 5; diff --git a/apps/web-react/e2e/helpers/tournament.ts b/apps/web-react/e2e/helpers/tournament.ts index 8c057ac7a..a171ff2b9 100644 --- a/apps/web-react/e2e/helpers/tournament.ts +++ b/apps/web-react/e2e/helpers/tournament.ts @@ -1,8 +1,8 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { addHours, subMinutes } from "date-fns"; import type { TournamentSettings } from "~/db/tables-json"; import { ADMIN_ID } from "~/features/admin/admin-constants"; import type { TournamentTierNumber } from "~/features/tournament/core/tiering"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import invariant from "~/utils/invariant"; import type { Factories } from "./factories"; diff --git a/apps/web-react/e2e/pages/analyzer/analyzer-page.ts b/apps/web-react/e2e/pages/analyzer/analyzer-page.ts index 6faaeb09c..365e2c8e6 100644 --- a/apps/web-react/e2e/pages/analyzer/analyzer-page.ts +++ b/apps/web-react/e2e/pages/analyzer/analyzer-page.ts @@ -1,5 +1,5 @@ import type { Locator, Page } from "@playwright/test"; -import type { Ability } from "~/modules/in-game-lists/types"; +import type { Ability } from "@sendou/in-game-lists/types"; import { ANALYZER_URL, weaponParamsPage } from "~/utils/urls"; import { expect, navigate, selectWeapon } from "../../helpers/playwright"; import { BuildFormPage } from "../builds/build-form-page"; diff --git a/apps/web-react/e2e/pages/builds/build-form-page.ts b/apps/web-react/e2e/pages/builds/build-form-page.ts index 55e8b21bd..ff65ebd05 100644 --- a/apps/web-react/e2e/pages/builds/build-form-page.ts +++ b/apps/web-react/e2e/pages/builds/build-form-page.ts @@ -1,7 +1,7 @@ import type { Page } from "@playwright/test"; +import type { Ability, GearType } from "@sendou/in-game-lists/types"; import { newBuildBaseSchema } from "~/features/user-page/user-page-schemas"; import { userNewBuildPage } from "~/features/user-page/user-page-urls"; -import type { Ability, GearType } from "~/modules/in-game-lists/types"; import { navigate } from "../../helpers/playwright"; import { createFormHelpers } from "../../helpers/playwright-form"; diff --git a/apps/web-react/e2e/pages/builds/builds-page.ts b/apps/web-react/e2e/pages/builds/builds-page.ts index 0d70d5c5b..22b7ba8c1 100644 --- a/apps/web-react/e2e/pages/builds/builds-page.ts +++ b/apps/web-react/e2e/pages/builds/builds-page.ts @@ -1,5 +1,5 @@ import type { Page } from "@playwright/test"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { BUILDS_PAGE } from "~/utils/urls"; import { navigate } from "../../helpers/playwright"; diff --git a/apps/web-react/e2e/pages/builds/weapon-builds-page.ts b/apps/web-react/e2e/pages/builds/weapon-builds-page.ts index f91edfcf6..eb49cc426 100644 --- a/apps/web-react/e2e/pages/builds/weapon-builds-page.ts +++ b/apps/web-react/e2e/pages/builds/weapon-builds-page.ts @@ -1,5 +1,5 @@ import type { Page } from "@playwright/test"; -import type { Ability, ModeShort } from "~/modules/in-game-lists/types"; +import type { Ability, ModeShort } from "@sendou/in-game-lists/types"; import { weaponBuildPage } from "~/utils/urls"; import { navigate } from "../../helpers/playwright"; import { BuildCard } from "./build-card"; diff --git a/apps/web-react/e2e/pages/comp-analyzer/comp-analyzer-page.ts b/apps/web-react/e2e/pages/comp-analyzer/comp-analyzer-page.ts index 26819ec50..f522e56d7 100644 --- a/apps/web-react/e2e/pages/comp-analyzer/comp-analyzer-page.ts +++ b/apps/web-react/e2e/pages/comp-analyzer/comp-analyzer-page.ts @@ -1,5 +1,5 @@ import type { Locator, Page } from "@playwright/test"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { COMP_ANALYZER_URL } from "~/utils/urls"; import { navigate } from "../../helpers/playwright"; diff --git a/apps/web-react/e2e/pages/sendouq/group-card.ts b/apps/web-react/e2e/pages/sendouq/group-card.ts index b58d80b28..eb369aa33 100644 --- a/apps/web-react/e2e/pages/sendouq/group-card.ts +++ b/apps/web-react/e2e/pages/sendouq/group-card.ts @@ -1,5 +1,5 @@ import type { Locator } from "@playwright/test"; -import type { ModeShort } from "~/modules/in-game-lists/types"; +import type { ModeShort } from "@sendou/in-game-lists/types"; import { modalClickConfirmButton, submit } from "../../helpers/playwright"; import { UserCard } from "../user/user-card"; diff --git a/apps/web-react/e2e/pages/sendouq/sendouq-match-page.ts b/apps/web-react/e2e/pages/sendouq/sendouq-match-page.ts index d72faa839..c5da8093e 100644 --- a/apps/web-react/e2e/pages/sendouq/sendouq-match-page.ts +++ b/apps/web-react/e2e/pages/sendouq/sendouq-match-page.ts @@ -1,6 +1,6 @@ import type { Page } from "@playwright/test"; +import type { ModeWithStage } from "@sendou/in-game-lists/types"; import { SENDOUQ_BEST_OF } from "~/features/sendouq/q-constants"; -import type { ModeWithStage } from "~/modules/in-game-lists/types"; import { sendouQMatchPage } from "~/utils/urls"; import { expect, diff --git a/apps/web-react/e2e/pages/settings/map-mode-preferences-field.ts b/apps/web-react/e2e/pages/settings/map-mode-preferences-field.ts index 0c20b0ea0..571b4949c 100644 --- a/apps/web-react/e2e/pages/settings/map-mode-preferences-field.ts +++ b/apps/web-react/e2e/pages/settings/map-mode-preferences-field.ts @@ -1,5 +1,5 @@ import type { Page } from "@playwright/test"; -import type { ModeShort } from "~/modules/in-game-lists/types"; +import type { ModeShort } from "@sendou/in-game-lists/types"; export const SELECTED_MAP_CLASS = /mapButtonGreyedOut/; diff --git a/apps/web-react/e2e/pages/top-search/top-search-page.ts b/apps/web-react/e2e/pages/top-search/top-search-page.ts index e05077974..d81e71f80 100644 --- a/apps/web-react/e2e/pages/top-search/top-search-page.ts +++ b/apps/web-react/e2e/pages/top-search/top-search-page.ts @@ -1,7 +1,7 @@ import type { Page } from "@playwright/test"; +import type { RankedModeShort } from "@sendou/in-game-lists/types"; import type { Tables } from "~/db/tables"; import { topSearchPage } from "~/features/top-search/top-search-urls"; -import type { RankedModeShort } from "~/modules/in-game-lists/types"; import { navigate } from "../../helpers/playwright"; import { PlacementsTable } from "./placements-table"; diff --git a/apps/web-react/e2e/pages/tournament/tournament-admin-registration-page.ts b/apps/web-react/e2e/pages/tournament/tournament-admin-registration-page.ts index 141332dc4..4703eb7e6 100644 --- a/apps/web-react/e2e/pages/tournament/tournament-admin-registration-page.ts +++ b/apps/web-react/e2e/pages/tournament/tournament-admin-registration-page.ts @@ -1,6 +1,6 @@ import { expect, type Page } from "@playwright/test"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { adminRegistrationFormSchema } from "~/features/tournament-admin/tournament-admin-registration-schemas"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { tournamentAdminRegistrationEditPage, tournamentAdminRegistrationPage, diff --git a/apps/web-react/e2e/pages/tournament/tournament-register-page.ts b/apps/web-react/e2e/pages/tournament/tournament-register-page.ts index 9b1e6166c..36e43c296 100644 --- a/apps/web-react/e2e/pages/tournament/tournament-register-page.ts +++ b/apps/web-react/e2e/pages/tournament/tournament-register-page.ts @@ -1,6 +1,6 @@ import type { Page } from "@playwright/test"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { registerTeamFormSchema } from "~/features/tournament/tournament-register-schemas"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { tournamentRegisterPage } from "~/utils/urls"; import { counterpickMap, diff --git a/apps/web-react/e2e/pages/tournament/tournament-team-page.ts b/apps/web-react/e2e/pages/tournament/tournament-team-page.ts index f5bc035ba..afb7bbe76 100644 --- a/apps/web-react/e2e/pages/tournament/tournament-team-page.ts +++ b/apps/web-react/e2e/pages/tournament/tournament-team-page.ts @@ -1,5 +1,5 @@ import type { Page } from "@playwright/test"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { tournamentTeamPage } from "~/utils/urls"; import { navigate } from "../../helpers/playwright"; diff --git a/apps/web-react/e2e/pages/vods/vod-page.ts b/apps/web-react/e2e/pages/vods/vod-page.ts index 3afef5eeb..21edd84e3 100644 --- a/apps/web-react/e2e/pages/vods/vod-page.ts +++ b/apps/web-react/e2e/pages/vods/vod-page.ts @@ -1,5 +1,5 @@ import type { Page } from "@playwright/test"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; +import type { MainWeaponId } from "@sendou/in-game-lists/types"; import { vodVideoPage } from "~/utils/urls"; import { navigate } from "../../helpers/playwright"; import { NewVodPage } from "./new-vod-page"; diff --git a/apps/web-react/e2e/scrims.spec.ts b/apps/web-react/e2e/scrims.spec.ts index 718bcedba..256ccbff1 100644 --- a/apps/web-react/e2e/scrims.spec.ts +++ b/apps/web-react/e2e/scrims.spec.ts @@ -1,8 +1,8 @@ +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { addDays, addHours, setHours, setMinutes, startOfHour } from "date-fns"; import { NZAP_TEST_ID } from "~/db/seed/constants"; import { ADMIN_ID } from "~/features/admin/admin-constants"; import { serializeLutiDiv } from "~/features/scrims/scrims-utils"; -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; import { dateToDatabaseTimestamp } from "~/utils/dates"; import { toDBBoolean } from "~/utils/sql"; import type { Factories } from "./helpers/factories"; diff --git a/apps/web-react/e2e/settings.spec.ts b/apps/web-react/e2e/settings.spec.ts index 5bb3e1daf..cf7ea7e8c 100644 --- a/apps/web-react/e2e/settings.spec.ts +++ b/apps/web-react/e2e/settings.spec.ts @@ -1,5 +1,5 @@ +import type { BuildAbilitiesTuple } from "@sendou/in-game-lists/types"; import { ADMIN_ID } from "~/features/admin/admin-constants"; -import type { BuildAbilitiesTuple } from "~/modules/in-game-lists/types"; import type { Factories } from "./helpers/factories"; import { expect, impersonate, isNotVisible, test } from "./helpers/playwright"; import { WeaponBuildsPage } from "./pages/builds/weapon-builds-page"; diff --git a/apps/web-react/e2e/vods.spec.ts b/apps/web-react/e2e/vods.spec.ts index 6bf11cfa0..b01c1786e 100644 --- a/apps/web-react/e2e/vods.spec.ts +++ b/apps/web-react/e2e/vods.spec.ts @@ -1,6 +1,6 @@ +import type { MainWeaponId, StageId } from "@sendou/in-game-lists/types"; import { NZAP_TEST_ID } from "~/db/seed/constants"; import { ADMIN_ID } from "~/features/admin/admin-constants"; -import type { MainWeaponId, StageId } from "~/modules/in-game-lists/types"; import { vodVideoPage } from "~/utils/urls"; import { expect, impersonate, isNotVisible, test } from "./helpers/playwright"; import { NewVodPage } from "./pages/vods/new-vod-page"; diff --git a/apps/web-react/package.json b/apps/web-react/package.json index 46b0be673..be989778f 100644 --- a/apps/web-react/package.json +++ b/apps/web-react/package.json @@ -61,6 +61,8 @@ "@internationalized/date": "3.12.3", "@react-router/node": "8.3.0", "@react-router/serve": "8.1.0", + "@sendou/in-game-lists": "workspace:*", + "@sendou/tournament-engine": "workspace:*", "@techstark/opencv-js": "5.0.0-release.1", "@tldraw/tldraw": "3.12.1", "@zumer/snapdom": "2.23.2", @@ -68,7 +70,6 @@ "clsx": "2.1.1", "compressorjs": "1.3.0", "date-fns": "4.4.0", - "edmonds-blossom-fixed": "1.0.1", "fflate": "0.8.3", "gray-matter": "4.0.3", "i18next": "26.3.6", diff --git a/apps/web-react/scripts/benchmark-db/fixtures.ts b/apps/web-react/scripts/benchmark-db/fixtures.ts index ff7388236..ca130fc1f 100644 --- a/apps/web-react/scripts/benchmark-db/fixtures.ts +++ b/apps/web-react/scripts/benchmark-db/fixtures.ts @@ -1,13 +1,13 @@ +import type { + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; import { sub } from "date-fns"; import { sql } from "kysely"; import { db } from "~/db/sql"; import type { Tables } from "~/db/tables"; import type { SkillTeamIdentifier } from "~/features/mmr/mmr-utils"; -import type { - MainWeaponId, - ModeShort, - StageId, -} from "~/modules/in-game-lists/types"; import { databaseTimestampToDate } from "~/utils/dates"; import { logger } from "~/utils/logger"; diff --git a/apps/web-react/scripts/create-analyzer-json.ts b/apps/web-react/scripts/create-analyzer-json.ts index a9dfcec1e..31107fdf9 100644 --- a/apps/web-react/scripts/create-analyzer-json.ts +++ b/apps/web-react/scripts/create-analyzer-json.ts @@ -3,6 +3,16 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; +import type { + MainWeaponId, + SpecialWeaponId, + SubWeaponId, +} from "@sendou/in-game-lists/types"; +import { + SQUID_BEAKON_ID, + subWeaponIds, + weaponIdToBaseWeaponId, +} from "@sendou/in-game-lists/weapon-ids"; import { z } from "zod"; import type { BaseWeaponStats, @@ -11,16 +21,6 @@ import type { SubWeaponParams, WeaponKit, } from "~/features/build-analyzer/analyzer-types"; -import type { - MainWeaponId, - SpecialWeaponId, - SubWeaponId, -} from "~/modules/in-game-lists/types"; -import { - SQUID_BEAKON_ID, - subWeaponIds, - weaponIdToBaseWeaponId, -} from "~/modules/in-game-lists/weapon-ids"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { diff --git a/apps/web-react/scripts/create-gear-json.ts b/apps/web-react/scripts/create-gear-json.ts index da69b3e28..3455e989b 100644 --- a/apps/web-react/scripts/create-gear-json.ts +++ b/apps/web-react/scripts/create-gear-json.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import { brandIds } from "~/modules/in-game-lists/brand-ids"; +import { brandIds } from "@sendou/in-game-lists/brand-ids"; import invariant from "~/utils/invariant"; import { LANG_JSONS_TO_CREATE, diff --git a/apps/web-react/scripts/create-misc-json.ts b/apps/web-react/scripts/create-misc-json.ts index f181852d9..6fa926ac8 100644 --- a/apps/web-react/scripts/create-misc-json.ts +++ b/apps/web-react/scripts/create-misc-json.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import { abilitiesShort } from "~/modules/in-game-lists/abilities"; -import { brandIds } from "~/modules/in-game-lists/brand-ids"; +import { abilitiesShort } from "@sendou/in-game-lists/abilities"; +import { brandIds } from "@sendou/in-game-lists/brand-ids"; import invariant from "~/utils/invariant"; import { LANG_JSONS_TO_CREATE, diff --git a/apps/web-react/scripts/create-object-dmg-json.ts b/apps/web-react/scripts/create-object-dmg-json.ts index 6ff5cc3e1..4bcc7f141 100644 --- a/apps/web-react/scripts/create-object-dmg-json.ts +++ b/apps/web-react/scripts/create-object-dmg-json.ts @@ -1,17 +1,17 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import { DAMAGE_RECEIVERS } from "~/features/object-damage-calculator/calculator-constants"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId, -} from "~/modules/in-game-lists/types"; +} from "@sendou/in-game-lists/types"; import { mainWeaponIds, specialWeaponIds, subWeaponIds, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; +import { DAMAGE_RECEIVERS } from "~/features/object-damage-calculator/calculator-constants"; // To run this script drop the https://github.com/Leanny/splat3 repo into scripts/dicts/splat3 import { loadDamageRateInfo, diff --git a/apps/web-react/scripts/placements/index.ts b/apps/web-react/scripts/placements/index.ts index f83a840e2..633fa3217 100644 --- a/apps/web-react/scripts/placements/index.ts +++ b/apps/web-react/scripts/placements/index.ts @@ -1,8 +1,8 @@ +import type { MainWeaponId } from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import * as BadgeRepository from "~/features/badges/BadgeRepository.server"; import * as BuildRepository from "~/features/builds/BuildRepository.server"; import * as XRankPlacementRepository from "~/features/top-search/XRankPlacementRepository.server"; -import type { MainWeaponId } from "~/modules/in-game-lists/types"; -import { mainWeaponIds } from "~/modules/in-game-lists/weapon-ids"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { xRankSchema } from "./schemas"; diff --git a/apps/web-react/scripts/scanner/build-localized-entries.ts b/apps/web-react/scripts/scanner/build-localized-entries.ts index c3b26a72e..051db114d 100644 --- a/apps/web-react/scripts/scanner/build-localized-entries.ts +++ b/apps/web-react/scripts/scanner/build-localized-entries.ts @@ -27,10 +27,10 @@ */ import { readdirSync, readFileSync, writeFileSync } from "node:fs"; import { join } from "node:path"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import { ALL_WEAPON_ENTRIES } from "../../app/features/scanner/core/detectors/death/weapon-names"; import type { ScannerLobby } from "../../app/features/scanner/scanner-types"; -import { stageIds } from "../../app/modules/in-game-lists/stage-ids"; -import type { ModeShort, StageId } from "../../app/modules/in-game-lists/types"; import gameMisc from "../../locales/en/game-misc.json"; const SPLAT3_DIR = @@ -344,7 +344,7 @@ writeFileSync( * mapped to the sendou.ink id it means (core/localized.ts derives the * flattened match sets detectors snap OCR output against).`, )} -import type { ModeShort, StageId } from "~/modules/in-game-lists/types"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; import type { ScannerLobby } from "../scanner-types"; export interface LocalizedLobby { diff --git a/apps/web-react/scripts/scanner/status-audit.ts b/apps/web-react/scripts/scanner/status-audit.ts index 9fea2b826..84c4a702a 100644 --- a/apps/web-react/scripts/scanner/status-audit.ts +++ b/apps/web-react/scripts/scanner/status-audit.ts @@ -19,6 +19,15 @@ * Usage: pnpm scanner:status-audit [--all] */ import { readFileSync } from "node:fs"; +import { modesShort } from "@sendou/in-game-lists/modes"; +import { stageIds } from "@sendou/in-game-lists/stage-ids"; +import type { + AbilityWithUnknown, + MainWeaponId, + ModeShort, + StageId, +} from "@sendou/in-game-lists/types"; +import { mainWeaponIds } from "@sendou/in-game-lists/weapon-ids"; import { statusSpans } from "../../app/components/PlayerStatusTimeline"; import { formatTime } from "../../app/features/scanner/components/format"; import { @@ -74,15 +83,6 @@ import type { ScannerMatchPlayerStatusSample, } from "../../app/features/scanner/core/scanner-match"; import type { ScannerLobby } from "../../app/features/scanner/scanner-types"; -import { modesShort } from "../../app/modules/in-game-lists/modes"; -import { stageIds } from "../../app/modules/in-game-lists/stage-ids"; -import type { - AbilityWithUnknown, - MainWeaponId, - ModeShort, - StageId, -} from "../../app/modules/in-game-lists/types"; -import { mainWeaponIds } from "../../app/modules/in-game-lists/weapon-ids"; /** Mirrors PlayerStatusTimeline's MAX_BRIDGE_SECONDS: longer sample gaps render as unobserved. */ const OBSERVATION_GAP_SECONDS = 15; diff --git a/apps/web-react/scripts/sync-weapon-params.ts b/apps/web-react/scripts/sync-weapon-params.ts index 8073d2fc3..6de2ceae3 100644 --- a/apps/web-react/scripts/sync-weapon-params.ts +++ b/apps/web-react/scripts/sync-weapon-params.ts @@ -5,7 +5,7 @@ import { mainWeaponIds, specialWeaponIds, subWeaponIds, -} from "~/modules/in-game-lists/weapon-ids"; +} from "@sendou/in-game-lists/weapon-ids"; import { logger } from "~/utils/logger"; import { loadWeaponInfoMain, diff --git a/apps/web-react/vite.config.ts b/apps/web-react/vite.config.ts index b377816ad..fb8178cc6 100644 --- a/apps/web-react/vite.config.ts +++ b/apps/web-react/vite.config.ts @@ -108,7 +108,6 @@ export default defineConfig((config) => { "date-fns/locale/pt-BR", "date-fns/locale/ru", "date-fns/locale/zh-CN", - "edmonds-blossom-fixed", "fflate", "i18next-browser-languagedetector", "i18next-http-backend", diff --git a/apps/web-react/vitest.unit.config.ts b/apps/web-react/vitest.unit.config.ts index 75a5e0ba7..86c75ea43 100644 --- a/apps/web-react/vitest.unit.config.ts +++ b/apps/web-react/vitest.unit.config.ts @@ -3,7 +3,7 @@ import { configDefaults, defineConfig } from "vitest/config"; export default defineConfig({ test: { name: "unit", - include: ["**/*.test.{ts,tsx}"], + include: ["**/*.test.{ts,tsx}", "../../packages/*/src/**/*.test.{ts,tsx}"], exclude: [ ...configDefaults.exclude, "e2e/**", diff --git a/package.json b/package.json index 562a27626..56904bb82 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "i18n:sync": "pnpm --filter web-react run i18n:sync", "knip": "pnpm --filter web-react run knip", "checks": "pnpm --filter web-react run checks", - "manifest:report": "pnpm --filter @sendou-ink/codemods run manifest:report" + "manifest:report": "pnpm --filter @sendou/codemods run manifest:report" }, "devDependencies": { "@biomejs/biome": "2.5.7" diff --git a/packages/in-game-lists/package.json b/packages/in-game-lists/package.json new file mode 100644 index 000000000..1459d4a98 --- /dev/null +++ b/packages/in-game-lists/package.json @@ -0,0 +1,13 @@ +{ + "name": "@sendou/in-game-lists", + "version": "0.0.0", + "private": true, + "type": "module", + "exports": { + "./*": "./src/*.ts" + }, + "devDependencies": { + "typescript": "7.0.2", + "vitest": "4.1.10" + } +} diff --git a/apps/web-react/app/modules/in-game-lists/abilities.ts b/packages/in-game-lists/src/abilities.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/abilities.ts rename to packages/in-game-lists/src/abilities.ts diff --git a/packages/in-game-lists/src/assert.ts b/packages/in-game-lists/src/assert.ts new file mode 100644 index 000000000..26f1748db --- /dev/null +++ b/packages/in-game-lists/src/assert.ts @@ -0,0 +1,5 @@ +export function assertUnreachable(x: never): never { + throw new Error( + `Didn't expect to get here. Unexpected value: ${JSON.stringify(x)}`, + ); +} diff --git a/apps/web-react/app/modules/in-game-lists/brand-ids.ts b/packages/in-game-lists/src/brand-ids.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/brand-ids.ts rename to packages/in-game-lists/src/brand-ids.ts diff --git a/apps/web-react/app/modules/in-game-lists/game-badge-ids.ts b/packages/in-game-lists/src/game-badge-ids.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/game-badge-ids.ts rename to packages/in-game-lists/src/game-badge-ids.ts diff --git a/apps/web-react/app/modules/in-game-lists/games.ts b/packages/in-game-lists/src/games.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/games.ts rename to packages/in-game-lists/src/games.ts diff --git a/apps/web-react/app/modules/in-game-lists/gear-ids.ts b/packages/in-game-lists/src/gear-ids.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/gear-ids.ts rename to packages/in-game-lists/src/gear-ids.ts diff --git a/apps/web-react/app/modules/in-game-lists/modes.ts b/packages/in-game-lists/src/modes.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/modes.ts rename to packages/in-game-lists/src/modes.ts diff --git a/apps/web-react/app/modules/in-game-lists/stage-ids.ts b/packages/in-game-lists/src/stage-ids.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/stage-ids.ts rename to packages/in-game-lists/src/stage-ids.ts diff --git a/apps/web-react/app/modules/in-game-lists/types.ts b/packages/in-game-lists/src/types.ts similarity index 92% rename from apps/web-react/app/modules/in-game-lists/types.ts rename to packages/in-game-lists/src/types.ts index d0df91aeb..d3b5affdd 100644 --- a/apps/web-react/app/modules/in-game-lists/types.ts +++ b/packages/in-game-lists/src/types.ts @@ -26,6 +26,11 @@ export type MainWeaponId = (typeof mainWeaponIds)[number]; export type SubWeaponId = (typeof subWeaponIds)[number]; export type SpecialWeaponId = (typeof specialWeaponIds)[number]; +export type AnyWeapon = + | { type: "MAIN"; id: MainWeaponId } + | { type: "SUB"; id: SubWeaponId } + | { type: "SPECIAL"; id: SpecialWeaponId }; + export type BuildAbilitiesTuple = [ head: [main: Ability, s1: Ability, s2: Ability, s3: Ability], clothes: [main: Ability, s1: Ability, s2: Ability, s3: Ability], diff --git a/apps/web-react/app/modules/in-game-lists/utils.test.ts b/packages/in-game-lists/src/utils.test.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/utils.test.ts rename to packages/in-game-lists/src/utils.test.ts diff --git a/apps/web-react/app/modules/in-game-lists/utils.ts b/packages/in-game-lists/src/utils.ts similarity index 83% rename from apps/web-react/app/modules/in-game-lists/utils.ts rename to packages/in-game-lists/src/utils.ts index af466d098..16c2fbd21 100644 --- a/apps/web-react/app/modules/in-game-lists/utils.ts +++ b/packages/in-game-lists/src/utils.ts @@ -1,7 +1,6 @@ -import type { AnyWeapon } from "~/features/build-analyzer/analyzer-types"; -import { weaponAltNames } from "~/modules/in-game-lists/weapon-alt-names"; import { abilities } from "./abilities"; -import type { Ability } from "./types"; +import type { Ability, AnyWeapon } from "./types"; +import { weaponAltNames } from "./weapon-alt-names"; export function isAbility(value: string): value is Ability { return Boolean(abilities.some((a) => a.name === value)); diff --git a/apps/web-react/app/modules/in-game-lists/weapon-alt-names.ts b/packages/in-game-lists/src/weapon-alt-names.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/weapon-alt-names.ts rename to packages/in-game-lists/src/weapon-alt-names.ts diff --git a/apps/web-react/app/modules/in-game-lists/weapon-ids.test.ts b/packages/in-game-lists/src/weapon-ids.test.ts similarity index 100% rename from apps/web-react/app/modules/in-game-lists/weapon-ids.test.ts rename to packages/in-game-lists/src/weapon-ids.test.ts diff --git a/apps/web-react/app/modules/in-game-lists/weapon-ids.ts b/packages/in-game-lists/src/weapon-ids.ts similarity index 99% rename from apps/web-react/app/modules/in-game-lists/weapon-ids.ts rename to packages/in-game-lists/src/weapon-ids.ts index 1da74305f..bd147fe9e 100644 --- a/apps/web-react/app/modules/in-game-lists/weapon-ids.ts +++ b/packages/in-game-lists/src/weapon-ids.ts @@ -1,4 +1,4 @@ -import { assertUnreachable } from "~/utils/types"; +import { assertUnreachable } from "./assert"; import type { MainWeaponId, SpecialWeaponId, SubWeaponId } from "./types"; export const weaponCategories = [ diff --git a/packages/in-game-lists/tsconfig.json b/packages/in-game-lists/tsconfig.json new file mode 100644 index 000000000..589f54d68 --- /dev/null +++ b/packages/in-game-lists/tsconfig.json @@ -0,0 +1,23 @@ +{ + "include": ["src/**/*.ts"], + "compilerOptions": { + "lib": ["es2024"], + "module": "ESNext", + "isolatedModules": true, + "erasableSyntaxOnly": true, + "esModuleInterop": true, + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "target": "ES2022", + "strict": true, + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "allowJs": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "useUnknownInCatchVariables": true, + "skipLibCheck": true + } +} diff --git a/packages/tournament-engine/package.json b/packages/tournament-engine/package.json new file mode 100644 index 000000000..35401153a --- /dev/null +++ b/packages/tournament-engine/package.json @@ -0,0 +1,20 @@ +{ + "name": "@sendou/tournament-engine", + "version": "0.0.0", + "private": true, + "type": "module", + "exports": { + ".": "./src/index.ts", + "./create": "./src/create/index.ts", + "./*": "./src/*.ts" + }, + "dependencies": { + "@sendou/in-game-lists": "workspace:*", + "edmonds-blossom-fixed": "1.0.1", + "remeda": "2.39.0" + }, + "devDependencies": { + "typescript": "7.0.2", + "vitest": "4.1.10" + } +} diff --git a/packages/tournament-engine/src/constants.ts b/packages/tournament-engine/src/constants.ts new file mode 100644 index 000000000..6fa47b514 --- /dev/null +++ b/packages/tournament-engine/src/constants.ts @@ -0,0 +1,10 @@ +/** + * Engine-side defaults applied when a stage's settings leave a value out. The + * app's `TOURNAMENT` constant object references these so the two can't drift. + */ +export const ENGINE_DEFAULTS = { + RR_DEFAULT_TEAM_COUNT_PER_GROUP: 4, + SWISS_DEFAULT_GROUP_COUNT: 1, + SWISS_DEFAULT_ROUND_COUNT: 5, + SE_DEFAULT_HAS_THIRD_PLACE_MATCH: true, +} as const; diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/builder.ts b/packages/tournament-engine/src/create/builder.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/builder.ts rename to packages/tournament-engine/src/create/builder.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/double-elimination.test.ts b/packages/tournament-engine/src/create/double-elimination.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/double-elimination.test.ts rename to packages/tournament-engine/src/create/double-elimination.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/double-elimination.ts b/packages/tournament-engine/src/create/double-elimination.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/double-elimination.ts rename to packages/tournament-engine/src/create/double-elimination.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/helpers.test.ts b/packages/tournament-engine/src/create/helpers.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/helpers.test.ts rename to packages/tournament-engine/src/create/helpers.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/helpers.ts b/packages/tournament-engine/src/create/helpers.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/helpers.ts rename to packages/tournament-engine/src/create/helpers.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/index.ts b/packages/tournament-engine/src/create/index.ts similarity index 98% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/index.ts rename to packages/tournament-engine/src/create/index.ts index 224d07ec5..4691170e6 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/create/index.ts +++ b/packages/tournament-engine/src/create/index.ts @@ -1,10 +1,10 @@ -import type { TournamentRoundMaps } from "~/db/tables-json"; import type { BracketData, CreateBracketInput, ResolvedCreateBracketInput, RoundMapsInput, StageType, + TournamentRoundMaps, } from "../types"; import { StageCreator } from "./builder"; import { createDoubleElimination } from "./double-elimination"; diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/round-robin.test.ts b/packages/tournament-engine/src/create/round-robin.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/round-robin.test.ts rename to packages/tournament-engine/src/create/round-robin.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/round-robin.ts b/packages/tournament-engine/src/create/round-robin.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/round-robin.ts rename to packages/tournament-engine/src/create/round-robin.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/seeding.ts b/packages/tournament-engine/src/create/seeding.ts similarity index 98% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/seeding.ts rename to packages/tournament-engine/src/create/seeding.ts index ebc38eb04..350c657c1 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/create/seeding.ts +++ b/packages/tournament-engine/src/create/seeding.ts @@ -1,7 +1,7 @@ // https://web.archive.org/web/20200601102344/https://tl.net/forum/sc2-tournaments/202139-superior-double-elimination-losers-bracket-seeding -import invariant from "~/utils/invariant"; import type { OrderingMap, Seeding, SeedOrdering } from "../types"; +import invariant from "../utils/invariant"; export const ordering: OrderingMap = { natural: (array: T[]) => [...array], diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/settings.ts b/packages/tournament-engine/src/create/settings.ts similarity index 80% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/settings.ts rename to packages/tournament-engine/src/create/settings.ts index 8e5a4283b..cdbf20b05 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/create/settings.ts +++ b/packages/tournament-engine/src/create/settings.ts @@ -1,12 +1,12 @@ -import type { TournamentStageSettings } from "~/db/tables-json"; -import { TOURNAMENT } from "~/features/tournament/tournament-constants"; -import { assertUnreachable } from "~/utils/types"; +import { ENGINE_DEFAULTS } from "../constants"; import type { BracketData, CreateBracketInput, StageSettings, StageType, + TournamentStageSettings, } from "../types"; +import { assertUnreachable } from "../utils/types"; /** * Resolves the user-selected settings into the engine's internal stage @@ -38,9 +38,9 @@ export function resolveStageSettings(input: CreateBracketInput): StageSettings { case "swiss": { return { groupCount: - settings?.groupCount ?? TOURNAMENT.SWISS_DEFAULT_GROUP_COUNT, + settings?.groupCount ?? ENGINE_DEFAULTS.SWISS_DEFAULT_GROUP_COUNT, roundCount: - settings?.roundCount ?? TOURNAMENT.SWISS_DEFAULT_ROUND_COUNT, + settings?.roundCount ?? ENGINE_DEFAULTS.SWISS_DEFAULT_ROUND_COUNT, }; } default: { @@ -57,7 +57,8 @@ export function resolveStageSettings(input: CreateBracketInput): StageSettings { */ export function swissRoundCount(data: BracketData): number { return ( - data.stage[0]?.settings.roundCount ?? TOURNAMENT.SWISS_DEFAULT_ROUND_COUNT + data.stage[0]?.settings.roundCount ?? + ENGINE_DEFAULTS.SWISS_DEFAULT_ROUND_COUNT ); } @@ -72,7 +73,7 @@ export function hasThirdPlaceMatch(args: { return ( args.settings?.thirdPlaceMatch ?? - TOURNAMENT.SE_DEFAULT_HAS_THIRD_PLACE_MATCH + ENGINE_DEFAULTS.SE_DEFAULT_HAS_THIRD_PLACE_MATCH ); } @@ -82,7 +83,7 @@ export function roundRobinGroupCount( participantsCount: number, ): number { const teamsPerGroup = - settings?.teamsPerGroup ?? TOURNAMENT.RR_DEFAULT_TEAM_COUNT_PER_GROUP; + settings?.teamsPerGroup ?? ENGINE_DEFAULTS.RR_DEFAULT_TEAM_COUNT_PER_GROUP; return Math.ceil(participantsCount / teamsPerGroup); } diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/single-elimination.test.ts b/packages/tournament-engine/src/create/single-elimination.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/single-elimination.test.ts rename to packages/tournament-engine/src/create/single-elimination.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/single-elimination.ts b/packages/tournament-engine/src/create/single-elimination.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/single-elimination.ts rename to packages/tournament-engine/src/create/single-elimination.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/create/swiss.ts b/packages/tournament-engine/src/create/swiss.ts similarity index 90% rename from apps/web-react/app/features/tournament-bracket/core/engine/create/swiss.ts rename to packages/tournament-engine/src/create/swiss.ts index e16e41bd8..95f0c2b31 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/create/swiss.ts +++ b/packages/tournament-engine/src/create/swiss.ts @@ -1,11 +1,11 @@ -import { TOURNAMENT } from "~/features/tournament/tournament-constants"; -import { nullFilledArray } from "~/utils/arrays"; -import invariant from "~/utils/invariant"; +import { ENGINE_DEFAULTS } from "../constants"; import type { BracketData, MatchData, ResolvedCreateBracketInput, } from "../types"; +import { nullFilledArray } from "../utils/arrays"; +import invariant from "../utils/invariant"; /** * Creates a Swiss bracket data set: all rounds up front, matches for round 1 only. @@ -13,9 +13,9 @@ import type { */ export function createSwiss(input: ResolvedCreateBracketInput): BracketData { const groupCount = - input.settings.groupCount ?? TOURNAMENT.SWISS_DEFAULT_GROUP_COUNT; + input.settings.groupCount ?? ENGINE_DEFAULTS.SWISS_DEFAULT_GROUP_COUNT; const roundCount = - input.settings.roundCount ?? TOURNAMENT.SWISS_DEFAULT_ROUND_COUNT; + input.settings.roundCount ?? ENGINE_DEFAULTS.SWISS_DEFAULT_ROUND_COUNT; const group = nullFilledArray(groupCount).map((_, i) => ({ id: i, diff --git a/apps/web-react/types/edmonds-blossom.d.ts b/packages/tournament-engine/src/edmonds-blossom.d.ts similarity index 100% rename from apps/web-react/types/edmonds-blossom.d.ts rename to packages/tournament-engine/src/edmonds-blossom.d.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/general.test.ts b/packages/tournament-engine/src/general.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/general.test.ts rename to packages/tournament-engine/src/general.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/index.ts b/packages/tournament-engine/src/index.ts similarity index 94% rename from apps/web-react/app/features/tournament-bracket/core/engine/index.ts rename to packages/tournament-engine/src/index.ts index c890c7d00..fcd31ac22 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/index.ts +++ b/packages/tournament-engine/src/index.ts @@ -4,6 +4,7 @@ * returned delta via BracketRepository. */ +export { ENGINE_DEFAULTS } from "./constants"; export { create } from "./create"; export { hasThirdPlaceMatch, diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/double-elimination.test.ts b/packages/tournament-engine/src/propagation/double-elimination.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/double-elimination.test.ts rename to packages/tournament-engine/src/propagation/double-elimination.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/dropped-teams.ts b/packages/tournament-engine/src/propagation/dropped-teams.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/dropped-teams.ts rename to packages/tournament-engine/src/propagation/dropped-teams.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/helpers.ts b/packages/tournament-engine/src/propagation/helpers.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/helpers.ts rename to packages/tournament-engine/src/propagation/helpers.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/report-result.ts b/packages/tournament-engine/src/propagation/report-result.ts similarity index 94% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/report-result.ts rename to packages/tournament-engine/src/propagation/report-result.ts index b42a9bbc8..20d3710cb 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/report-result.ts +++ b/packages/tournament-engine/src/propagation/report-result.ts @@ -1,5 +1,5 @@ -import invariant from "~/utils/invariant"; import type { BracketData, EngineResult, ReportResultInput } from "../types"; +import invariant from "../utils/invariant"; import { Store } from "./store"; import { Propagator } from "./traversal"; diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/reset-result.ts b/packages/tournament-engine/src/propagation/reset-result.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/reset-result.ts rename to packages/tournament-engine/src/propagation/reset-result.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/round-robin.test.ts b/packages/tournament-engine/src/propagation/round-robin.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/round-robin.test.ts rename to packages/tournament-engine/src/propagation/round-robin.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/set.test.ts b/packages/tournament-engine/src/propagation/set.test.ts similarity index 96% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/set.test.ts rename to packages/tournament-engine/src/propagation/set.test.ts index 2891656cb..709b125a6 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/set.test.ts +++ b/packages/tournament-engine/src/propagation/set.test.ts @@ -1,8 +1,7 @@ import { beforeEach, describe, expect, test } from "vitest"; -import type { TournamentRoundMaps } from "~/db/tables-json"; import { create } from "../create"; import * as Engine from "../index"; -import type { BracketData, MatchData } from "../types"; +import type { BracketData, MatchData, TournamentRoundMaps } from "../types"; const TEAM_ONE = 1; const TEAM_TWO = 2; diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/set.ts b/packages/tournament-engine/src/propagation/set.ts similarity index 98% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/set.ts rename to packages/tournament-engine/src/propagation/set.ts index 397977e30..70b1f73ef 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/set.ts +++ b/packages/tournament-engine/src/propagation/set.ts @@ -1,6 +1,6 @@ -import invariant from "~/utils/invariant"; import { isSetOverByScore, matchEndedEarly } from "../status"; import type { BracketData, EngineResult, MatchData, Side } from "../types"; +import invariant from "../utils/invariant"; import { reportResult } from "./report-result"; import { resetMatchResults } from "./reset-result"; diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/single-elimination.test.ts b/packages/tournament-engine/src/propagation/single-elimination.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/single-elimination.test.ts rename to packages/tournament-engine/src/propagation/single-elimination.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/store.ts b/packages/tournament-engine/src/propagation/store.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/store.ts rename to packages/tournament-engine/src/propagation/store.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/traversal.ts b/packages/tournament-engine/src/propagation/traversal.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/traversal.ts rename to packages/tournament-engine/src/propagation/traversal.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/propagation/update.test.ts b/packages/tournament-engine/src/propagation/update.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/propagation/update.test.ts rename to packages/tournament-engine/src/propagation/update.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/status.test.ts b/packages/tournament-engine/src/status.test.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/status.test.ts rename to packages/tournament-engine/src/status.test.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/status.ts b/packages/tournament-engine/src/status.ts similarity index 99% rename from apps/web-react/app/features/tournament-bracket/core/engine/status.ts rename to packages/tournament-engine/src/status.ts index 6e79de1c7..2927fa69e 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/status.ts +++ b/packages/tournament-engine/src/status.ts @@ -1,11 +1,11 @@ import * as R from "remeda"; -import type { TournamentRoundMaps } from "~/db/tables-json"; import type { BracketData, MatchData, MatchResults, RoundData, Side, + TournamentRoundMaps, } from "./types"; /** diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/swiss/pairing.ts b/packages/tournament-engine/src/swiss/pairing.ts similarity index 98% rename from apps/web-react/app/features/tournament-bracket/core/engine/swiss/pairing.ts rename to packages/tournament-engine/src/swiss/pairing.ts index d9e18e268..d5b1e0a6f 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/swiss/pairing.ts +++ b/packages/tournament-engine/src/swiss/pairing.ts @@ -1,7 +1,6 @@ +/// import blossom from "edmonds-blossom-fixed"; import * as R from "remeda"; -import invariant from "~/utils/invariant"; -import { err, ok, type Result } from "~/utils/result"; import { swissRoundCount } from "../create/settings"; import type { BracketData, @@ -9,6 +8,8 @@ import type { MatchData, SwissStanding, } from "../types"; +import invariant from "../utils/invariant"; +import { err, ok, type Result } from "../utils/result"; import { calculateTeamStatus } from "./team-status"; /** diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/swiss/team-status.ts b/packages/tournament-engine/src/swiss/team-status.ts similarity index 100% rename from apps/web-react/app/features/tournament-bracket/core/engine/swiss/team-status.ts rename to packages/tournament-engine/src/swiss/team-status.ts diff --git a/apps/web-react/app/features/tournament-bracket/core/engine/types.ts b/packages/tournament-engine/src/types.ts similarity index 80% rename from apps/web-react/app/features/tournament-bracket/core/engine/types.ts rename to packages/tournament-engine/src/types.ts index 94cd13411..fa84e6f5d 100644 --- a/apps/web-react/app/features/tournament-bracket/core/engine/types.ts +++ b/packages/tournament-engine/src/types.ts @@ -1,8 +1,4 @@ -import type { Tables } from "~/db/tables"; -import type { - TournamentRoundMaps, - TournamentStageSettings, -} from "~/db/tables-json"; +import type { ModeShort, StageId } from "@sendou/in-game-lists/types"; /** * The side of an opponent. Upstream brackets-model also allowed a draw — @@ -10,7 +6,84 @@ import type { */ export type Side = "opponent1" | "opponent2"; -export type StageType = Tables["TournamentStage"]["type"]; +export const TOURNAMENT_STAGE_TYPES = [ + "single_elimination", + "double_elimination", + "round_robin", + "swiss", +] as const; + +export type StageType = (typeof TOURNAMENT_STAGE_TYPES)[number]; + +export const PICK_BAN_TYPES = [ + "COUNTERPICK", + "COUNTERPICK_MODE_REPEAT_OK", + "BAN_2", + "CUSTOM", +] as const; + +export type PickBanType = (typeof PICK_BAN_TYPES)[number]; + +/** Who picks or bans in a custom pick/ban flow step. */ +export const WHO_SIDES = [ + "RANDOM", + "RANDOM_OTHER", + "ALPHA", + "BRAVO", + "HIGHER_SEED", + "LOWER_SEED", + "WINNER", + "LOSER", +] as const; + +export type WhoSide = (typeof WHO_SIDES)[number]; + +/** What happens in a custom pick/ban flow step. */ +export const ACTION_TYPES = [ + "ROLL", + "PICK", + "PICK_NO_MODE_REPEAT", + "BAN", + "MODE_PICK", + "MODE_BAN", +] as const; + +export type ActionType = (typeof ACTION_TYPES)[number]; + +export interface CustomPickBanStep { + action: ActionType; + side?: WhoSide; +} + +export interface CustomPickBanFlow { + preSet: CustomPickBanStep[]; + postGame: CustomPickBanStep[]; +} + +/** Shape of the `TournamentRound.maps` JSON column. */ +export interface TournamentRoundMaps { + list?: Array<{ mode: ModeShort; stageId: StageId }> | null; + count: number; + type: "BEST_OF" | "PLAY_ALL"; + pickBan?: PickBanType | null; + customFlow?: CustomPickBanFlow | null; +} + +// when updating this also update `settingsFromFormValues` in calendar-progression-form.ts +export interface TournamentStageSettings { + // SE + thirdPlaceMatch?: boolean; + // RR + teamsPerGroup?: number; + /** (RR only) When true, teams are split into A and B divisions and matches only pair A-vs-B. Only valid on starting brackets. */ + hasAbDivisions?: boolean; + // SWISS + groupCount?: number; + // SWISS + roundCount?: number; + /** (Swiss only) Number of wins required for a team to advance early. When set, teams advance at this win count and are eliminated at (roundCount - advanceThreshold + 1) losses. */ + advanceThreshold?: number; +} /** * All the possible types of group in an elimination stage. diff --git a/packages/tournament-engine/src/utils/arrays.ts b/packages/tournament-engine/src/utils/arrays.ts new file mode 100644 index 000000000..babf84820 --- /dev/null +++ b/packages/tournament-engine/src/utils/arrays.ts @@ -0,0 +1,4 @@ +/** Returns a new array of the given size with every element `null`. */ +export function nullFilledArray(size: number): null[] { + return new Array(size).fill(null); +} diff --git a/packages/tournament-engine/src/utils/invariant.ts b/packages/tournament-engine/src/utils/invariant.ts new file mode 100644 index 000000000..f321a91b7 --- /dev/null +++ b/packages/tournament-engine/src/utils/invariant.ts @@ -0,0 +1,12 @@ +// adapted from https://github.com/alexreardon/tiny-invariant, changed to show errors in production as well + +export default function invariant( + condition: any, + message?: string, +): asserts condition { + if (condition) return; + + const addition = message ? `: ${message}` : ""; + + throw new Error(`Invariant failed${addition}`); +} diff --git a/packages/tournament-engine/src/utils/result.ts b/packages/tournament-engine/src/utils/result.ts new file mode 100644 index 000000000..de0c1c5e7 --- /dev/null +++ b/packages/tournament-engine/src/utils/result.ts @@ -0,0 +1,15 @@ +export type Ok = { readonly ok: true; readonly value: T }; +export type Err = { readonly ok: false; readonly error: E }; + +/** Discriminated union representing either a success (`Ok`) or a failure (`Err`). Narrow with the `ok` property. */ +export type Result = Ok | Err; + +/** Creates an `Ok` variant of `Result` holding the success value. */ +export function ok(value: T): Ok { + return { ok: true, value }; +} + +/** Creates an `Err` variant of `Result` holding the error value. */ +export function err(error: E): Err { + return { ok: false, error }; +} diff --git a/packages/tournament-engine/src/utils/types.ts b/packages/tournament-engine/src/utils/types.ts new file mode 100644 index 000000000..26f1748db --- /dev/null +++ b/packages/tournament-engine/src/utils/types.ts @@ -0,0 +1,5 @@ +export function assertUnreachable(x: never): never { + throw new Error( + `Didn't expect to get here. Unexpected value: ${JSON.stringify(x)}`, + ); +} diff --git a/packages/tournament-engine/tsconfig.json b/packages/tournament-engine/tsconfig.json new file mode 100644 index 000000000..dad98d52f --- /dev/null +++ b/packages/tournament-engine/tsconfig.json @@ -0,0 +1,23 @@ +{ + "include": ["src/**/*.ts", "src/**/*.d.ts"], + "compilerOptions": { + "lib": ["es2024"], + "module": "ESNext", + "isolatedModules": true, + "erasableSyntaxOnly": true, + "esModuleInterop": true, + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "target": "ES2022", + "strict": true, + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "allowJs": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "useUnknownInCatchVariables": true, + "skipLibCheck": true + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d74ffc411..6fe5e6177 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -55,6 +55,12 @@ importers: '@react-router/serve': specifier: 8.1.0 version: 8.1.0(patch_hash=0073d0acad5d92eea7ef30ed24d736df9f4d59e204f8358ecb3b06b9ea9d8738)(react-router@8.3.0(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(typescript@7.0.2) + '@sendou/in-game-lists': + specifier: workspace:* + version: link:../../packages/in-game-lists + '@sendou/tournament-engine': + specifier: workspace:* + version: link:../../packages/tournament-engine '@techstark/opencv-js': specifier: 5.0.0-release.1 version: 5.0.0-release.1(patch_hash=0e23b4243e8e2f88294c00eefdf8dfc3624f59442bd0c8d075be89a8136144f3) @@ -76,9 +82,6 @@ importers: date-fns: specifier: 4.4.0 version: 4.4.0 - edmonds-blossom-fixed: - specifier: 1.0.1 - version: 1.0.1 fflate: specifier: 0.8.3 version: 0.8.3 @@ -264,6 +267,40 @@ importers: specifier: 2.2.0 version: 2.2.0(@types/react-dom@19.2.4(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vitest@4.1.10) + packages/in-game-lists: + devDependencies: + typescript: + specifier: 7.0.2 + version: 7.0.2 + vitest: + specifier: 4.1.10 + version: 4.1.10(@types/node@26.1.2)(@vitest/browser-playwright@4.1.10)(@vitest/ui@4.1.10)(vite@8.2.0(@types/node@26.1.2)(jiti@2.7.0)(yaml@2.9.0)) + + packages/tournament-engine: + dependencies: + '@sendou/in-game-lists': + specifier: workspace:* + version: link:../in-game-lists + edmonds-blossom-fixed: + specifier: 1.0.1 + version: 1.0.1 + remeda: + specifier: 2.39.0 + version: 2.39.0 + devDependencies: + typescript: + specifier: 7.0.2 + version: 7.0.2 + vitest: + specifier: 4.1.10 + version: 4.1.10(@types/node@26.1.2)(@vitest/browser-playwright@4.1.10)(@vitest/ui@4.1.10)(vite@8.2.0(@types/node@26.1.2)(jiti@2.7.0)(yaml@2.9.0)) + + tooling/codemods: + devDependencies: + typescript: + specifier: 7.0.2 + version: 7.0.2 + packages: '@aws-sdk/checksums@3.1000.27': diff --git a/tooling/codemods/package.json b/tooling/codemods/package.json new file mode 100644 index 000000000..ba05ac816 --- /dev/null +++ b/tooling/codemods/package.json @@ -0,0 +1,14 @@ +{ + "name": "@sendou/codemods", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "mono-split": "node src/mono-split.ts", + "manifest:generate": "node src/manifest.ts generate", + "manifest:report": "node src/manifest.ts report" + }, + "devDependencies": { + "typescript": "7.0.2" + } +} diff --git a/tooling/codemods/src/mono-split.ts b/tooling/codemods/src/mono-split.ts new file mode 100644 index 000000000..ed6be1d04 --- /dev/null +++ b/tooling/codemods/src/mono-split.ts @@ -0,0 +1,90 @@ +/** + * mono-split — rewrites module specifiers in `apps/web-react` from in-app paths + * to the extracted workspace packages. Idempotent: specifiers are rewritten by + * exact prefix/pattern match, so re-running is a no-op once the sources no + * longer contain the old specifiers. + * + * The file moves themselves (git mv into `packages/*`) are one-time operations + * recorded in git history; this script owns only the import rewriting so it can + * be re-run if new code lands still using the old specifiers. + */ + +import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"; +import { join, relative } from "node:path"; + +const APP_ROOT = new URL("../../../apps/web-react", import.meta.url).pathname; + +const SPECIFIER_PREFIX_MAP: ReadonlyArray<[from: string, to: string]> = [ + ["~/modules/in-game-lists", "@sendou/in-game-lists"], + ["~/features/tournament-bracket/core/engine", "@sendou/tournament-engine"], +]; + +/** + * Relative specifiers that reach into a moved directory. `dirPrefix` limits + * the pattern to files under that directory (relative to the app root) so a + * `./engine` elsewhere can never be rewritten by accident. + */ +const RELATIVE_SPECIFIER_RULES: ReadonlyArray<{ + dirPrefix: string; + pattern: RegExp; + packageName: string; +}> = [ + { + dirPrefix: "", + pattern: /(?:\.\.\/)+(?:app\/)?modules\/in-game-lists(?=\/)/, + packageName: "@sendou/in-game-lists", + }, + { + dirPrefix: "app/features/tournament-bracket", + pattern: /(?:\.\.\/|\.\/)+(?:core\/)?engine(?=[/"'])/, + packageName: "@sendou/tournament-engine", + }, +]; + +const SOURCE_DIRS = ["app", "e2e", "scripts"]; +const SOURCE_EXTENSIONS = [".ts", ".tsx"]; + +function main() { + let changedFiles = 0; + for (const dir of SOURCE_DIRS) { + for (const filePath of walk(join(APP_ROOT, dir))) { + if (rewriteFile(filePath)) changedFiles++; + } + } + process.stdout.write(`mono-split: rewrote ${changedFiles} files\n`); +} + +function rewriteFile(filePath: string): boolean { + const original = readFileSync(filePath, "utf8"); + let content = original; + for (const [from, to] of SPECIFIER_PREFIX_MAP) { + for (const quote of ['"', "'"]) { + content = content.replaceAll(`${quote}${from}`, `${quote}${to}`); + } + } + const appRelativePath = relative(APP_ROOT, filePath); + for (const rule of RELATIVE_SPECIFIER_RULES) { + if (!appRelativePath.startsWith(rule.dirPrefix)) continue; + content = content.replace( + new RegExp(`(["'])${rule.pattern.source}`, "g"), + `$1${rule.packageName}`, + ); + } + if (content === original) return false; + writeFileSync(filePath, content); + return true; +} + +function* walk(dir: string): Generator { + for (const entry of readdirSync(dir)) { + const fullPath = join(dir, entry); + if (statSync(fullPath).isDirectory()) { + if (entry === "node_modules") continue; + yield* walk(fullPath); + } else if (SOURCE_EXTENSIONS.some((ext) => fullPath.endsWith(ext))) { + yield fullPath; + } + } +} + +main();