mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-10 16:34:49 +00:00
refactor: rename core-public -> engine-public; fold helpers in; drop shared
Tighten the package model around the determinism invariant: everything the
engine imports must itself be deterministic.
- Rename core-public -> engine-public (package, dir, `engine-public/*` alias,
all 118 import sites). It is the deterministic public surface the engine
depends on and that client/server also use.
- Move the pure formatting helpers (renderNumber/renderTroops) from shared
into engine-public/format — the engine uses them and they're deterministic.
- Drop the now-empty shared package (and its alias). `shared` was intended for
client/server-shared, engine-forbidden code; there is none yet, so it is
removed and can be re-added when such code appears.
Final graph: engine-public (leaf) <- engine <- {client, server};
client/server also -> engine-public.
Verified: tsc clean; 1364 + 65 tests pass; prod build succeeds; engine-public
is a leaf; engine has no client/server imports. Lockfile regenerated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,8 +20,8 @@ vi.mock("server/Logger", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("core-public/Schemas", async () => {
|
||||
const actual = (await vi.importActual("core-public/Schemas")) as any;
|
||||
vi.mock("engine-public/Schemas", async () => {
|
||||
const actual = (await vi.importActual("engine-public/Schemas")) as any;
|
||||
return {
|
||||
...actual,
|
||||
GameRecordSchema: {
|
||||
@@ -31,7 +31,7 @@ vi.mock("core-public/Schemas", async () => {
|
||||
});
|
||||
|
||||
import { GameType } from "engine/game/Game";
|
||||
import type { GameRecord } from "core-public/Schemas";
|
||||
import type { GameRecord } from "engine-public/Schemas";
|
||||
import { archive } from "server/Archive";
|
||||
|
||||
function buildRecord(gameType: GameType, flag: string | undefined): GameRecord {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("core-public/Schemas", async () => {
|
||||
const actual = (await vi.importActual("core-public/Schemas")) as any;
|
||||
vi.mock("engine-public/Schemas", async () => {
|
||||
const actual = (await vi.importActual("engine-public/Schemas")) as any;
|
||||
return {
|
||||
...actual,
|
||||
GameStartInfoSchema: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("core-public/Schemas", async () => {
|
||||
const actual = (await vi.importActual("core-public/Schemas")) as any;
|
||||
vi.mock("engine-public/Schemas", async () => {
|
||||
const actual = (await vi.importActual("engine-public/Schemas")) as any;
|
||||
return {
|
||||
...actual,
|
||||
GameStartInfoSchema: {
|
||||
|
||||
Reference in New Issue
Block a user