@latticexyz/cli 1.40.0 → 2.0.0-alpha.0
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.
- package/LICENSE +21 -0
- package/dist/chunk-ATAWDHWC.js +67 -0
- package/dist/{chunk-6AQ6LFVZ.js → chunk-J4DJQNIC.js} +743 -103
- package/dist/chunk-O57QENJ6.js +23039 -0
- package/dist/{chunk-S3V3XX7N.js → chunk-SLIMIO4Z.js} +1 -1
- package/dist/config/index.d.ts +746 -8
- package/dist/config/index.js +63 -17
- package/dist/index.d.ts +1 -2
- package/dist/index.js +14 -10
- package/dist/mud.js +1055 -49
- package/dist/utils/deprecated/index.js +2 -2
- package/dist/utils/index.d.ts +56 -7
- package/dist/utils/index.js +17 -3
- package/package.json +16 -11
- package/src/commands/deploy-v2.ts +96 -0
- package/src/commands/deprecated/call-system.ts +1 -1
- package/src/commands/deprecated/deploy-contracts.ts +1 -1
- package/src/commands/deprecated/test.ts +9 -6
- package/src/commands/deprecated/trace.ts +1 -1
- package/src/commands/gas-report.ts +1 -1
- package/src/commands/index.ts +4 -0
- package/src/commands/tablegen.ts +4 -18
- package/src/commands/worldgen.ts +55 -0
- package/src/config/commonSchemas.ts +19 -5
- package/src/config/dynamicResolution.ts +49 -0
- package/src/config/index.ts +20 -0
- package/src/config/loadStoreConfig.ts +3 -89
- package/src/config/parseStoreConfig.test-d.ts +40 -0
- package/src/config/parseStoreConfig.ts +314 -0
- package/src/config/validation.ts +71 -0
- package/src/config/world/index.ts +4 -0
- package/src/config/world/loadWorldConfig.test-d.ts +11 -0
- package/src/config/world/loadWorldConfig.ts +26 -0
- package/src/config/world/parseWorldConfig.ts +55 -0
- package/src/config/world/resolveWorldConfig.ts +80 -0
- package/src/config/world/userTypes.ts +72 -0
- package/src/index.ts +13 -5
- package/src/mud.ts +4 -0
- package/src/render-solidity/common.ts +138 -0
- package/src/render-solidity/field.ts +137 -0
- package/src/render-solidity/index.ts +10 -0
- package/src/render-solidity/record.ts +154 -0
- package/src/render-solidity/renderSystemInterface.ts +31 -0
- package/src/render-solidity/renderTable.ts +164 -0
- package/src/render-solidity/renderTypeHelpers.ts +99 -0
- package/src/render-solidity/renderTypes.ts +19 -0
- package/src/render-solidity/renderTypesFromConfig.ts +13 -0
- package/src/render-solidity/renderWorld.ts +24 -0
- package/src/{render-table/renderTablesFromConfig.ts → render-solidity/tableOptions.ts} +45 -37
- package/src/render-solidity/tablegen.ts +33 -0
- package/src/render-solidity/types.ts +110 -0
- package/src/render-solidity/userType.ts +132 -0
- package/src/render-solidity/worldgen.ts +60 -0
- package/src/utils/contractToInterface.ts +130 -0
- package/src/utils/deploy-v2.ts +512 -0
- package/src/utils/deprecated/build.ts +1 -1
- package/src/utils/deprecated/typegen.ts +1 -1
- package/src/utils/errors.ts +12 -2
- package/src/utils/execLog.ts +22 -0
- package/src/utils/formatAndWrite.ts +12 -0
- package/src/utils/foundry.ts +94 -0
- package/src/utils/getChainId.ts +10 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/typeUtils.ts +17 -0
- package/dist/chunk-B6VWCGHZ.js +0 -199
- package/dist/chunk-JKAA3WMC.js +0 -55
- package/dist/chunk-JNGSW4AP.js +0 -493
- package/dist/chunk-PJ6GS2R4.js +0 -22
- package/dist/chunk-UC3QPOON.js +0 -35
- package/dist/loadStoreConfig-37f99136.d.ts +0 -164
- package/dist/render-table/index.d.ts +0 -29
- package/dist/render-table/index.js +0 -24
- package/dist/renderTable-9e6410c5.d.ts +0 -72
- package/src/config/loadStoreConfig.test-d.ts +0 -11
- package/src/render-table/common.ts +0 -67
- package/src/render-table/field.ts +0 -132
- package/src/render-table/index.ts +0 -6
- package/src/render-table/record.ts +0 -176
- package/src/render-table/renderTable.ts +0 -109
- package/src/render-table/types.ts +0 -51
- package/src/utils/forgeConfig.ts +0 -45
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present Lattice Labs Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// src/utils/foundry.ts
|
|
2
|
+
import { execa as execa2 } from "execa";
|
|
3
|
+
|
|
4
|
+
// src/utils/execLog.ts
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import { execa } from "execa";
|
|
7
|
+
async function execLog(command, args, options) {
|
|
8
|
+
const commandString = `${command} ${args.join(" ")}`;
|
|
9
|
+
try {
|
|
10
|
+
console.log(chalk.gray(`running "${commandString}"`));
|
|
11
|
+
const { stdout } = await execa(command, args, { stdout: "pipe", stderr: "pipe", ...options });
|
|
12
|
+
return stdout;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
let errorMessage = error?.stderr || error?.message || "";
|
|
15
|
+
errorMessage += chalk.red(`
|
|
16
|
+
Error running "${commandString}"`);
|
|
17
|
+
throw new Error(errorMessage);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/utils/foundry.ts
|
|
22
|
+
async function getForgeConfig(profile) {
|
|
23
|
+
const { stdout } = await execa2("forge", ["config", "--json"], {
|
|
24
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
25
|
+
env: { FOUNDRY_PROFILE: profile }
|
|
26
|
+
});
|
|
27
|
+
return JSON.parse(stdout);
|
|
28
|
+
}
|
|
29
|
+
async function getSrcDirectory(profile) {
|
|
30
|
+
return (await getForgeConfig(profile)).src;
|
|
31
|
+
}
|
|
32
|
+
async function getScriptDirectory(profile) {
|
|
33
|
+
return (await getForgeConfig(profile)).script;
|
|
34
|
+
}
|
|
35
|
+
async function getTestDirectory(profile) {
|
|
36
|
+
return (await getForgeConfig(profile)).test;
|
|
37
|
+
}
|
|
38
|
+
async function getOutDirectory(profile) {
|
|
39
|
+
return (await getForgeConfig(profile)).out;
|
|
40
|
+
}
|
|
41
|
+
async function getRpcUrl(profile) {
|
|
42
|
+
return (await getForgeConfig(profile)).eth_rpc_url || "http://127.0.0.1:8545";
|
|
43
|
+
}
|
|
44
|
+
async function forge(args, options) {
|
|
45
|
+
const execOptions = {
|
|
46
|
+
env: { FOUNDRY_PROFILE: options?.profile },
|
|
47
|
+
stdout: "inherit",
|
|
48
|
+
stderr: "pipe"
|
|
49
|
+
};
|
|
50
|
+
await (options?.silent ? execa2("forge", args, execOptions) : execLog("forge", args, execOptions));
|
|
51
|
+
}
|
|
52
|
+
async function cast(args, options) {
|
|
53
|
+
return execLog("cast", args, {
|
|
54
|
+
env: { FOUNDRY_PROFILE: options?.profile }
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
getForgeConfig,
|
|
60
|
+
getSrcDirectory,
|
|
61
|
+
getScriptDirectory,
|
|
62
|
+
getTestDirectory,
|
|
63
|
+
getOutDirectory,
|
|
64
|
+
getRpcUrl,
|
|
65
|
+
forge,
|
|
66
|
+
cast
|
|
67
|
+
};
|