@latticexyz/cli 2.2.16-54e5c06dd4606d2484a790cd1d531931d634d7a1 → 2.2.16

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.
@@ -17,7 +17,7 @@ Resolved config:
17
17
  Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
18
18
  in your contracts directory to use the default anvil private key.`);return Zn(b)}})(),f=qn({transport:Yn(i,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0}),account:l}),h=await rs(f),S=e.indexerUrl??be.find(b=>b.id===h)?.indexerUrl,A=e.worldAddress?as({worldAddress:e.worldAddress,worldsFile:n.deploy.worldsFile,chainId:h}):void 0;console.log("Deploying from",f.account.address);let k=await Vo(f),x=Date.now(),w=await Ho({config:n,deployerAddress:e.deployerAddress,salt:o,worldAddress:e.worldAddress,worldDeployBlock:A,client:f,tables:u,systems:c,libraries:d,modules:y,artifacts:p,indexerUrl:S,chainId:h});(e.worldAddress==null||e.alwaysRunPostDeploy)&&await Eo(n.deploy.postDeployScript,w.address,i,t,e.forgeScriptOptions,!!e.kms),await k?.reset(),console.log(V.green("Deployment completed in",(Date.now()-x)/1e3,"seconds"));let m={worldAddress:w.address,blockNumber:Number(w.deployBlock)};if(e.saveDeployment){let b=he.join(n.deploy.deploysDirectory,h.toString());Jn(b,{recursive:!0}),Pe(he.join(b,"latest.json"),JSON.stringify(m,null,2)),Pe(he.join(b,Date.now()+".json"),JSON.stringify(m,null,2));let T=[1337,31337],j=Jo(n.deploy.worldsFile)?JSON.parse(qo(n.deploy.worldsFile,"utf-8")):{};j[h]={address:m.worldAddress,blockNumber:T.includes(h)?void 0:m.blockNumber},Pe(n.deploy.worldsFile,JSON.stringify(j,null,2)),console.log(V.bgGreen(V.whiteBright(`
19
19
  Deployment result (written to ${n.deploy.worldsFile} and ${b}):
20
- `)))}return console.log(m),w}function as({chainId:e,worldAddress:o,worldsFile:t}){let r=Jo(t)?JSON.parse(qo(t,"utf-8")):{},n=r[e]?.address===o?r[e].blockNumber:void 0;return n?BigInt(n):void 0}var is={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(M)},async handler(e){try{await K(e)}catch(o){te(o),process.exit(1)}process.exit(0)}},Yo=is;import ds from"node:path";import{loadConfig as ls,resolveConfigPath as cs}from"@latticexyz/config/node";import{worldgen as ms}from"@latticexyz/world/node";var ps={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 fs(e),process.exit(0)}};async function fs(e){let o=await cs(e.configPath),t=await ls(o),r=ds.dirname(o);await ms({rootDir:r,config:t,clean:e.clean})}var Go=ps;import Z from"chalk";import{readFileSync as hs,writeFileSync as ws}from"fs";import Me from"path";import{MUDError as J}from"@latticexyz/common/errors";var Qo={name:"@latticexyz/cli",version:"2.2.15",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":"0.2.2","@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/store-sync":"workspace:*","@latticexyz/utils":"workspace:*","@latticexyz/world":"workspace:*","@latticexyz/world-module-metadata":"workspace:*",abitype:"1.0.6","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",viem:"2.21.19",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/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",vitest:"0.34.6"}};import{globSync as xs}from"glob";import{ZodError as us,z as Zo}from"zod";var gs=Zo.object({MUD_PACKAGES:Zo.string().transform(e=>JSON.parse(e))});function bs(){try{return gs.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/entrykit":{"localPath":"packages/entrykit"},"@latticexyz/explorer":{"localPath":"packages/explorer"},"@latticexyz/faucet":{"localPath":"packages/faucet"},"@latticexyz/gas-report":{"localPath":"packages/gas-report"},"@latticexyz/paymaster":{"localPath":"packages/paymaster"},"@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-consumer":{"localPath":"packages/store-consumer"},"@latticexyz/store-indexer":{"localPath":"packages/store-indexer"},"@latticexyz/store-sync":{"localPath":"packages/store-sync"},"@latticexyz/store":{"localPath":"packages/store"},"@latticexyz/utils":{"localPath":"packages/utils"},"vite-plugin-mud":{"localPath":"packages/vite-plugin-mud"},"@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 us){let{...o}=e.format();console.error(`
20
+ `)))}return console.log(m),w}function as({chainId:e,worldAddress:o,worldsFile:t}){let r=Jo(t)?JSON.parse(qo(t,"utf-8")):{},n=r[e]?.address===o?r[e].blockNumber:void 0;return n?BigInt(n):void 0}var is={command:"deploy",describe:"Deploy MUD contracts",builder(e){return e.options(M)},async handler(e){try{await K(e)}catch(o){te(o),process.exit(1)}process.exit(0)}},Yo=is;import ds from"node:path";import{loadConfig as ls,resolveConfigPath as cs}from"@latticexyz/config/node";import{worldgen as ms}from"@latticexyz/world/node";var ps={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 fs(e),process.exit(0)}};async function fs(e){let o=await cs(e.configPath),t=await ls(o),r=ds.dirname(o);await ms({rootDir:r,config:t,clean:e.clean})}var Go=ps;import Z from"chalk";import{readFileSync as hs,writeFileSync as ws}from"fs";import Me from"path";import{MUDError as J}from"@latticexyz/common/errors";var Qo={name:"@latticexyz/cli",version:"2.2.16",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":"0.2.2","@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/store-sync":"workspace:*","@latticexyz/utils":"workspace:*","@latticexyz/world":"workspace:*","@latticexyz/world-module-metadata":"workspace:*",abitype:"1.0.6","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",viem:"2.21.19",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/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",vitest:"0.34.6"}};import{globSync as xs}from"glob";import{ZodError as us,z as Zo}from"zod";var gs=Zo.object({MUD_PACKAGES:Zo.string().transform(e=>JSON.parse(e))});function bs(){try{return gs.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/entrykit":{"localPath":"packages/entrykit"},"@latticexyz/explorer":{"localPath":"packages/explorer"},"@latticexyz/faucet":{"localPath":"packages/faucet"},"@latticexyz/gas-report":{"localPath":"packages/gas-report"},"@latticexyz/paymaster":{"localPath":"packages/paymaster"},"@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-consumer":{"localPath":"packages/store-consumer"},"@latticexyz/store-indexer":{"localPath":"packages/store-indexer"},"@latticexyz/store-sync":{"localPath":"packages/store-sync"},"@latticexyz/store":{"localPath":"packages/store"},"@latticexyz/utils":{"localPath":"packages/utils"},"vite-plugin-mud":{"localPath":"packages/vite-plugin-mud"},"@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 us){let{...o}=e.format();console.error(`
21
21
  Missing or invalid environment variables:
22
22
 
23
23
  ${Object.keys(o).join(`
@@ -40,4 +40,4 @@ Waiting for file changes\u2026
40
40
  `),{overwrite:s});let A=F.join(S.sourceDirectory,"remote");s&&await xe.rm(A,{recursive:!0,force:!0});for(let x of f.filter(w=>w.abi.length)){let w=`I${x.label}`,m=F.join(A,"namespaces",x.namespaceLabel,`${w}.sol`);H("writing system interface",w,"to",m);let b=mt({name:w,systemId:x.systemId,abi:x.abi});await je(F.join(e,m),await pt(b),{overwrite:s})}let k=f.flatMap(x=>x.worldAbi);if(k.length){let x="IWorldSystems",w=F.join(A,`${x}.sol`);H("writing world systems interface to",w);let m=mt({name:x,abi:k});await je(F.join(e,w),await pt(m),{overwrite:s})}return{config:S}}async function za(e){return xe.access(e).then(()=>!0,()=>!1)}async function je(e,o,t={}){if(!t.overwrite&&await za(e))throw new X(e);await xe.mkdir(F.dirname(e),{recursive:!0}),await xe.writeFile(e,o)}import Va from"node:path";import{getChainId as Ka}from"viem/actions";var Ja={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."},indexerUrl:{type:"string",desc:"The indexer URL to pull from.",required:!1}},qa={command:"pull",describe:"Pull mud.config.ts and interfaces from an existing world.",builder(e){return e.options(Ja)},async handler(e){let o=e.profile??process.env.FOUNDRY_PROFILE,t=e.rpc??await Na(o),r=Ua({transport:_a(t,{batch:e.rpcBatch?{batchSize:100,wait:1e3}:void 0})}),n=await Ka(r),a=e.indexerUrl??be.find(i=>i.id===n)?.indexerUrl;console.log(ve.bgBlue(ve.whiteBright(`
41
41
  Pulling MUD config from world at ${e.worldAddress}
42
42
  `)));let s=process.cwd();try{let{config:i}=await ut({rootDir:s,client:r,worldAddress:e.worldAddress,indexerUrl:a,chainId:n,replace:e.replace});await L({rootDir:s,config:i,foundryProfile:o})}catch(i){if(i instanceof X){console.log(),console.log(ve.bgRed(ve.whiteBright(" Error "))),console.log(` Attempted to write file at "${Va.relative(s,i.filename)}", but it already exists.`),console.log(),console.log(" To overwrite files, use `--replace` when running this command."),console.log();return}throw i}}},gt=qa;var Zy=[Re,Yo,$e,Ya,Fe,Le,Go,et,ot,nt,st,Ga,lt,gt];export{Zy as commands};
43
- //# sourceMappingURL=commands-RZL4UL2O.js.map
43
+ //# sourceMappingURL=commands-FEAQJW6Q.js.map