build: migrate build system to Vite and test runner to Vitest & Remove

depracated husky usage

- Replace Webpack with Vite for faster client bundling and HMR.
- Migrate tests from Jest to Vitest and update configuration.
- Update Web Worker instantiation to standard ESM syntax.
- Implement Env utility in `src/core` for safe, hybrid environment
  variable access (Vite vs Node).
- Refactor configuration loaders to remove direct `process.env`
  dependencies in shared code.
- Update TypeScript environment definitions and project scripts for the
  new toolchain.
- Remove the [depracated usage of the
  husky](https://github.com/typicode/husky/releases/tag/v9.0.1).

build(vite): implement robust git commit resolution with fallback
This commit is contained in:
wraith4081
2025-12-27 00:12:39 +03:00
parent 02a6ac58ea
commit c5f6d9116e
52 changed files with 2503 additions and 10287 deletions
+13 -15
View File
@@ -71,19 +71,17 @@ describe("AllianceBehavior.handleAllianceRequests", () => {
}
});
jest.spyOn(player, "alliances").mockReturnValue(new Array(alliancesCount));
vi.spyOn(player, "alliances").mockReturnValue(new Array(alliancesCount));
const mockRequest = {
requestor: () => requestor,
recipient: () => player,
createdAt: () => 0 as unknown as Tick,
accept: jest.fn(),
reject: jest.fn(),
accept: vi.fn(),
reject: vi.fn(),
} as unknown as AllianceRequest;
jest
.spyOn(player, "incomingAllianceRequests")
.mockReturnValue([mockRequest]);
vi.spyOn(player, "incomingAllianceRequests").mockReturnValue([mockRequest]);
return mockRequest;
}
@@ -145,19 +143,19 @@ describe("AllianceBehavior.handleAllianceExtensionRequests", () => {
let allianceBehavior: NationAllianceBehavior;
beforeEach(() => {
mockGame = { addExecution: jest.fn() };
mockHuman = { id: jest.fn(() => "human_id") };
mockGame = { addExecution: vi.fn() };
mockHuman = { id: vi.fn(() => "human_id") };
mockAlliance = {
onlyOneAgreedToExtend: jest.fn(() => true),
other: jest.fn(() => mockHuman),
onlyOneAgreedToExtend: vi.fn(() => true),
other: vi.fn(() => mockHuman),
};
mockRandom = { chance: jest.fn() };
mockRandom = { chance: vi.fn() };
mockPlayer = {
alliances: jest.fn(() => [mockAlliance]),
relation: jest.fn(),
id: jest.fn(() => "bot_id"),
type: jest.fn(() => PlayerType.Nation),
alliances: vi.fn(() => [mockAlliance]),
relation: vi.fn(),
id: vi.fn(() => "bot_id"),
type: vi.fn(() => PlayerType.Nation),
};
allianceBehavior = new NationAllianceBehavior(