@latticexyz/cli 0.9.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.
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
13
+ const utils_1 = require("ethers/lib/utils");
14
+ const utils_2 = require("../utils");
15
+ exports.command = "call-system";
16
+ exports.desc = "Execute a mud system";
17
+ const builder = (yargs) => yargs.options({
18
+ rpc: { type: "string", description: "json rpc endpoint, defaults to http://localhost:8545" },
19
+ caller: { type: "string", description: "caller address" },
20
+ world: { type: "string", required: true, description: "world contract address" },
21
+ systemId: { type: "string", description: "system id preimage (eg mud.system.Move)" },
22
+ systemAddress: { type: "string", description: "system address (alternative to system id)" },
23
+ argTypes: { type: "array", description: "system argument types for abi encoding" },
24
+ args: { type: "array", description: "system arguments" },
25
+ calldata: { type: "string", description: "abi encoded system arguments (instead of args/argTypes)" },
26
+ broadcast: { type: "boolean", description: "send txs to the chain" },
27
+ callerPrivateKey: {
28
+ type: "string",
29
+ description: "must be set if broadcast is set, must correspond to caller address",
30
+ },
31
+ debug: { type: "boolean", description: "open debugger" },
32
+ });
33
+ exports.builder = builder;
34
+ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
35
+ var _a;
36
+ const { rpc, caller, world, systemId, argTypes, args, calldata, broadcast, callerPrivateKey, debug } = argv;
37
+ const encodedArgs = (_a = calldata !== null && calldata !== void 0 ? calldata : (argTypes && args && utils_1.defaultAbiCoder.encode(argTypes, args))) !== null && _a !== void 0 ? _a : "";
38
+ yield (0, utils_2.execLog)("forge", [
39
+ "script",
40
+ "--fork-url",
41
+ rpc !== null && rpc !== void 0 ? rpc : "http://localhost:8545",
42
+ "--sig",
43
+ "debug(address,address,string,bytes,bool)",
44
+ "src/test/utils/Debug.sol",
45
+ caller !== null && caller !== void 0 ? caller : "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
46
+ world,
47
+ systemId || "",
48
+ encodedArgs,
49
+ broadcast ? "true" : "false",
50
+ "-vvvvv",
51
+ broadcast ? "--broadcast" : "",
52
+ callerPrivateKey ? `--private-key ${callerPrivateKey}` : "",
53
+ debug ? "--debug" : "",
54
+ ]);
55
+ process.exit(0);
56
+ });
57
+ exports.handler = handler;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
13
+ const utils_1 = require("../utils");
14
+ exports.command = "create <name>";
15
+ exports.desc = "Sets up a fresh mud project into <name>. Requires yarn.";
16
+ const builder = (yargs) => yargs.positional("name", { type: "string", demandOption: true });
17
+ exports.builder = builder;
18
+ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const { name } = argv;
20
+ console.log("Creating new mud project in", name);
21
+ console.log("Cloning...");
22
+ yield (0, utils_1.exec)(`git clone https://github.com/latticexyz/mud _mudtemp`);
23
+ console.log("Moving...");
24
+ yield (0, utils_1.exec)(`cp -r _mudtemp/packages/ri ${name}`);
25
+ console.log("Setting up vscode solidity settings...");
26
+ yield (0, utils_1.exec)(`cp -r _mudtemp/.vscode ${name}/.vscode`);
27
+ console.log("Cleaning up...");
28
+ yield (0, utils_1.exec)(`rm -rf _mudtemp`);
29
+ console.log("Setting up package.json...");
30
+ yield (0, utils_1.exec)(`mv ${name}/packagejson.template ${name}/package.json`);
31
+ console.log("Installing dependencies using yarn...");
32
+ yield (0, utils_1.exec)(`cd ${name} && yarn install`);
33
+ console.log("Setting up foundry.toml...");
34
+ yield (0, utils_1.exec)(`rm ${name}/contracts/foundry.toml`);
35
+ yield (0, utils_1.exec)(`mv ${name}/contracts/foundrytoml.template ${name}/contracts/foundry.toml`);
36
+ console.log("Setting up remappings...");
37
+ yield (0, utils_1.exec)(`rm ${name}/contracts/remappings.txt`);
38
+ yield (0, utils_1.exec)(`mv ${name}/contracts/remappingstxt.template ${name}/contracts/remappings.txt`);
39
+ console.log("Setting up compile task...");
40
+ yield (0, utils_1.exec)(`rm ${name}/contracts/tasks/compile.ts`);
41
+ yield (0, utils_1.exec)(`mv ${name}/contracts/tasks/compilets.template ${name}/contracts/tasks/compile.ts`);
42
+ console.log("Building contracts...");
43
+ yield (0, utils_1.exec)(`cd ${name}/contracts && yarn build`);
44
+ console.log("Done setting up! Run `yarn start` to start client and chain, then head to localhost:3000 to explore.");
45
+ process.exit(0);
46
+ });
47
+ exports.handler = handler;
@@ -0,0 +1,442 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.deploy = exports.handler = exports.builder = exports.desc = exports.command = void 0;
16
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18
+ const ethers_1 = require("ethers");
19
+ const inquirer_1 = __importDefault(require("inquirer"));
20
+ const uuid_1 = require("uuid");
21
+ const listr2_1 = require("listr2");
22
+ const process_1 = require("process");
23
+ const fs_1 = __importDefault(require("fs"));
24
+ const openurl_1 = __importDefault(require("openurl"));
25
+ const inquirer_prompt_suggest_1 = __importDefault(require("inquirer-prompt-suggest"));
26
+ inquirer_1.default.registerPrompt("suggest", inquirer_prompt_suggest_1.default);
27
+ // Workaround to prevent tsc to transpile dynamic imports with require, which causes an error upstream
28
+ // https://github.com/microsoft/TypeScript/issues/43329#issuecomment-922544562
29
+ const importNetlify = eval('import("netlify")');
30
+ const importChalk = eval('import("chalk")');
31
+ const importExeca = eval('import("execa")');
32
+ const importFetch = eval('import("node-fetch")');
33
+ exports.command = "deploy";
34
+ exports.desc = "Deploys the local mud contracts and optionally the client";
35
+ const builder = (yargs) => yargs.options({
36
+ i: { type: "boolean" },
37
+ chainSpec: { type: "string" },
38
+ chainId: { type: "number" },
39
+ rpc: { type: "string" },
40
+ wsRpc: { type: "string" },
41
+ world: { type: "string" },
42
+ reuseComponents: { type: "boolean" },
43
+ deployerPrivateKey: { type: "string" },
44
+ deployClient: { type: "boolean" },
45
+ clientUrl: { type: "string" },
46
+ netlifySlug: { type: "string" },
47
+ netlifyPersonalToken: { type: "string" },
48
+ upgradeSystems: { type: "boolean" },
49
+ codespace: { type: "boolean" },
50
+ dry: { type: "boolean" },
51
+ });
52
+ exports.builder = builder;
53
+ const handler = (args) => __awaiter(void 0, void 0, void 0, function* () {
54
+ const info = yield getDeployInfo(args);
55
+ yield (0, exports.deploy)(info);
56
+ });
57
+ exports.handler = handler;
58
+ function isValidHttpUrl(s) {
59
+ let url;
60
+ try {
61
+ url = new URL(s);
62
+ }
63
+ catch (_) {
64
+ return false;
65
+ }
66
+ return url.protocol === "http:" || url.protocol === "https:";
67
+ }
68
+ function findLog(deployLogLines, log) {
69
+ for (const logLine of deployLogLines) {
70
+ if (logLine.includes(log)) {
71
+ return logLine.split(log)[1].trim();
72
+ }
73
+ }
74
+ throw new Error("Can not find log");
75
+ }
76
+ const getDeployInfo = (args) => __awaiter(void 0, void 0, void 0, function* () {
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
78
+ const { default: chalk } = yield importChalk;
79
+ console.log();
80
+ console.log(chalk.bgWhite.black.bold(" == Mud Deployer == "));
81
+ console.log();
82
+ let config = {};
83
+ try {
84
+ config = JSON.parse(fs_1.default.readFileSync("mud.config.json", "utf8"));
85
+ }
86
+ catch (e) {
87
+ console.log("No mud.config.json found, using command line args");
88
+ }
89
+ const getNetlifyAccounts = (token) => __awaiter(void 0, void 0, void 0, function* () {
90
+ const { NetlifyAPI: netlify } = yield importNetlify;
91
+ const netlifyAPI = new netlify(token);
92
+ console.log("Netlify api");
93
+ const accounts = yield netlifyAPI.listAccountsForUser();
94
+ console.log("Accounts");
95
+ return accounts.map((a) => a.slug);
96
+ });
97
+ const defaultOptions = {
98
+ chainSpec: "chainSpec.json",
99
+ chainId: 31337,
100
+ rpc: "http://localhost:8545",
101
+ wsRpc: "ws://localhost:8545",
102
+ reuseComponents: false,
103
+ deployClient: false,
104
+ clientUrl: "http://localhost:3000",
105
+ upgradeSystems: false,
106
+ };
107
+ const { default: fetch } = yield importFetch;
108
+ // Fetch deployed lattice chains
109
+ const latticeChains = args.i
110
+ ? (yield (yield fetch("https://registry.lattice.xyz/api?update=true")).json())
111
+ : [];
112
+ const chainSpecs = (latticeChains === null || latticeChains === void 0 ? void 0 : latticeChains.map((e) => e.specUrl)) || [];
113
+ console.log("Available Lattice chains");
114
+ console.log(JSON.stringify(latticeChains, null, 2));
115
+ const answers = args.upgradeSystems && !args.world
116
+ ? yield inquirer_1.default.prompt([
117
+ {
118
+ type: "input",
119
+ name: "world",
120
+ message: "Provide the address of the World contract to upgrade the systems on.",
121
+ when: () => args.world == null && config.world == null,
122
+ validate: (i) => {
123
+ if (!i || (i[0] == "0" && i[1] == "x" && i.length === 42))
124
+ return true;
125
+ return "Invalid address";
126
+ },
127
+ },
128
+ ])
129
+ : args.i
130
+ ? yield inquirer_1.default.prompt([
131
+ {
132
+ type: "suggest",
133
+ name: "chainSpec",
134
+ message: "Provide a chainSpec.json location (local or remote)",
135
+ suggestions: chainSpecs,
136
+ when: () => args.chainSpec == null && config.chainSpec == null,
137
+ },
138
+ {
139
+ type: "number",
140
+ name: "chainId",
141
+ default: defaultOptions.chainId,
142
+ message: "Provide a chainId for the deployment",
143
+ when: (answers) => answers.chainSpec == null && args.chainId == null && config.chainSpec == null,
144
+ },
145
+ {
146
+ type: "input",
147
+ name: "wsRpc",
148
+ default: defaultOptions.wsRpc,
149
+ message: "Provide a WebSocket RPC endpoint for your deployment",
150
+ when: (answers) => answers.chainSpec == null && args.wsRpc == null && config.wsRpc == null,
151
+ },
152
+ {
153
+ type: "input",
154
+ name: "rpc",
155
+ default: defaultOptions.rpc,
156
+ message: "Provide a JSON RPC endpoint for your deployment",
157
+ when: (answers) => answers.chainSpec == null && args.rpc == null && config.rpc == null,
158
+ validate: (i) => {
159
+ if (isValidHttpUrl(i))
160
+ return true;
161
+ return "Invalid URL";
162
+ },
163
+ },
164
+ {
165
+ type: "input",
166
+ name: "world",
167
+ message: "Provide the address of an existing World contract. (If none is given, a new World will be deployed.)",
168
+ when: () => args.world == null && config.world == null,
169
+ validate: (i) => {
170
+ if (!i || (i[0] == "0" && i[1] == "x" && i.length === 42))
171
+ return true;
172
+ return "Invalid address";
173
+ },
174
+ },
175
+ {
176
+ type: "list",
177
+ name: "upgradeSystems",
178
+ message: "Only upgrade systems?",
179
+ choices: [
180
+ { name: "Yes", value: true },
181
+ { name: "No", value: false },
182
+ ],
183
+ default: defaultOptions.upgradeSystems,
184
+ when: (answers) => (args.world || config.world || answers.world) &&
185
+ args.upgradeSystems == null &&
186
+ config.upgradeSystems == null,
187
+ },
188
+ {
189
+ type: "list",
190
+ name: "reuseComponents",
191
+ message: "Reuse existing components?",
192
+ choices: [
193
+ { name: "Yes", value: true },
194
+ { name: "No", value: false },
195
+ ],
196
+ default: defaultOptions.reuseComponents,
197
+ when: (answers) => !answers.upgradeSystems &&
198
+ !args.upgradeSystems &&
199
+ !config.upgradeSystems &&
200
+ args.reuseComponents == null &&
201
+ config.reuseComponents == null,
202
+ },
203
+ {
204
+ type: "input",
205
+ name: "deployerPrivateKey",
206
+ message: "Enter private key of the deployer account:",
207
+ when: () => !args.deployerPrivateKey && !config.deployerPrivateKey,
208
+ validate: (i) => {
209
+ if (i[0] == "0" && i[1] == "x" && i.length === 66)
210
+ return true;
211
+ return "Invalid private key";
212
+ },
213
+ },
214
+ {
215
+ type: "list",
216
+ message: "Deploy the client?",
217
+ choices: [
218
+ { name: "Yes", value: true },
219
+ { name: "No", value: false },
220
+ ],
221
+ default: defaultOptions.deployClient,
222
+ name: "deployClient",
223
+ when: () => args.deployClient == null && config.deployClient == null,
224
+ },
225
+ {
226
+ type: "input",
227
+ name: "netlifyPersonalToken",
228
+ message: "Enter a netlify personal token for deploying the client:",
229
+ when: (answers) => answers.deployClient && !args.netlifyPersonalToken && !config.netlifyPersonalToken,
230
+ },
231
+ {
232
+ type: "list",
233
+ message: "From which netlify account?",
234
+ choices: (answers) => __awaiter(void 0, void 0, void 0, function* () {
235
+ var _13, _14;
236
+ return yield getNetlifyAccounts((_14 = (_13 = args.netlifyPersonalToken) !== null && _13 !== void 0 ? _13 : config.netlifyPersonalToken) !== null && _14 !== void 0 ? _14 : answers.netlifyPersonalToken);
237
+ }),
238
+ name: "netlifySlug",
239
+ when: (answers) => answers.deployClient && !args.netlifySlug && !config.netlifySlug,
240
+ },
241
+ {
242
+ type: "input",
243
+ name: "clientUrl",
244
+ message: "Enter URL of an already deployed client:",
245
+ when: (answers) => !answers.deployClient && !args.clientUrl && !config.clientUrl,
246
+ default: "http://localhost:3000",
247
+ validate: (i) => {
248
+ if (isValidHttpUrl(i)) {
249
+ if (i[i.length - 1] === "/") {
250
+ return "No trailing slash";
251
+ }
252
+ return true;
253
+ }
254
+ else {
255
+ return "Not a valid URL";
256
+ }
257
+ },
258
+ },
259
+ ])
260
+ : {};
261
+ const chainSpecUrl = (_b = (_a = args.chainSpec) !== null && _a !== void 0 ? _a : config.chainSpec) !== null && _b !== void 0 ? _b : answers.chainSpec;
262
+ const chainSpec = !chainSpecUrl
263
+ ? null
264
+ : isValidHttpUrl(chainSpecUrl)
265
+ ? yield (yield fetch(chainSpecUrl)).json()
266
+ : JSON.parse(fs_1.default.readFileSync(chainSpecUrl, "utf8"));
267
+ // Priority of config source: command line args >> chainSpec >> local config >> interactive answers >> defaults
268
+ // -> Command line args can override every other config, interactive questions are only asked if no other config given for this option
269
+ return {
270
+ chainSpec: (_e = (_d = (_c = args.chainSpec) !== null && _c !== void 0 ? _c : config.chainSpec) !== null && _d !== void 0 ? _d : answers.chainSpec) !== null && _e !== void 0 ? _e : defaultOptions.chainSpec,
271
+ chainId: (_j = (_h = (_g = (_f = args.chainId) !== null && _f !== void 0 ? _f : chainSpec === null || chainSpec === void 0 ? void 0 : chainSpec.chainId) !== null && _g !== void 0 ? _g : config.chainId) !== null && _h !== void 0 ? _h : answers.chainId) !== null && _j !== void 0 ? _j : defaultOptions.chainId,
272
+ rpc: (_o = (_m = (_l = (_k = args.rpc) !== null && _k !== void 0 ? _k : chainSpec === null || chainSpec === void 0 ? void 0 : chainSpec.rpc) !== null && _l !== void 0 ? _l : config.rpc) !== null && _m !== void 0 ? _m : answers.rpc) !== null && _o !== void 0 ? _o : defaultOptions.rpc,
273
+ wsRpc: (_s = (_r = (_q = (_p = args.wsRpc) !== null && _p !== void 0 ? _p : chainSpec === null || chainSpec === void 0 ? void 0 : chainSpec.wsRpc) !== null && _q !== void 0 ? _q : config.wsRpc) !== null && _r !== void 0 ? _r : answers.wsRpc) !== null && _s !== void 0 ? _s : defaultOptions.wsRpc,
274
+ world: (_v = (_u = (_t = args.world) !== null && _t !== void 0 ? _t : chainSpec === null || chainSpec === void 0 ? void 0 : chainSpec.world) !== null && _u !== void 0 ? _u : config.world) !== null && _v !== void 0 ? _v : answers.world,
275
+ upgradeSystems: (_x = (_w = args.upgradeSystems) !== null && _w !== void 0 ? _w : config.upgradeSystems) !== null && _x !== void 0 ? _x : answers.upgradeSystems,
276
+ reuseComponents: (_0 = (_z = (_y = args.reuseComponents) !== null && _y !== void 0 ? _y : config.reuseComponents) !== null && _z !== void 0 ? _z : answers.reuseComponents) !== null && _0 !== void 0 ? _0 : defaultOptions.reuseComponents,
277
+ deployerPrivateKey: (_2 = (_1 = args.deployerPrivateKey) !== null && _1 !== void 0 ? _1 : config.deployerPrivateKey) !== null && _2 !== void 0 ? _2 : answers.deployerPrivateKey,
278
+ deployClient: (_5 = (_4 = (_3 = args.deployClient) !== null && _3 !== void 0 ? _3 : config.deployClient) !== null && _4 !== void 0 ? _4 : answers.deployClient) !== null && _5 !== void 0 ? _5 : defaultOptions.deployClient,
279
+ clientUrl: (_8 = (_7 = (_6 = args.clientUrl) !== null && _6 !== void 0 ? _6 : config.clientUrl) !== null && _7 !== void 0 ? _7 : answers.clientUrl) !== null && _8 !== void 0 ? _8 : defaultOptions.clientUrl,
280
+ netlifySlug: (_10 = (_9 = args.netlifySlug) !== null && _9 !== void 0 ? _9 : config.netlifySlug) !== null && _10 !== void 0 ? _10 : answers.netlifySlug,
281
+ netlifyPersonalToken: (_12 = (_11 = args.netlifyPersonalToken) !== null && _11 !== void 0 ? _11 : config.netlifyPersonalToken) !== null && _12 !== void 0 ? _12 : answers.netlifyPersonalToken,
282
+ codespace: args.codespace,
283
+ dry: args.dry,
284
+ };
285
+ });
286
+ const deploy = (options) => __awaiter(void 0, void 0, void 0, function* () {
287
+ const { default: chalk } = yield importChalk;
288
+ const { execa } = yield importExeca;
289
+ console.log();
290
+ console.log(chalk.yellow(`>> Deploying contracts <<`));
291
+ console.log("Options");
292
+ console.log(options);
293
+ const wallet = new ethers_1.ethers.Wallet(options.deployerPrivateKey);
294
+ console.log(chalk.red(`>> Deployer address: ${chalk.bgYellow.black.bold(" " + wallet.address + " ")} <<`));
295
+ console.log();
296
+ const logger = new listr2_1.Logger({ useIcons: true });
297
+ const { NetlifyAPI: netlify } = yield importNetlify;
298
+ const netlifyAPI = options.deployClient && new netlify(options.netlifyPersonalToken);
299
+ const id = (0, uuid_1.v4)().substring(0, 6);
300
+ let launcherUrl;
301
+ let worldAddress;
302
+ const cmdArgs = options.upgradeSystems
303
+ ? [
304
+ "workspace",
305
+ "ri-contracts",
306
+ "forge:deploy",
307
+ ...(options.dry ? [] : ["--broadcast", "--private-keys", wallet.privateKey]),
308
+ "--sig",
309
+ "upgradeSystems(address,address)",
310
+ wallet.address,
311
+ options.world || ethers_1.constants.AddressZero,
312
+ "--fork-url",
313
+ options.rpc,
314
+ ]
315
+ : [
316
+ "workspace",
317
+ "ri-contracts",
318
+ "forge:deploy",
319
+ ...(options.dry ? [] : ["--broadcast", "--private-keys", wallet.privateKey]),
320
+ "--sig",
321
+ "deploy(address,address,bool)",
322
+ wallet.address,
323
+ options.world || ethers_1.constants.AddressZero,
324
+ options.reuseComponents ? "true" : "false",
325
+ "--fork-url",
326
+ options.rpc,
327
+ ];
328
+ try {
329
+ const tasks = new listr2_1.Listr([
330
+ {
331
+ title: "Deploying",
332
+ task: () => {
333
+ return new listr2_1.Listr([
334
+ {
335
+ title: "Contracts",
336
+ task: (ctx, task) => __awaiter(void 0, void 0, void 0, function* () {
337
+ var _a;
338
+ const child = execa("yarn", cmdArgs);
339
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.pipe(task.stdout());
340
+ const { stdout } = yield child;
341
+ const lines = stdout.split("\n");
342
+ ctx.worldAddress = worldAddress = findLog(lines, "world: address");
343
+ ctx.initialBlockNumber = findLog(lines, "initialBlockNumber: uint256");
344
+ task.output = chalk.yellow(`World deployed at: ${chalk.bgYellow.black(ctx.worldAddress)}`);
345
+ }),
346
+ options: { bottomBar: 3 },
347
+ },
348
+ {
349
+ title: "Client",
350
+ task: () => {
351
+ return new listr2_1.Listr([
352
+ {
353
+ title: "Building",
354
+ task: (_, task) => __awaiter(void 0, void 0, void 0, function* () {
355
+ const time = Date.now();
356
+ task.output = "Building local client...";
357
+ const child = execa("yarn", ["workspace", "ri-client", "build"]);
358
+ yield child;
359
+ const duration = Date.now() - time;
360
+ task.output = "Client built in " + Math.round(duration / 1000) + "s";
361
+ }),
362
+ skip: () => !options.deployClient,
363
+ options: { bottomBar: 3 },
364
+ },
365
+ {
366
+ title: "Creating",
367
+ task: (ctx, task) => __awaiter(void 0, void 0, void 0, function* () {
368
+ const site = yield netlifyAPI.createSite({
369
+ body: {
370
+ name: `mud-deployment-${wallet.address.substring(2, 8)}-${id}`,
371
+ account_slug: options.netlifySlug,
372
+ ssl: true,
373
+ force_ssl: true,
374
+ },
375
+ });
376
+ ctx.siteId = site.id;
377
+ ctx.clientUrl = site.ssl_url;
378
+ task.output = "Netlify site created with id: " + chalk.bgYellow.black(site.id);
379
+ }),
380
+ skip: () => !options.deployClient,
381
+ options: { bottomBar: 1 },
382
+ },
383
+ {
384
+ title: "Deploying",
385
+ task: (ctx, task) => __awaiter(void 0, void 0, void 0, function* () {
386
+ var _a;
387
+ const child = execa("yarn", ["workspace", "ri-client", "run", "netlify", "deploy", "--prod", "--dir", "dist"], {
388
+ env: {
389
+ NETLIFY_AUTH_TOKEN: options.netlifyPersonalToken,
390
+ NETLIFY_SITE_ID: ctx.siteId,
391
+ },
392
+ });
393
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.pipe(task.stdout());
394
+ yield child;
395
+ task.output = chalk.yellow("Netlify site deployed!");
396
+ }),
397
+ skip: () => !options.deployClient,
398
+ options: { bottomBar: 3 },
399
+ },
400
+ ], { concurrent: false });
401
+ },
402
+ },
403
+ {
404
+ title: "Open Launcher",
405
+ task: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
406
+ function getCodespaceUrl(port, protocol = "https") {
407
+ return `${protocol}://${process.env["CODESPACE_NAME"]}-${port}.app.online.visualstudio.com`;
408
+ }
409
+ let clientUrl = options.deployClient ? ctx.clientUrl : options.clientUrl;
410
+ if (options.codespace) {
411
+ clientUrl = getCodespaceUrl(3000);
412
+ options.rpc = getCodespaceUrl(8545);
413
+ }
414
+ launcherUrl = `${clientUrl}?chainId=${options.chainId}&worldAddress=${ctx.worldAddress}&rpc=${options.rpc}&wsRpc=${options.wsRpc}&checkpoint=&initialBlockNumber=${ctx.initialBlockNumber}&dev=true`;
415
+ // Launcher version:
416
+ // `https://play.lattice.xyz?worldAddress=${ctx.worldAddress || ""}&client=${
417
+ // clientUrl || ""
418
+ // }&rpc=${options.rpc || ""}&wsRpc=${options.wsRpc || ""}&chainId=${options.chainId || ""}&dev=${
419
+ // options.chainId === 31337 || ""
420
+ // }&initialBlockNumber=${ctx.initialBlockNumber}`;
421
+ if (!options.upgradeSystems)
422
+ openurl_1.default.open(launcherUrl);
423
+ }),
424
+ options: { bottomBar: 3 },
425
+ },
426
+ ], { concurrent: false });
427
+ },
428
+ },
429
+ ]);
430
+ yield tasks.run();
431
+ console.log(chalk.bgGreen.black.bold(" Congratulations! Deployment successful"));
432
+ console.log();
433
+ console.log(chalk.green(`World address ${worldAddress}`));
434
+ console.log(chalk.green(`Open launcher at ${launcherUrl}`));
435
+ console.log();
436
+ }
437
+ catch (e) {
438
+ logger.fail(e.message);
439
+ }
440
+ (0, process_1.exit)(0);
441
+ });
442
+ exports.deploy = deploy;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
16
+ const fs_1 = __importDefault(require("fs"));
17
+ const glob_1 = __importDefault(require("glob"));
18
+ const utils_1 = require("../utils");
19
+ exports.command = "diamond-abi";
20
+ exports.desc = "Merges the abis of different facets of a diamond to a single diamond abi";
21
+ const builder = (yargs) => yargs.options({
22
+ include: { type: "array" },
23
+ exclude: { type: "array" },
24
+ out: { type: "string" },
25
+ });
26
+ exports.builder = builder;
27
+ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
28
+ const { include: _include, exclude: _exclude, out: _out } = argv;
29
+ const wd = process.cwd();
30
+ console.log("Current working directory:", wd);
31
+ const include = _include || [`${wd}/abi/*Facet.json`];
32
+ const exclude = _exclude ||
33
+ ["DiamondCutFacet", "DiamondLoupeFacet", "OwnershipFacet"].map((file) => `./abi/${file}.json`);
34
+ const out = _out || `${wd}/abi/CombinedFacets.json`;
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ const abi = [];
37
+ for (const path of include) {
38
+ const [resolve, , promise] = (0, utils_1.deferred)();
39
+ (0, glob_1.default)(path, {}, (_, facets) => {
40
+ // Merge all abis matching the path glob
41
+ const pathAbi = facets
42
+ .filter((facet) => !exclude.includes(facet))
43
+ .map((facet) => require(facet))
44
+ .map((abis) => abis.abi)
45
+ .flat(1);
46
+ abi.push(...pathAbi);
47
+ resolve();
48
+ });
49
+ // Make the callback syncronous
50
+ yield promise;
51
+ }
52
+ fs_1.default.writeFileSync(out, JSON.stringify({ abi }));
53
+ console.log(`Created diamond abi at ${out}`);
54
+ process.exit(0);
55
+ });
56
+ exports.handler = handler;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
4
+ exports.command = "hello <name>";
5
+ exports.desc = "Greet <name> with Hello";
6
+ const builder = (yargs) => yargs
7
+ .options({
8
+ upper: { type: "boolean" },
9
+ })
10
+ .positional("name", { type: "string", demandOption: true });
11
+ exports.builder = builder;
12
+ const handler = (argv) => {
13
+ const { name } = argv;
14
+ const greeting = `Gm, ${name}!`;
15
+ console.log(greeting);
16
+ process.exit(0);
17
+ };
18
+ exports.handler = handler;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
13
+ const utils_1 = require("../utils");
14
+ exports.command = "sync-art <repo>";
15
+ exports.desc = "Syncs art from a MUD-compatible art repo, found in <repo>";
16
+ const builder = (yargs) => yargs.positional("repo", { type: "string", demandOption: true }).options({
17
+ commitHash: { type: "string" },
18
+ });
19
+ exports.builder = builder;
20
+ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const { repo, commitHash } = argv;
22
+ console.log("Syncing art repo from", repo);
23
+ const clean = yield (0, utils_1.exec)(`git diff --quiet --exit-code`);
24
+ if (clean !== 0) {
25
+ console.log("Directory is not clean! Please git add and commit");
26
+ process.exit(0);
27
+ }
28
+ console.log("Cloning...");
29
+ yield (0, utils_1.exec)(`git clone ${repo} _artmudtemp`);
30
+ if (commitHash) {
31
+ yield (0, utils_1.exec)(`cd _artmudtemp && git reset --hard ${commitHash} && cd -`);
32
+ }
33
+ console.log("Moving atlases...");
34
+ yield (0, utils_1.exec)(`cp -r _artmudtemp/atlases src/public`);
35
+ console.log("Moving tilesets...");
36
+ yield (0, utils_1.exec)(`cp -r _artmudtemp/tilesets src/layers/Renderer/assets`);
37
+ console.log("Moving tileset types...");
38
+ yield (0, utils_1.exec)(`cp -r _artmudtemp/types/ src/layers/Renderer/Phaser/tilesets/`);
39
+ console.log("Cleaning up...");
40
+ yield (0, utils_1.exec)(`rm -rf _artmudtemp`);
41
+ console.log("Committing...");
42
+ yield (0, utils_1.exec)(`git add src/public && git add src/layers/Renderer && git commit -m "feat(art): adding art from ${repo}"`);
43
+ process.exit(0);
44
+ });
45
+ exports.handler = handler;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
16
+ const fs_1 = __importDefault(require("fs"));
17
+ const glob_1 = __importDefault(require("glob"));
18
+ const utils_1 = require("../utils");
19
+ exports.command = "system-types";
20
+ exports.desc = "Generates system type file. Note: assumes ABIs of all systems in ./abi and typechain generated types in ./types/ethers-contracts";
21
+ const builder = (yargs) => yargs.options({
22
+ include: { type: "array" },
23
+ exclude: { type: "array" },
24
+ out: { type: "string" },
25
+ });
26
+ exports.builder = builder;
27
+ const handler = () => __awaiter(void 0, void 0, void 0, function* () {
28
+ const wd = process.cwd();
29
+ let abis = [];
30
+ let systems = [];
31
+ let ids = [];
32
+ let typePaths = [];
33
+ const systemsPath = `${wd}/src/systems/*.sol`;
34
+ const [resolve, , promise] = (0, utils_1.deferred)();
35
+ (0, glob_1.default)(systemsPath, {}, (_, matches) => {
36
+ systems = matches.map((path) => {
37
+ const fragments = path.split("/");
38
+ return fragments[fragments.length - 1].split(".sol")[0];
39
+ });
40
+ ids = matches.map((path, index) => {
41
+ const id = (0, utils_1.extractIdFromFile)(path);
42
+ if (!id) {
43
+ console.log("Path:", path);
44
+ console.log("ID:", id);
45
+ throw new Error("No ID found for" +
46
+ matches[index] +
47
+ ". Make sure your system source file includes a ID definition (uint256 constant ID = uint256(keccak256(<ID>));)");
48
+ }
49
+ return id;
50
+ });
51
+ abis = systems.map((system) => `../abi/${system}.json`);
52
+ typePaths = systems.map((system) => `./ethers-contracts/${system}.ts`);
53
+ resolve();
54
+ });
55
+ // Make the callback synchronous
56
+ yield promise;
57
+ console.log("Matches", systems);
58
+ console.log("Solidity", ids);
59
+ console.log("Type paths", typePaths);
60
+ console.log("ABIs", abis);
61
+ const SystemMappings = `// Autogenerated using mud system-types
62
+ export const systemToId = {
63
+ ${systems.map((system, index) => ` ${system}: "${ids[index]}",`).join("\n")}
64
+ };
65
+
66
+ export const idToSystem = {
67
+ ${ids.map((id, index) => ` "${id}": "${systems[index]}",`).join("\n")}
68
+ };
69
+ `;
70
+ const SystemTypes = `// Autogenerated using mud system-types
71
+ ${typePaths.map((path, index) => `import { ${systems[index]} } from "${path.replace(".ts", "")}";`).join("\n")}
72
+
73
+ export type SystemTypes = {
74
+ ${systems.map((system, index) => ` "${ids[index]}": ${system};`).join("\n")}
75
+ };
76
+ `;
77
+ const SystemAbis = `// Autogenerated using mud system-types
78
+ ${abis.map((path, index) => `import ${systems[index]} from "${path}";`).join("\n")}
79
+
80
+ export const SystemAbis = {
81
+ ${systems.map((system, index) => ` "${ids[index]}": ${system}.abi,`).join("\n")}
82
+ };
83
+ `;
84
+ console.log("Generating files:");
85
+ console.log("SystemTypes.ts", SystemTypes);
86
+ console.log("SystemAbis.mts", SystemAbis);
87
+ console.log("SystemMappings.ts", SystemMappings);
88
+ fs_1.default.writeFileSync("./types/SystemTypes.ts", SystemTypes);
89
+ fs_1.default.writeFileSync("./types/SystemAbis.mts", SystemAbis);
90
+ fs_1.default.writeFileSync("./types/SystemMappings.ts", SystemMappings);
91
+ });
92
+ exports.handler = handler;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.handler = exports.builder = exports.desc = exports.command = void 0;
13
+ const utils_1 = require("../utils");
14
+ const fs_1 = require("fs");
15
+ const ethers_1 = require("ethers");
16
+ const providers_1 = require("@ethersproject/providers");
17
+ const World_json_1 = require("@latticexyz/solecs/abi/World.json");
18
+ exports.command = "trace";
19
+ exports.desc = "Display the trace of a transaction";
20
+ const builder = (yargs) => yargs.options({
21
+ config: { type: "string", description: "path to mud deploy config (deploy.json)" },
22
+ world: { type: "string", required: true, description: "world contract address" },
23
+ tx: { type: "string", required: true, description: "tx hash to replay" },
24
+ rpc: { type: "string", description: "json rpc endpoint, defaults to http://localhost:8545" },
25
+ debug: { type: "boolean", description: "open debugger" },
26
+ });
27
+ exports.builder = builder;
28
+ const handler = (argv) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const { config, world, rpc, tx, debug } = argv;
30
+ const wd = process.cwd();
31
+ const deployData = config && JSON.parse((0, fs_1.readFileSync)(config, { encoding: "utf8" }));
32
+ const labels = [];
33
+ const provider = new providers_1.JsonRpcProvider(rpc || "http://localhost:8545");
34
+ const World = new ethers_1.Contract(world, World_json_1.abi, provider);
35
+ if (deployData) {
36
+ // Create component labels
37
+ const componentPromises = deployData.components.map((component) => __awaiter(void 0, void 0, void 0, function* () {
38
+ const path = `${wd}/src/components/${component}.sol`;
39
+ const id = (0, utils_1.extractIdFromFile)(path);
40
+ if (!id)
41
+ return;
42
+ const address = yield World.getComponent((0, utils_1.keccak256)(id));
43
+ return [component, address];
44
+ }));
45
+ // Create system labels
46
+ const systemPromises = deployData.systems.map((system) => __awaiter(void 0, void 0, void 0, function* () {
47
+ const path = `${wd}/src/systems/${system.name}.sol`;
48
+ const id = (0, utils_1.extractIdFromFile)(path);
49
+ if (!id)
50
+ return;
51
+ const address = yield World.getSystemAddress((0, utils_1.keccak256)(id));
52
+ return [system.name, address];
53
+ }));
54
+ const components = yield Promise.all(componentPromises);
55
+ const systems = yield Promise.all(systemPromises);
56
+ labels.push(...components, ...systems);
57
+ }
58
+ yield (0, utils_1.execLog)("cast", [
59
+ "run",
60
+ ...labels.map((label) => ["--label", `${label[1]}:${label[0]}`]).flat(),
61
+ ...(debug ? ["--debug"] : []),
62
+ `${tx}`,
63
+ ]);
64
+ process.exit(0);
65
+ });
66
+ exports.handler = handler;
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const yargs_1 = __importDefault(require("yargs"));
8
+ const helpers_1 = require("yargs/helpers");
9
+ (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
10
+ // Use the commands directory to scaffold.
11
+ .commandDir("commands")
12
+ // Enable strict mode.
13
+ .strict()
14
+ // Useful aliases.
15
+ .alias({ h: "help" }).argv;
package/dist/utils.js ADDED
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.keccak256 = exports.extractIdFromFile = exports.execLog = exports.exec = exports.deferred = exports.IDregex = void 0;
13
+ const child_process_1 = require("child_process");
14
+ const utils_1 = require("ethers/lib/utils");
15
+ const fs_1 = require("fs");
16
+ exports.IDregex = new RegExp(/(?<=uint256 constant ID = uint256\(keccak256\(")(.*)(?="\))/);
17
+ /**
18
+ * A convenient way to create a promise with resolve and reject functions.
19
+ * @returns Tuple with resolve function, reject function and promise.
20
+ */
21
+ function deferred() {
22
+ let resolve = null;
23
+ let reject = null;
24
+ const promise = new Promise((r, rj) => {
25
+ resolve = (t) => r(t);
26
+ reject = (e) => rj(e);
27
+ });
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ return [resolve, reject, promise];
30
+ }
31
+ exports.deferred = deferred;
32
+ /**
33
+ * Await execution of bash scripts
34
+ * @param command Bash script to execute
35
+ * @returns Promise that resolves with exit code when script finished executing
36
+ */
37
+ function exec(command) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const [resolve, , promise] = deferred();
40
+ const child = (0, child_process_1.exec)(command, (error, stdout, stderr) => {
41
+ if (error || stderr) {
42
+ console.error(error);
43
+ console.error(stderr);
44
+ }
45
+ console.log(stdout);
46
+ });
47
+ child.on("exit", (code) => resolve(code !== null && code !== void 0 ? code : 0));
48
+ return promise;
49
+ });
50
+ }
51
+ exports.exec = exec;
52
+ /**
53
+ * Await execution of bash scripts
54
+ * @param command Bash script to execute
55
+ * @param options Args to pass to the script
56
+ * @returns Promise that resolves with exit code when script finished executing
57
+ */
58
+ function execLog(command, options) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ console.log("Cmd:");
61
+ console.log([command, ...options].join(" "));
62
+ const [resolve, , promise] = deferred();
63
+ const child = (0, child_process_1.spawn)(command, options, { stdio: [process.stdin, process.stdout, process.stderr] });
64
+ child.on("exit", (code) => resolve(code !== null && code !== void 0 ? code : 0));
65
+ return promise;
66
+ });
67
+ }
68
+ exports.execLog = execLog;
69
+ function extractIdFromFile(path) {
70
+ const content = (0, fs_1.readFileSync)(path).toString();
71
+ const regexResult = exports.IDregex.exec(content);
72
+ return regexResult && regexResult[0];
73
+ }
74
+ exports.extractIdFromFile = extractIdFromFile;
75
+ function keccak256(data) {
76
+ return (0, utils_1.keccak256)((0, utils_1.toUtf8Bytes)(data));
77
+ }
78
+ exports.keccak256 = keccak256;
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@latticexyz/cli",
3
+ "version": "0.9.0",
4
+ "description": "Command line interface for mud",
5
+ "main": "dist/index.js",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "mud": "./dist/index.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/latticexyz/mud.git",
13
+ "directory": "packages/cli"
14
+ },
15
+ "scripts": {
16
+ "prepare": "yarn build",
17
+ "prepack": "mv package.json package.json.bak && jq \".main = \\\"dist/index.js\\\"\" package.json.bak > package.json ",
18
+ "postpack": "mv package.json.bak package.json",
19
+ "globalinstall": "yarn build && yarn prepare && npm link",
20
+ "build": "rimraf dist && tsc -p . && chmod u+x dist/index.js",
21
+ "link": "yarn link",
22
+ "test": "echo 'todo: add tests'"
23
+ },
24
+ "devDependencies": {
25
+ "@types/clear": "^0.1.2",
26
+ "@types/figlet": "^1.5.4",
27
+ "@types/glob": "^7.2.0",
28
+ "@types/inquirer": "^8.2.1",
29
+ "@types/node": "^17.0.34",
30
+ "@types/openurl": "^1.0.0",
31
+ "@types/yargs": "^17.0.10",
32
+ "nodemon": "^2.0.16",
33
+ "pkg": "^5.7.0",
34
+ "rimraf": "^3.0.2",
35
+ "ts-node": "^10.7.0",
36
+ "typescript": "^4.6.4"
37
+ },
38
+ "dependencies": {
39
+ "@latticexyz/solecs": "^0.9.0",
40
+ "@latticexyz/utils": "^0.9.0",
41
+ "chalk": "^5.0.1",
42
+ "clear": "^0.1.0",
43
+ "commander": "^9.2.0",
44
+ "esm": "^3.2.25",
45
+ "ethers": "^5.6.7",
46
+ "execa": "^6.1.0",
47
+ "figlet": "^1.5.2",
48
+ "glob": "^8.0.3",
49
+ "inquirer": "^8.2.4",
50
+ "inquirer-prompt-suggest": "^0.1.0",
51
+ "listr2": "^4.0.5",
52
+ "netlify": "^11.0.1",
53
+ "node-fetch": "^3.2.6",
54
+ "openurl": "^1.1.1",
55
+ "path": "^0.12.7",
56
+ "typechain": "^8.1.0",
57
+ "uuid": "^8.3.2",
58
+ "yargs": "^17.5.1"
59
+ },
60
+ "pkg": {
61
+ "scripts": "build/**/*.js"
62
+ },
63
+ "gitHead": "40718ea9955e61196942d040189adec464500446"
64
+ }