@latticexyz/cli 2.2.14-main-b015553b268abbd25858e100bc545d2fb3273808 → 2.2.14

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.
@@ -24,7 +24,7 @@ Resolved config:
24
24
  Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
25
25
  in your contracts directory to use the default anvil private key.`);return vs(l)}})(),u=xs({transport:Cs(i,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0}),account:C});console.log("Deploying from",u.account.address);let x=await Yo(u),A=Date.now(),b=await jo({config:n,deployerAddress:e.deployerAddress,salt:o,worldAddress:e.worldAddress,client:u,tables:g,systems:c,libraries:d,modules:p,artifacts:y});(e.worldAddress==null||e.alwaysRunPostDeploy)&&await Vo(n.deploy.postDeployScript,b.address,i,t,e.forgeScriptOptions,!!e.kms),await x?.reset(),console.log(J.green("Deployment completed in",(Date.now()-A)/1e3,"seconds"));let w={worldAddress:b.address,blockNumber:Number(b.deployBlock)};if(e.saveDeployment){let l=await Ps(u),f=we.join(n.deploy.deploysDirectory,l.toString());hs(f,{recursive:!0}),We(we.join(f,"latest.json"),JSON.stringify(w,null,2)),We(we.join(f,Date.now()+".json"),JSON.stringify(w,null,2));let T=[1337,31337],h=bs(n.deploy.worldsFile)?JSON.parse(ws(n.deploy.worldsFile,"utf-8")):{};h[l]={address:w.worldAddress,blockNumber:T.includes(l)?void 0:w.blockNumber},We(n.deploy.worldsFile,JSON.stringify(h,null,2)),console.log(J.bgGreen(J.whiteBright(`
26
26
  Deployment result (written to ${n.deploy.worldsFile} and ${f}):
27
- `)))}return console.log(w),b}var Os={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(I)},async handler(e){try{await q(e)}catch(o){ne(o),process.exit(1)}process.exit(0)}},Go=Os;import Is from"node:path";import{loadConfig as Ws,resolveConfigPath as Rs}from"@latticexyz/config/node";import{worldgen as Hs}from"@latticexyz/world/node";var js={command:"worldgen",describe:"Autogenerate interfaces for Systems and World based on existing contracts and the config file",builder(e){return e.options({configPath:{type:"string",desc:"Path to the MUD config file"},clean:{type:"boolean",desc:"Clear the worldgen directory before generating new interfaces (defaults to true)",default:!0}})},async handler(e){await $s(e),process.exit(0)}};async function $s(e){let o=await Rs(e.configPath),t=await Ws(o),r=Is.dirname(o);await Hs({rootDir:r,config:t,clean:e.clean})}var Qo=js;import te from"chalk";import{readFileSync as Ns,writeFileSync as Us}from"fs";import je from"path";import{MUDError as Y}from"@latticexyz/common/errors";var Zo={name:"@latticexyz/cli",version:"2.2.13",description:"Command line interface for mud",repository:{type:"git",url:"https://github.com/latticexyz/mud.git",directory:"packages/cli"},license:"MIT",type:"module",exports:{".":"./dist/index.js"},typesVersions:{"*":{index:["./dist/index.d.ts"]}},bin:{mud:"./bin/mud.js"},files:["bin","dist"],scripts:{build:"pnpm run build:js && pnpm run build:test-tables","build:js":"tsup && chmod +x ./dist/mud.js","build:test-tables":"tsx ./scripts/generate-test-tables.ts",clean:"pnpm run clean:js && pnpm run clean:test-tables","clean:js":"shx rm -rf dist","clean:test-tables":"shx rm -rf src/**/codegen",dev:"tsup --watch",lint:"eslint . --ext .ts",test:"tsc --noEmit && forge test","test:ci":"pnpm run test"},dependencies:{"@ark/util":"catalog:","@aws-sdk/client-kms":"^3.556.0","@latticexyz/abi-ts":"workspace:*","@latticexyz/block-logs-stream":"workspace:*","@latticexyz/common":"workspace:*","@latticexyz/config":"workspace:*","@latticexyz/gas-report":"workspace:*","@latticexyz/protocol-parser":"workspace:*","@latticexyz/schema-type":"workspace:*","@latticexyz/store":"workspace:*","@latticexyz/utils":"workspace:*","@latticexyz/world":"workspace:*","@latticexyz/world-module-metadata":"workspace:*",abitype:"catalog:","asn1.js":"^5.4.1",chalk:"^5.0.1",chokidar:"^3.5.3",debug:"^4.3.4",dotenv:"^16.0.3",execa:"^7.0.0","find-up":"^6.3.0",glob:"^10.4.2",openurl:"^1.1.1","p-queue":"^7.4.1","p-retry":"^5.1.2",path:"^0.12.7",rxjs:"7.5.5","throttle-debounce":"^5.0.0",toposort:"^2.0.2",typescript:"5.4.2",viem:"catalog:",yargs:"^17.7.1",zod:"3.23.8","zod-validation-error":"^1.3.0"},devDependencies:{"@types/debug":"^4.1.7","@types/ejs":"^3.1.1","@types/node":"^18.15.11","@types/openurl":"^1.0.0","@types/throttle-debounce":"^5.0.0","@types/toposort":"^2.0.6","@types/yargs":"^17.0.10","ds-test":"https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0","forge-std":"https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",tsup:"^6.7.0",vitest:"0.34.6"}};import{globSync as Vs}from"glob";import{ZodError as Ls,z as Xo}from"zod";var Fs=Xo.object({MUD_PACKAGES:Xo.string().transform(e=>JSON.parse(e))});function zs(){try{return Fs.parse({MUD_PACKAGES:'{"@latticexyz/abi-ts":{"localPath":"packages/abi-ts"},"@latticexyz/block-logs-stream":{"localPath":"packages/block-logs-stream"},"@latticexyz/cli":{"localPath":"packages/cli"},"@latticexyz/common":{"localPath":"packages/common"},"@latticexyz/config":{"localPath":"packages/config"},"create-mud":{"localPath":"packages/create-mud"},"@latticexyz/dev-tools":{"localPath":"packages/dev-tools"},"@latticexyz/explorer":{"localPath":"packages/explorer"},"@latticexyz/faucet":{"localPath":"packages/faucet"},"@latticexyz/gas-report":{"localPath":"packages/gas-report"},"@latticexyz/protocol-parser":{"localPath":"packages/protocol-parser"},"@latticexyz/react":{"localPath":"packages/react"},"@latticexyz/recs":{"localPath":"packages/recs"},"@latticexyz/schema-type":{"localPath":"packages/schema-type"},"solhint-config-mud":{"localPath":"packages/solhint-config-mud"},"solhint-plugin-mud":{"localPath":"packages/solhint-plugin-mud"},"@latticexyz/stash":{"localPath":"packages/stash"},"@latticexyz/store-indexer":{"localPath":"packages/store-indexer"},"@latticexyz/store-sync":{"localPath":"packages/store-sync"},"@latticexyz/store":{"localPath":"packages/store"},"@latticexyz/utils":{"localPath":"packages/utils"},"@latticexyz/world-module-erc20":{"localPath":"packages/world-module-erc20"},"@latticexyz/world-module-metadata":{"localPath":"packages/world-module-metadata"},"@latticexyz/world-modules":{"localPath":"packages/world-modules"},"@latticexyz/world":{"localPath":"packages/world"}}'})}catch(e){if(e instanceof Ls){let{...o}=e.format();console.error(`
27
+ `)))}return console.log(w),b}var Os={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(I)},async handler(e){try{await q(e)}catch(o){ne(o),process.exit(1)}process.exit(0)}},Go=Os;import Is from"node:path";import{loadConfig as Ws,resolveConfigPath as Rs}from"@latticexyz/config/node";import{worldgen as Hs}from"@latticexyz/world/node";var js={command:"worldgen",describe:"Autogenerate interfaces for Systems and World based on existing contracts and the config file",builder(e){return e.options({configPath:{type:"string",desc:"Path to the MUD config file"},clean:{type:"boolean",desc:"Clear the worldgen directory before generating new interfaces (defaults to true)",default:!0}})},async handler(e){await $s(e),process.exit(0)}};async function $s(e){let o=await Rs(e.configPath),t=await Ws(o),r=Is.dirname(o);await Hs({rootDir:r,config:t,clean:e.clean})}var Qo=js;import te from"chalk";import{readFileSync as Ns,writeFileSync as Us}from"fs";import je from"path";import{MUDError as Y}from"@latticexyz/common/errors";var Zo={name:"@latticexyz/cli",version:"2.2.14",description:"Command line interface for mud",repository:{type:"git",url:"https://github.com/latticexyz/mud.git",directory:"packages/cli"},license:"MIT",type:"module",exports:{".":"./dist/index.js"},typesVersions:{"*":{index:["./dist/index.d.ts"]}},bin:{mud:"./bin/mud.js"},files:["bin","dist"],scripts:{build:"pnpm run build:js && pnpm run build:test-tables","build:js":"tsup && chmod +x ./dist/mud.js","build:test-tables":"tsx ./scripts/generate-test-tables.ts",clean:"pnpm run clean:js && pnpm run clean:test-tables","clean:js":"shx rm -rf dist","clean:test-tables":"shx rm -rf src/**/codegen",dev:"tsup --watch",lint:"eslint . --ext .ts",test:"tsc --noEmit && forge test","test:ci":"pnpm run test"},dependencies:{"@ark/util":"catalog:","@aws-sdk/client-kms":"^3.556.0","@latticexyz/abi-ts":"workspace:*","@latticexyz/block-logs-stream":"workspace:*","@latticexyz/common":"workspace:*","@latticexyz/config":"workspace:*","@latticexyz/gas-report":"workspace:*","@latticexyz/protocol-parser":"workspace:*","@latticexyz/schema-type":"workspace:*","@latticexyz/store":"workspace:*","@latticexyz/utils":"workspace:*","@latticexyz/world":"workspace:*","@latticexyz/world-module-metadata":"workspace:*",abitype:"catalog:","asn1.js":"^5.4.1",chalk:"^5.0.1",chokidar:"^3.5.3",debug:"^4.3.4",dotenv:"^16.0.3",execa:"^7.0.0","find-up":"^6.3.0",glob:"^10.4.2",openurl:"^1.1.1","p-queue":"^7.4.1","p-retry":"^5.1.2",path:"^0.12.7",rxjs:"7.5.5","throttle-debounce":"^5.0.0",toposort:"^2.0.2",typescript:"5.4.2",viem:"catalog:",yargs:"^17.7.1",zod:"3.23.8","zod-validation-error":"^1.3.0"},devDependencies:{"@types/debug":"^4.1.7","@types/ejs":"^3.1.1","@types/node":"^18.15.11","@types/openurl":"^1.0.0","@types/throttle-debounce":"^5.0.0","@types/toposort":"^2.0.6","@types/yargs":"^17.0.10","ds-test":"https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0","forge-std":"https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",tsup:"^6.7.0",vitest:"0.34.6"}};import{globSync as Vs}from"glob";import{ZodError as Ls,z as Xo}from"zod";var Fs=Xo.object({MUD_PACKAGES:Xo.string().transform(e=>JSON.parse(e))});function zs(){try{return Fs.parse({MUD_PACKAGES:'{"@latticexyz/abi-ts":{"localPath":"packages/abi-ts"},"@latticexyz/block-logs-stream":{"localPath":"packages/block-logs-stream"},"@latticexyz/cli":{"localPath":"packages/cli"},"@latticexyz/common":{"localPath":"packages/common"},"@latticexyz/config":{"localPath":"packages/config"},"create-mud":{"localPath":"packages/create-mud"},"@latticexyz/dev-tools":{"localPath":"packages/dev-tools"},"@latticexyz/explorer":{"localPath":"packages/explorer"},"@latticexyz/faucet":{"localPath":"packages/faucet"},"@latticexyz/gas-report":{"localPath":"packages/gas-report"},"@latticexyz/protocol-parser":{"localPath":"packages/protocol-parser"},"@latticexyz/react":{"localPath":"packages/react"},"@latticexyz/recs":{"localPath":"packages/recs"},"@latticexyz/schema-type":{"localPath":"packages/schema-type"},"solhint-config-mud":{"localPath":"packages/solhint-config-mud"},"solhint-plugin-mud":{"localPath":"packages/solhint-plugin-mud"},"@latticexyz/stash":{"localPath":"packages/stash"},"@latticexyz/store-indexer":{"localPath":"packages/store-indexer"},"@latticexyz/store-sync":{"localPath":"packages/store-sync"},"@latticexyz/store":{"localPath":"packages/store"},"@latticexyz/utils":{"localPath":"packages/utils"},"@latticexyz/world-module-erc20":{"localPath":"packages/world-module-erc20"},"@latticexyz/world-module-metadata":{"localPath":"packages/world-module-metadata"},"@latticexyz/world-modules":{"localPath":"packages/world-modules"},"@latticexyz/world":{"localPath":"packages/world"}}'})}catch(e){if(e instanceof Ls){let{...o}=e.format();console.error(`
28
28
  Missing or invalid environment variables:
29
29
 
30
30
  ${Object.keys(o).join(`
@@ -47,4 +47,4 @@ Waiting for file changes\u2026
47
47
  `),{overwrite:n});let x=L.join(u.sourceDirectory,"remote");n&&await xe.rm(x,{recursive:!0,force:!0});for(let b of g.filter(w=>w.abi.length)){let w=`I${b.label}`,l=L.join(x,"namespaces",b.namespaceLabel,`${w}.sol`);R("writing system interface",w,"to",l);let f=pt({name:w,systemId:b.systemId,abi:b.abi});await ze(L.join(e,l),await ft(f),{overwrite:n})}let A=g.flatMap(b=>b.worldAbi);if(A.length){let b="IWorldSystems",w=L.join(x,`${b}.sol`);R("writing world systems interface to",w);let l=pt({name:b,abi:A});await ze(L.join(e,w),await ft(l),{overwrite:n})}return{config:u}}async function ni(e){return xe.access(e).then(()=>!0,()=>!1)}async function ze(e,o,t={}){if(!t.overwrite&&await ni(e))throw new re(e);await xe.mkdir(L.dirname(e),{recursive:!0}),await xe.writeFile(e,o)}import di from"node:path";var li={worldAddress:{type:"string",required:!0,desc:"Remote world address"},profile:{type:"string",desc:"The foundry profile to use"},rpc:{type:"string",desc:"The RPC URL to use. Defaults to the RPC url from the local foundry.toml"},rpcBatch:{type:"boolean",desc:"Enable batch processing of RPC requests in viem client (defaults to batch size of 100 and wait of 1s)"},replace:{type:"boolean",desc:"Replace existing files and directories with data from remote world."}},ci={command:"pull",describe:"Pull mud.config.ts and interfaces from an existing world.",builder(e){return e.options(li)},async handler(e){let o=e.profile??process.env.FOUNDRY_PROFILE,t=e.rpc??await si(o),r=ai({transport:ii(t,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0})});console.log(Ce.bgBlue(Ce.whiteBright(`
48
48
  Pulling MUD config from world at ${e.worldAddress}
49
49
  `)));let n=process.cwd();try{let{config:s}=await gt({rootDir:n,client:r,worldAddress:e.worldAddress,replace:e.replace});await F({rootDir:n,config:s,foundryProfile:o})}catch(s){if(s instanceof re){console.log(),console.log(Ce.bgRed(Ce.whiteBright(" Error "))),console.log(` Attempted to write file at "${di.relative(n,s.filename)}", but it already exists.`),console.log(),console.log(" To overwrite files, use `--replace` when running this command."),console.log();return}throw s}}},bt=ci;var xg=[Ne,Go,Ue,mi,Ve,_e,Qo,ot,tt,st,at,pi,ct,bt];export{xg as commands};
50
- //# sourceMappingURL=commands-Y5YQYNF3.js.map
50
+ //# sourceMappingURL=commands-B5O3X52W.js.map