Skip to content

Commit

Permalink
we don't need any of this anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed May 21, 2024
1 parent c27a365 commit d5c693d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 40 deletions.
1 change: 0 additions & 1 deletion packages/world/ts/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 0 additions & 2 deletions packages/world/ts/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof zWorldConfig>;
Expand Down
16 changes: 1 addition & 15 deletions packages/world/ts/config/v2/compat.ts
Original file line number Diff line number Diff line change
@@ -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<modules extends readonly Module[]> = {
[key in keyof modules]: Omit<modules[key], "artifactPath">;
};

function modulesToV1<modules extends readonly Module[]>(modules: modules): modulesToV1<modules> {
return modules.map((module) => ({
...module,
root: module.root ?? false,
args: module.args ?? [],
})) as never;
}

type systemsToV1<systems extends Systems> = {
[key in keyof systems]: {
name?: systems[key]["name"];
Expand All @@ -30,7 +18,6 @@ export type worldToV1<world> = world extends World
? Omit<storeToV1<world>, "v2"> & {
systems: systemsToV1<world["systems"]>;
excludeSystems: world["excludeSystems"];
modules: modulesToV1<world["modules"]>;
worldContractName: world["deploy"]["customWorldContract"];
postDeployScript: world["deploy"]["postDeployScript"];
deploysDirectory: world["deploy"]["deploysDirectory"];
Expand All @@ -46,7 +33,6 @@ export function worldToV1<world>(world: conform<world, World>): worldToV1<world>
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,
Expand Down
22 changes: 0 additions & 22 deletions packages/world/ts/config/worldConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand All @@ -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
Expand Down

0 comments on commit d5c693d

Please sign in to comment.