@latticexyz/cli 2.0.0-alpha.94 → 2.0.0-main-0d434816

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/chunk-LFIOIY67.js +30 -0
  2. package/dist/chunk-LFIOIY67.js.map +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/mud.js +15 -8340
  6. package/dist/mud.js.map +1 -0
  7. package/package.json +45 -43
  8. package/src/commands/deploy.ts +49 -0
  9. package/src/commands/dev-contracts.ts +176 -0
  10. package/src/commands/devnode.ts +7 -2
  11. package/src/commands/faucet.ts +1 -1
  12. package/src/commands/index.ts +18 -13
  13. package/src/commands/set-version.ts +38 -10
  14. package/src/commands/tablegen.ts +5 -4
  15. package/src/commands/{test-v2.ts → test.ts} +5 -6
  16. package/src/commands/trace.ts +108 -0
  17. package/src/commands/tsgen.ts +4 -3
  18. package/src/commands/worldgen.ts +29 -28
  19. package/src/index.ts +2 -1
  20. package/src/modules.d.ts +11 -0
  21. package/src/mud.ts +10 -4
  22. package/src/render-ts/recsV1TableOptions.ts +4 -4
  23. package/src/render-ts/renderRecsV1Tables.ts +3 -3
  24. package/src/render-ts/schemaTypesToRecsTypeStrings.ts +33 -33
  25. package/src/render-ts/tsgen.ts +4 -4
  26. package/src/utils/{deploy-v2.ts → deploy.ts} +207 -123
  27. package/src/utils/deployHandler.ts +87 -0
  28. package/src/utils/errors.ts +1 -1
  29. package/src/utils/getExistingContracts.ts +12 -0
  30. package/src/utils/index.ts +7 -5
  31. package/src/utils/printMUD.ts +14 -0
  32. package/src/utils/worldtypes.ts +21 -0
  33. package/dist/chunk-6V563IAZ.js +0 -283
  34. package/dist/chunk-FPG73MVN.js +0 -71
  35. package/dist/chunk-L4YLJHLJ.js +0 -30
  36. package/dist/chunk-SKNB74MT.js +0 -726
  37. package/dist/chunk-T2YHSEJD.js +0 -3842
  38. package/dist/chunk-VQTZJIFF.js +0 -353
  39. package/dist/chunk-WZFXLDPK.js +0 -761
  40. package/dist/chunk-YL4GJLLL.js +0 -26139
  41. package/dist/index.d.ts +0 -2
  42. package/dist/mud.d.ts +0 -1
  43. package/dist/mud2.d.ts +0 -1
  44. package/dist/mud2.js +0 -25
  45. package/dist/render-solidity/index.d.ts +0 -171
  46. package/dist/render-solidity/index.js +0 -49
  47. package/dist/render-ts/index.d.ts +0 -26
  48. package/dist/render-ts/index.js +0 -14
  49. package/dist/utils/deprecated/index.d.ts +0 -76
  50. package/dist/utils/deprecated/index.js +0 -36
  51. package/dist/utils/index.d.ts +0 -88
  52. package/dist/utils/index.js +0 -39
  53. package/src/commands/deploy-v2.ts +0 -112
  54. package/src/commands/deprecated/bulkupload.ts +0 -50
  55. package/src/commands/deprecated/call-system.ts +0 -70
  56. package/src/commands/deprecated/codegen-libdeploy.ts +0 -29
  57. package/src/commands/deprecated/deploy-contracts.ts +0 -120
  58. package/src/commands/deprecated/index.ts +0 -22
  59. package/src/commands/deprecated/system-types.ts +0 -29
  60. package/src/commands/deprecated/test.ts +0 -53
  61. package/src/commands/deprecated/trace.ts +0 -81
  62. package/src/commands/deprecated/types.ts +0 -33
  63. package/src/commands/gas-report.ts +0 -219
  64. package/src/contracts/BulkUpload.sol +0 -174
  65. package/src/contracts/Deploy.sol +0 -23
  66. package/src/contracts/LibDeploy.ejs +0 -121
  67. package/src/contracts/LibDeploy.sol +0 -23
  68. package/src/contracts/LibDeployStub.sol +0 -23
  69. package/src/mud2.ts +0 -29
  70. package/src/render-solidity/common.ts +0 -138
  71. package/src/render-solidity/field.ts +0 -160
  72. package/src/render-solidity/index.ts +0 -10
  73. package/src/render-solidity/record.ts +0 -158
  74. package/src/render-solidity/renderSystemInterface.ts +0 -31
  75. package/src/render-solidity/renderTable.ts +0 -164
  76. package/src/render-solidity/renderTableIndex.ts +0 -15
  77. package/src/render-solidity/renderTypeHelpers.ts +0 -99
  78. package/src/render-solidity/renderTypes.ts +0 -19
  79. package/src/render-solidity/renderTypesFromConfig.ts +0 -13
  80. package/src/render-solidity/renderWorld.ts +0 -24
  81. package/src/render-solidity/tableOptions.ts +0 -107
  82. package/src/render-solidity/tablegen.ts +0 -35
  83. package/src/render-solidity/types.ts +0 -111
  84. package/src/render-solidity/userType.ts +0 -131
  85. package/src/render-solidity/worldgen.ts +0 -59
  86. package/src/utils/contractToInterface.ts +0 -132
  87. package/src/utils/deprecated/build.ts +0 -55
  88. package/src/utils/deprecated/codegen.ts +0 -42
  89. package/src/utils/deprecated/constants.ts +0 -2
  90. package/src/utils/deprecated/deploy.ts +0 -111
  91. package/src/utils/deprecated/exec.ts +0 -18
  92. package/src/utils/deprecated/findLog.ts +0 -8
  93. package/src/utils/deprecated/hsr.ts +0 -71
  94. package/src/utils/deprecated/ids.ts +0 -14
  95. package/src/utils/deprecated/index.ts +0 -8
  96. package/src/utils/deprecated/typegen.ts +0 -133
  97. package/src/utils/execLog.ts +0 -22
  98. package/src/utils/format.ts +0 -39
  99. package/src/utils/formatAndWrite.ts +0 -21
  100. package/src/utils/foundry.ts +0 -103
@@ -1,21 +0,0 @@
1
- import { mkdirSync, writeFileSync } from "fs";
2
- import { dirname } from "path";
3
- import { formatSolidity, formatTypescript } from "./format.js";
4
-
5
- export async function formatAndWriteSolidity(output: string, fullOutputPath: string, logPrefix: string) {
6
- const formattedOutput = await formatSolidity(output);
7
-
8
- mkdirSync(dirname(fullOutputPath), { recursive: true });
9
-
10
- writeFileSync(fullOutputPath, formattedOutput);
11
- console.log(`${logPrefix}: ${fullOutputPath}`);
12
- }
13
-
14
- export async function formatAndWriteTypescript(output: string, fullOutputPath: string, logPrefix: string) {
15
- const formattedOutput = await formatTypescript(output);
16
-
17
- mkdirSync(dirname(fullOutputPath), { recursive: true });
18
-
19
- writeFileSync(fullOutputPath, formattedOutput);
20
- console.log(`${logPrefix}: ${fullOutputPath}`);
21
- }
@@ -1,103 +0,0 @@
1
- import { execa, Options } from "execa";
2
- import { execLog } from "./execLog.js";
3
-
4
- export interface ForgeConfig {
5
- // project
6
- src: string;
7
- test: string;
8
- script: string;
9
- out: string;
10
- libs: string[];
11
- eth_rpc_url: string | null;
12
-
13
- // all unspecified keys (this interface is far from comprehensive)
14
- [key: string]: unknown;
15
- }
16
-
17
- /**
18
- * Get forge config as a parsed json object.
19
- */
20
- export async function getForgeConfig(profile?: string) {
21
- const { stdout } = await execa("forge", ["config", "--json"], {
22
- stdio: ["inherit", "pipe", "pipe"],
23
- env: { FOUNDRY_PROFILE: profile },
24
- });
25
-
26
- return JSON.parse(stdout) as ForgeConfig;
27
- }
28
-
29
- /**
30
- * Get the value of "src" from forge config.
31
- * The path to the contract sources relative to the root of the project.
32
- */
33
- export async function getSrcDirectory(profile?: string) {
34
- return (await getForgeConfig(profile)).src;
35
- }
36
-
37
- /**
38
- * Get the value of "script" from forge config.
39
- * The path to the contract sources relative to the root of the project.
40
- */
41
- export async function getScriptDirectory(profile?: string) {
42
- return (await getForgeConfig(profile)).script;
43
- }
44
-
45
- /**
46
- * Get the value of "test" from forge config.
47
- * The path to the test contract sources relative to the root of the project.
48
- */
49
- export async function getTestDirectory(profile?: string) {
50
- return (await getForgeConfig(profile)).test;
51
- }
52
-
53
- /**
54
- * Get the value of "out" from forge config.
55
- * The path to put contract artifacts in, relative to the root of the project.
56
- */
57
- export async function getOutDirectory(profile?: string) {
58
- return (await getForgeConfig(profile)).out;
59
- }
60
-
61
- /**
62
- * Get the value of "eth_rpc_url" from forge config, default to "http://127.0.0.1:8545"
63
- * @param profile The foundry profile to use
64
- * @returns The rpc url
65
- */
66
- export async function getRpcUrl(profile?: string) {
67
- return (await getForgeConfig(profile)).eth_rpc_url || "http://127.0.0.1:8545";
68
- }
69
-
70
- /**
71
- * Execute a forge command
72
- * @param args The arguments to pass to forge
73
- * @param options { profile?: The foundry profile to use; silent?: If true, nothing will be logged to the console }
74
- */
75
- export async function forge(args: string[], options?: { profile?: string; silent?: boolean }): Promise<void> {
76
- const execOptions: Options<string> = {
77
- env: { FOUNDRY_PROFILE: options?.profile },
78
- stdout: "inherit",
79
- stderr: "pipe",
80
- };
81
-
82
- await (options?.silent ? execa("forge", args, execOptions) : execLog("forge", args, execOptions));
83
- }
84
-
85
- /**
86
- * Execute a cast command
87
- * @param args The arguments to pass to cast
88
- * @returns Stdout of the command
89
- */
90
- export async function cast(args: string[], options?: { profile?: string }): Promise<string> {
91
- return execLog("cast", args, {
92
- env: { FOUNDRY_PROFILE: options?.profile },
93
- });
94
- }
95
-
96
- /**
97
- * Start an anvil chain
98
- * @param args The arguments to pass to anvil
99
- * @returns Stdout of the command
100
- */
101
- export async function anvil(args: string[]): Promise<string> {
102
- return execLog("anvil", args);
103
- }