Skip to content

Commit

Permalink
rename directory, indexFile
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Mar 20, 2024
1 parent 48b1f4c commit b7c8759
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions packages/store/ts/config/v2/compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export type storeToV1<store> = store extends Store
};
storeImportPath: store["codegen"]["storeImportPath"];
userTypesFilename: store["codegen"]["userTypesFilename"];
codegenDirectory: store["codegen"]["codegenDirectory"];
codegenIndexFilename: store["codegen"]["codegenIndexFilename"];
codegenDirectory: store["codegen"]["outputDirectory"];
codegenIndexFilename: store["codegen"]["indexFilename"];
tables: {
[key in keyof store["tables"] as store["tables"][key]["name"]]: tableToV1<store["tables"][key]>;
};
Expand All @@ -27,7 +27,7 @@ export type storeToV1<store> = store extends Store
type schemaToV1<schema extends Schema> = { [key in keyof schema]: schema[key]["internalType"] };

export type tableToV1<table extends Table> = {
directory: table["codegen"]["directory"];
directory: table["codegen"]["outputDirectory"];
dataStruct: table["codegen"]["dataStruct"];
tableIdArgument: table["codegen"]["tableIdArgument"];
storeArgument: table["codegen"]["storeArgument"];
Expand All @@ -48,7 +48,7 @@ export function storeToV1<store>(store: conform<store, Store>): storeToV1<store>
return [
table.name,
{
directory: table.codegen.directory,
directory: table.codegen.outputDirectory,
dataStruct: table.codegen.dataStruct,
tableIdArgument: table.codegen.tableIdArgument,
storeArgument: table.codegen.storeArgument,
Expand All @@ -67,8 +67,8 @@ export function storeToV1<store>(store: conform<store, Store>): storeToV1<store>
userTypes: resolvedUserTypes,
storeImportPath: store.codegen.storeImportPath,
userTypesFilename: store.codegen.userTypesFilename,
codegenDirectory: store.codegen.codegenDirectory,
codegenIndexFilename: store.codegen.codegenIndexFilename,
codegenDirectory: store.codegen.outputDirectory,
codegenIndexFilename: store.codegen.indexFilename,
tables: resolvedTables,
v2: store,
} as unknown as storeToV1<store>;
Expand Down
6 changes: 3 additions & 3 deletions packages/store/ts/config/v2/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const CODEGEN_DEFAULTS = {
storeImportPath: "@latticexyz/store/src/",
userTypesFilename: "common.sol",
codegenDirectory: "codegen",
codegenIndexFilename: "index.sol",
outputDirectory: "codegen",
indexFilename: "index.sol",
} as const;

export const TABLE_CODEGEN_DEFAULTS = {
directory: "tables",
outputDirectory: "tables",
tableIdArgument: false,
storeArgument: false,
} as const;
Expand Down
6 changes: 3 additions & 3 deletions packages/store/ts/config/v2/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type Enums = {
};

export type TableCodegen = {
readonly directory: string;
readonly outputDirectory: string;
readonly tableIdArgument: boolean;
readonly storeArgument: boolean;
readonly dataStruct: boolean;
Expand All @@ -29,8 +29,8 @@ export type Table = BaseTable & {
export type Codegen = {
readonly storeImportPath: string;
readonly userTypesFilename: string;
readonly codegenDirectory: string;
readonly codegenIndexFilename: string;
readonly outputDirectory: string;
readonly indexFilename: string;
};

export type Store = {
Expand Down
2 changes: 1 addition & 1 deletion packages/store/ts/config/v2/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export type resolveTableCodegen<input extends TableInput> = {
export function resolveTableCodegen<input extends TableInput>(input: input): resolveTableCodegen<input> {
const options = input.codegen;
return {
directory: get(options, "directory") ?? TABLE_CODEGEN_DEFAULTS.directory,
outputDirectory: get(options, "outputDirectory") ?? TABLE_CODEGEN_DEFAULTS.outputDirectory,
tableIdArgument: get(options, "tableIdArgument") ?? TABLE_CODEGEN_DEFAULTS.tableIdArgument,
storeArgument: get(options, "storeArgument") ?? TABLE_CODEGEN_DEFAULTS.storeArgument,
// dataStruct is true if there are at least 2 value fields
Expand Down

0 comments on commit b7c8759

Please sign in to comment.