Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
dhvanipa committed Oct 31, 2023
1 parent 4f45215 commit 46a06a1
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 103 deletions.
4 changes: 2 additions & 2 deletions e2e/packages/sync-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@latticexyz/utils": "link:../../../packages/utils",
"@viem/anvil": "^0.0.6",
"abitype": "0.9.3",
"chalk": "^5.2.0",
"chalk": "4.1.2",
"dotenv": "^16.0.3",
"ethers": "^5.7.2",
"execa": "^7.1.1",
"execa": "^5.1.1",
"jsdom": "^22.0.0",
"typescript": "5.1.6",
"viem": "1.6.0",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"chalk": "^5.2.0",
"chalk": "4.1.2",
"eslint": "8.29.0",
"execa": "^7.0.0",
"execa": "^5.1.1",
"husky": ">=6",
"lint-staged": ">=10",
"prettier": "^2.8.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
"@latticexyz/utils": "workspace:*",
"@latticexyz/world": "workspace:*",
"@typechain/ethers-v5": "^10.2.0",
"chalk": "^5.0.1",
"chalk": "4.1.2",
"chokidar": "^3.5.3",
"dotenv": "^16.0.3",
"ejs": "^3.1.8",
"ethers": "^5.7.2",
"execa": "^7.0.0",
"execa": "^5.1.1",
"glob": "^8.0.3",
"nice-grpc-web": "^2.0.1",
"openurl": "^1.1.1",
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ try {
logError(error);
}

const srcDirectory = await getSrcDirectory();
(async () => {
const srcDirectory = await getSrcDirectory();

if (config !== undefined) {
tablegen(config, path.join(srcDirectory, config.codegenDirectory));
} else {
process.exit(1);
}
if (config !== undefined) {
tablegen(config, path.join(srcDirectory, config.codegenDirectory));
} else {
process.exit(1);
}
})();
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { rmSync } from "fs";
import { homedir } from "os";
import path from "path";
import type { CommandModule } from "yargs";
import { execa } from "execa";
import execa from "execa";

type Options = {
blocktime: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
"@latticexyz/schema-type": "workspace:*",
"@solidity-parser/parser": "^0.16.0",
"abitype": "0.9.3",
"chalk": "^5.2.0",
"chalk": "4.1.2",
"debug": "^4.3.4",
"execa": "^7.0.0",
"execa": "^5.1.1",
"prettier": "^2.8.4",
"prettier-plugin-solidity": "^1.1.2",
"viem": "1.6.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/foundry/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { execa, Options } from "execa";
// import { execa, Options } from "execa";
import execa, { Options } from "execa";
import chalk from "chalk";

export interface ForgeConfig {
Expand Down
5 changes: 5 additions & 0 deletions packages/config/src/library/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ export type MUDConfigExtender = (config: MUDCoreConfig) => Record<string, unknow
export function mudCoreConfig(config: MUDCoreUserConfig): MUDCoreConfig {
// config types can change with plugins, `any` helps avoid errors when typechecking dependencies
// eslint-disable-next-line @typescript-eslint/no-explicit-any
console.log("config");
console.log(config);
let configAsAny = config as any;
const context = MUDCoreContext.getContext();
console.log(context);
for (const extender of context.configExtenders) {
configAsAny = extender(configAsAny);
}
console.log("here done bro");
return configAsAny;
}

/** Utility for plugin developers to extend the core config */
export function extendMUDCoreConfig(extender: MUDConfigExtender) {
console.log("extending bro");
const context = MUDCoreContext.getContext();
context.configExtenders.push(extender);
}
5 changes: 4 additions & 1 deletion packages/config/src/node/loadConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const TEMP_CONFIG = "mud.config.temp.mjs";
export async function loadConfig(configPath?: string): Promise<unknown> {
configPath = await resolveConfigPath(configPath);
try {
console.log("preee");
await esbuild.build({
entryPoints: [configPath],
format: "esm",
Expand All @@ -24,13 +25,15 @@ export async function loadConfig(configPath?: string): Promise<unknown> {
// avoid bundling external imports (it's unnecessary and esbuild can't handle all node features)
packages: "external",
});
console.log("here");
configPath = await resolveConfigPath(TEMP_CONFIG, true);
// Node.js caches dynamic imports, so without appending a cache breaking
// param like `?update={Date.now()}` this import always returns the same config
// if called multiple times in a single process, like the `dev-contracts` cli
console.log("all the way here");
return (await import(configPath + `?update=${Date.now()}`)).default;
} finally {
rmSync(TEMP_CONFIG, { force: true });
// rmSync(TEMP_CONFIG, { force: true });
}
}

Expand Down
10 changes: 6 additions & 4 deletions packages/gas-report/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"directory": "packages/gas-report"
},
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
".": {
"require": "./dist/index.js",
"import": "./dist/index.js"
}
},
"typesVersions": {
"*": {
Expand All @@ -29,9 +31,9 @@
"test": "vitest typecheck --run --passWithNoTests && vitest --run --passWithNoTests && forge test"
},
"dependencies": {
"chalk": "^5.3.0",
"chalk": "4.1.2",
"dotenv": "^16.0.3",
"execa": "^7.0.0",
"execa": "^5.1.1",
"strip-ansi": "^7.1.0",
"table": "^6.8.1",
"yargs": "^17.7.1"
Expand Down
3 changes: 2 additions & 1 deletion packages/gas-report/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { CommandModule } from "yargs";
import { readFileSync, writeFileSync } from "fs";
import { execa } from "execa";
import execa from "execa";
import chalk from "chalk";
import { table, getBorderCharacters } from "table";
import stripAnsi from "strip-ansi";
// const stripAnsi = require('strip-ansi');

/**
* Print the gas report to the console, save it to a file and compare it to a previous gas report if provided.
Expand Down
2 changes: 1 addition & 1 deletion packages/gas-report/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["ts/index.ts", "ts/mud-gas-report.ts"],
target: "esnext",
format: ["esm"],
format: ["esm", "cjs"],
dts: false,
sourcemap: true,
clean: true,
Expand Down
7 changes: 5 additions & 2 deletions packages/store-indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
"directory": "packages/store-indexer"
},
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
".": {
"require": "./dist/index.js",
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "src/index.ts",
"scripts": {
"build": "pnpm run build:js",
Expand Down
2 changes: 1 addition & 1 deletion packages/store-indexer/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
target: "esnext",
format: ["esm"],
format: ["esm", "cjs"],
dts: false,
sourcemap: true,
clean: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/store/ts/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const PATH_DEFAULTS = {

export const DEFAULTS = {
namespace: "",
enums: {} as Record<string, never>,
enums: {} as Record<string, string[]>,
} as const;

export const TABLE_DEFAULTS = {
Expand Down
4 changes: 3 additions & 1 deletion packages/store/ts/config/storeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export type FullEnumsConfig<EnumNames extends StringForUnion> = {
};

export const zEnumsConfig = z.object({
enums: z.record(zUserEnumName, zUserEnum).default(DEFAULTS.enums),
enums: z.record(zUserEnumName, z.any()).default(DEFAULTS.enums),
});

/************************************************************************
Expand Down Expand Up @@ -305,6 +305,8 @@ function validateStoreConfig(config: z.output<typeof StoreConfigUnrefined>, ctx:
// Global names must be unique
const tableLibraryNames = Object.keys(config.tables);
const staticUserTypeNames = Object.keys(config.enums);
console.log("ENUMS");
console.log(staticUserTypeNames);
const userTypeNames = staticUserTypeNames;
const globalNames = [...tableLibraryNames, ...userTypeNames];
const duplicateGlobalNames = getDuplicates(globalNames);
Expand Down
2 changes: 2 additions & 0 deletions packages/store/ts/register/configExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ extendMUDCoreConfig((config) => {
// This function gets called within mudConfig.
// The call order of config extenders depends on the order of their imports.
// Any config validation and transformation should be placed here.
console.log("EXTENDEDDDDDD");
console.log(config);
try {
return zPluginStoreConfig.parse(config);
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions packages/store/ts/scripts/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { StoreConfig } from "..";

(async () => {
const config = (await loadConfig()) as StoreConfig;
const srcDir = await getSrcDirectory();
await tablegen(config, path.join(srcDir, config.codegenDirectory));
// const srcDir = await getSrcDirectory();
// await tablegen(config, path.join(srcDir, config.codegenDirectory));
})();
2 changes: 1 addition & 1 deletion packages/store/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* Visit https://aka.ms/tsconfig.json to read more about this file */
"target": "es2021",
"types": ["node"],
"module": "esnext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
Expand Down
Loading

0 comments on commit 46a06a1

Please sign in to comment.