feat: add resource schemas and validation scripts

- Introduced new resource schemas for maps, scenarios, unit sets, and turn commands using Zod.
- Implemented a script to generate JSON schemas from Zod schemas.
- Added a validation script to ensure resource JSON files conform to their respective schemas.
- Updated the logic package to export new resource schemas.
- Added new dependencies for schema generation and validation.
- Created a tools-scripts package for resource management tasks.
This commit is contained in:
2026-01-18 08:04:02 +00:00
parent e3f7758187
commit 81594a25c3
20 changed files with 452 additions and 94 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import {
asStringArray,
isRecord,
} from '@sammo-ts/common';
import { UnitSetDefinitionInputSchema } from '../resources/unitSetSchema.js';
const DEFAULT_REGION_MAP: Record<string, number> = {
하북: 1,
@@ -114,7 +115,7 @@ const parseCrewType = (value: unknown): CrewTypeDefinition | null => {
};
export const parseUnitSetDefinition = (value: unknown): UnitSetDefinition => {
const data = asRecord(value);
const data = UnitSetDefinitionInputSchema.parse(value);
const id = asString(data.id, 'unknown');
const name = asString(data.name, id);
const defaultCrewTypeId =