From d5c693d68e08ad3ef6f11fd1c0b44ba591bae14a Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 21 May 2024 18:15:26 +0100 Subject: [PATCH] we don't need any of this anymore --- packages/world/ts/config/defaults.ts | 1 - packages/world/ts/config/types.ts | 2 -- packages/world/ts/config/v2/compat.ts | 16 +--------------- packages/world/ts/config/worldConfig.ts | 22 ---------------------- 4 files changed, 1 insertion(+), 40 deletions(-) diff --git a/packages/world/ts/config/defaults.ts b/packages/world/ts/config/defaults.ts index d00fc7e626..61bd712d17 100644 --- a/packages/world/ts/config/defaults.ts +++ b/packages/world/ts/config/defaults.ts @@ -16,7 +16,6 @@ export const WORLD_DEFAULTS = { worldsFile: "./worlds.json", worldgenDirectory: "world", worldImportPath: "@latticexyz/world/src/", - modules: [], } as const; export type WORLD_DEFAULTS = typeof WORLD_DEFAULTS; diff --git a/packages/world/ts/config/types.ts b/packages/world/ts/config/types.ts index c136d57f65..40f55f4930 100644 --- a/packages/world/ts/config/types.ts +++ b/packages/world/ts/config/types.ts @@ -85,8 +85,6 @@ export interface WorldUserConfig { worldgenDirectory?: string; /** Path for world package imports. Default is "@latticexyz/world/src/" */ worldImportPath?: string; - /** Modules to in the World */ - modules?: readonly ModuleConfig[]; } export type WorldConfig = z.output; diff --git a/packages/world/ts/config/v2/compat.ts b/packages/world/ts/config/v2/compat.ts index 8083360f5d..9f96ee76bb 100644 --- a/packages/world/ts/config/v2/compat.ts +++ b/packages/world/ts/config/v2/compat.ts @@ -1,20 +1,8 @@ import { conform } from "@arktype/util"; -import { Module, World, Systems } from "./output"; +import { World, Systems } from "./output"; import { Store } from "@latticexyz/store"; import { storeToV1 } from "@latticexyz/store/config/v2"; -type modulesToV1 = { - [key in keyof modules]: Omit; -}; - -function modulesToV1(modules: modules): modulesToV1 { - return modules.map((module) => ({ - ...module, - root: module.root ?? false, - args: module.args ?? [], - })) as never; -} - type systemsToV1 = { [key in keyof systems]: { name?: systems[key]["name"]; @@ -30,7 +18,6 @@ export type worldToV1 = world extends World ? Omit, "v2"> & { systems: systemsToV1; excludeSystems: world["excludeSystems"]; - modules: modulesToV1; worldContractName: world["deploy"]["customWorldContract"]; postDeployScript: world["deploy"]["postDeployScript"]; deploysDirectory: world["deploy"]["deploysDirectory"]; @@ -46,7 +33,6 @@ export function worldToV1(world: conform): worldToV1 const v1WorldConfig = { systems: systemsToV1(world.systems), excludeSystems: world.excludeSystems, - modules: modulesToV1(world.modules), worldContractName: world.deploy.customWorldContract, postDeployScript: world.deploy.postDeployScript, deploysDirectory: world.deploy.deploysDirectory, diff --git a/packages/world/ts/config/worldConfig.ts b/packages/world/ts/config/worldConfig.ts index 05e31dad4d..66cc01b2ac 100644 --- a/packages/world/ts/config/worldConfig.ts +++ b/packages/world/ts/config/worldConfig.ts @@ -2,13 +2,7 @@ import { z } from "zod"; import { zEthereumAddress, zName, zObjectName } from "@latticexyz/config/library"; import { SYSTEM_DEFAULTS, WORLD_DEFAULTS } from "./defaults"; -enum DynamicResolutionType { - TABLE_ID, - SYSTEM_ADDRESS, -} - const zSystemName = zObjectName; -const zModuleName = zObjectName; const zSystemAccessList = z.array(zSystemName.or(zEthereumAddress)).readonly().default(SYSTEM_DEFAULTS.accessList); // The system config is a combination of a name config and access config @@ -28,21 +22,6 @@ const zSystemConfig = z.intersection( ]), ); -const zValueWithType = z.object({ - value: z.union([z.string(), z.number(), z.instanceof(Uint8Array)]), - type: z.string(), -}); -const zDynamicResolution = z.object({ type: z.nativeEnum(DynamicResolutionType), input: z.string() }); - -const zModuleConfig = z.object({ - name: zModuleName, - root: z.boolean().default(false), - args: z - .array(z.union([zValueWithType, zDynamicResolution])) - .readonly() - .default([]), -}); - // The parsed world config is the result of parsing the user config export const zWorldConfig = z.object({ worldContractName: z.string().optional(), @@ -54,7 +33,6 @@ export const zWorldConfig = z.object({ worldsFile: z.string().default(WORLD_DEFAULTS.worldsFile), worldgenDirectory: z.string().default(WORLD_DEFAULTS.worldgenDirectory), worldImportPath: z.string().default(WORLD_DEFAULTS.worldImportPath), - modules: z.array(zModuleConfig).readonly().default(WORLD_DEFAULTS.modules), }); // Catchall preserves other plugins' options