Skip to content

Commit

Permalink
update codegen out dir
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Mar 20, 2024
1 parent 6d6109e commit 665e81e
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/cli/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ const config = defineStore({
const srcDirectory = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDirectory, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDirectory, config.codegen.outputDirectory), remappings);
2 changes: 1 addition & 1 deletion packages/cli/src/commands/dev-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const commandModule: CommandModule<typeof devOptions, InferredOptionTypes<typeof
}
if (updatePath.includes(srcDir) || updatePath.includes(scriptDir)) {
// Ignore changes to codegen files to avoid an infinite loop
if (!updatePath.includes(initialConfig.codegen.codegenDirectory)) {
if (!updatePath.includes(initialConfig.codegen.outputDirectory)) {
console.log(chalk.blue("Contracts changed, queuing deploy…"));
lastChange$.next(Date.now());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const commandModule: CommandModule<Options, Options> = {
const srcDir = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDir, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDir, config.codegen.outputDirectory), remappings);

process.exit(0);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/worldgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function worldgenHandler(args: Options) {
// Load the config
const mudConfig = args.config ?? ((await loadConfig(args.configPath)) as WorldConfig);

const outputBaseDirectory = path.join(srcDir, mudConfig.codegen.codegenDirectory);
const outputBaseDirectory = path.join(srcDir, mudConfig.codegen.outputDirectory);

// clear the worldgen directory
if (args.clean) {
Expand Down
4 changes: 2 additions & 2 deletions packages/store/ts/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { defineStore } from "../config/v2/store";
const config = defineStore({
codegen: {
storeImportPath: "../../../src/",
codegenDirectory: "../test/codegen",
outputDirectory: "../test/codegen",
},
namespace: "store",
enums: {
Expand Down Expand Up @@ -53,4 +53,4 @@ const config = defineStore({
const srcDir = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDir, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDir, config.codegen.outputDirectory), remappings);
2 changes: 1 addition & 1 deletion packages/store/ts/scripts/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const config = (await loadConfig()) as StoreConfig;
const srcDir = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDir, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDir, config.codegen.outputDirectory), remappings);
40 changes: 20 additions & 20 deletions packages/world-modules/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineWorld({
codegen: {
worldgenDirectory: "interfaces",
worldInterfaceName: "IBaseWorld",
codegenDirectory: ".",
outputDirectory: ".",
},
userTypes: {
ResourceId: { filePath: "@latticexyz/store/src/ResourceId.sol", type: "bytes32" },
Expand All @@ -22,7 +22,7 @@ export default defineWorld({
},
key: ["valueHash"],
codegen: {
directory: "modules/keyswithvalue/tables",
outputDirectory: "modules/keyswithvalue/tables",
tableIdArgument: true,
storeArgument: true,
},
Expand All @@ -43,7 +43,7 @@ export default defineWorld({
},
key: ["sourceTableId"],
codegen: {
directory: "modules/keysintable/tables",
outputDirectory: "modules/keysintable/tables",
storeArgument: true,
},
},
Expand All @@ -56,7 +56,7 @@ export default defineWorld({
},
key: ["sourceTableId", "keysHash"],
codegen: {
directory: "modules/keysintable/tables",
outputDirectory: "modules/keysintable/tables",
dataStruct: false,
storeArgument: true,
},
Expand All @@ -72,7 +72,7 @@ export default defineWorld({
},
key: [],
codegen: {
directory: "modules/uniqueentity/tables",
outputDirectory: "modules/uniqueentity/tables",
tableIdArgument: true,
storeArgument: true,
},
Expand All @@ -92,7 +92,7 @@ export default defineWorld({
},
key: ["delegator", "delegatee", "systemId", "callDataHash"],
codegen: {
directory: "modules/std-delegations/tables",
outputDirectory: "modules/std-delegations/tables",
},
},
SystemboundDelegations: {
Expand All @@ -104,7 +104,7 @@ export default defineWorld({
},
key: ["delegator", "delegatee", "systemId"],
codegen: {
directory: "modules/std-delegations/tables",
outputDirectory: "modules/std-delegations/tables",
},
},
TimeboundDelegations: {
Expand All @@ -115,7 +115,7 @@ export default defineWorld({
},
key: ["delegator", "delegatee"],
codegen: {
directory: "modules/std-delegations/tables",
outputDirectory: "modules/std-delegations/tables",
},
},
/************************************************************************
Expand All @@ -130,7 +130,7 @@ export default defineWorld({
},
key: ["systemId"],
codegen: {
directory: "modules/puppet/tables",
outputDirectory: "modules/puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -146,7 +146,7 @@ export default defineWorld({
},
key: ["account"],
codegen: {
directory: "modules/tokens/tables",
outputDirectory: "modules/tokens/tables",
tableIdArgument: true,
},
},
Expand All @@ -163,7 +163,7 @@ export default defineWorld({
},
key: [],
codegen: {
directory: "modules/erc20-puppet/tables",
outputDirectory: "modules/erc20-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -175,7 +175,7 @@ export default defineWorld({
},
key: ["account", "spender"],
codegen: {
directory: "modules/erc20-puppet/tables",
outputDirectory: "modules/erc20-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -185,7 +185,7 @@ export default defineWorld({
},
key: [],
codegen: {
directory: "modules/erc20-puppet/tables",
outputDirectory: "modules/erc20-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -196,7 +196,7 @@ export default defineWorld({
},
key: ["namespaceId"],
codegen: {
directory: "modules/erc20-puppet/tables",
outputDirectory: "modules/erc20-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -213,7 +213,7 @@ export default defineWorld({
},
key: [],
codegen: {
directory: "modules/erc721-puppet/tables",
outputDirectory: "modules/erc721-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -224,7 +224,7 @@ export default defineWorld({
},
key: ["tokenId"],
codegen: {
directory: "modules/erc721-puppet/tables",
outputDirectory: "modules/erc721-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -235,7 +235,7 @@ export default defineWorld({
},
key: ["tokenId"],
codegen: {
directory: "modules/erc721-puppet/tables",
outputDirectory: "modules/erc721-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -246,7 +246,7 @@ export default defineWorld({
},
key: ["tokenId"],
codegen: {
directory: "modules/erc721-puppet/tables",
outputDirectory: "modules/erc721-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -258,7 +258,7 @@ export default defineWorld({
},
key: ["owner", "operator"],
codegen: {
directory: "modules/erc721-puppet/tables",
outputDirectory: "modules/erc721-puppet/tables",
tableIdArgument: true,
},
},
Expand All @@ -269,7 +269,7 @@ export default defineWorld({
},
key: ["namespaceId"],
codegen: {
directory: "modules/erc721-puppet/tables",
outputDirectory: "modules/erc721-puppet/tables",
tableIdArgument: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/world-modules/ts/scripts/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const config = (await loadConfig()) as StoreConfig;
const srcDir = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDir, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDir, config.codegen.outputDirectory), remappings);
2 changes: 1 addition & 1 deletion packages/world-modules/ts/scripts/worldgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const existingContracts = glob.sync(`${srcDir}/**/*.sol`).map((path) => ({
// Load and resolve the config
const mudConfig = (await loadConfig(configPath)) as WorldConfig;

const outputBaseDirectory = path.join(srcDir, mudConfig.codegen.codegenDirectory);
const outputBaseDirectory = path.join(srcDir, mudConfig.codegen.outputDirectory);

// clear the worldgen directory
if (clean) {
Expand Down
6 changes: 4 additions & 2 deletions packages/world/ts/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { tablegen } from "@latticexyz/store/codegen";
import { defineWorld } from "../config/v2/world";

const config = defineWorld({
codegen: { codegenDirectory: "../test/codegen" },
codegen: {
outputDirectory: "../test/codegen",
},
tables: {
Bool: {
schema: {
Expand Down Expand Up @@ -35,4 +37,4 @@ const config = defineWorld({
const srcDir = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDir, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDir, config.codegen.outputDirectory), remappings);
2 changes: 1 addition & 1 deletion packages/world/ts/scripts/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const config = (await loadConfig()) as StoreConfig;
const srcDir = await getSrcDirectory();
const remappings = await getRemappings();

await tablegen(config, path.join(srcDir, config.codegen.codegenDirectory), remappings);
await tablegen(config, path.join(srcDir, config.codegen.outputDirectory), remappings);
2 changes: 1 addition & 1 deletion packages/world/ts/scripts/worldgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const existingContracts = glob.sync(`${srcDir}/**/*.sol`).map((path) => ({
// Load and resolve the config
const mudConfig = (await loadConfig(configPath)) as WorldConfig;

const outputBaseDirectory = path.join(srcDir, mudConfig.codegen.codegenDirectory);
const outputBaseDirectory = path.join(srcDir, mudConfig.codegen.outputDirectory);

// clear the worldgen directory
if (clean) {
Expand Down

0 comments on commit 665e81e

Please sign in to comment.