create-mud 2.2.17-f88e48e47ceb4a29a3862a3f3b85891490952f0e → 2.2.17
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/README.md +2 -4
- package/bin/cli.js +4 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +9 -2
- package/dist/cli.js.map +1 -1
- package/package.json +17 -11
- package/templates/phaser/packages/contracts/worlds.json +5 -0
- package/templates/react/.gitignore_ +16 -0
- package/templates/react/mprocs.yaml +21 -0
- package/templates/react/package.json +31 -0
- package/templates/react/packages/client/.gitignore_ +1 -0
- package/{dist/templates/threejs → templates/react}/packages/client/index.html +2 -2
- package/templates/react/packages/client/postcss.config.cjs +6 -0
- package/templates/react/packages/client/src/game/useKeyboardMovement.ts +26 -0
- package/templates/react/packages/client/src/index.tsx +19 -0
- package/templates/react/packages/client/src/mud/Explorer.tsx +32 -0
- package/{dist/templates → templates}/react/packages/client/src/mud/Synced.tsx +1 -1
- package/templates/react/packages/client/src/mud/useWorldContract.ts +44 -0
- package/templates/react/packages/client/src/ui/AsyncButton.tsx +41 -0
- package/templates/react/packages/client/src/ui/ErrorFallback.tsx +58 -0
- package/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
- package/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
- package/templates/react/packages/client/src/wagmiConfig.ts +49 -0
- package/templates/react/packages/client/tailwind.config.ts +10 -0
- package/templates/react/packages/client/tsconfig.json +11 -0
- package/{dist/templates/threejs → templates/react}/packages/client/vite.config.ts +2 -7
- package/templates/react/packages/contracts/.env +11 -0
- package/templates/react/packages/contracts/.gitignore_ +13 -0
- package/{dist/templates → templates}/react/packages/contracts/mud.config.ts +0 -7
- package/{dist/templates/vanilla → templates/react}/packages/contracts/package.json +1 -0
- package/{dist/templates/vanilla → templates/react}/packages/contracts/script/PostDeploy.s.sol +1 -5
- package/{dist/templates/vanilla/packages/contracts/src/codegen/index.sol → templates/react/packages/contracts/src/codegen/common.sol} +6 -1
- package/{dist/templates → templates}/react/packages/contracts/test/MoveTest.t.sol +0 -2
- package/templates/react/packages/contracts/test/WorldTest.t.sol +16 -0
- package/templates/react/packages/contracts/worlds.json +5 -0
- package/{dist/templates/react → templates/react-ecs}/mprocs.yaml +1 -1
- package/{dist/templates → templates}/react-ecs/packages/client/package.json +16 -9
- package/templates/react-ecs/packages/client/src/App.tsx +74 -0
- package/templates/react-ecs/packages/client/src/Providers.tsx +29 -0
- package/templates/react-ecs/packages/client/src/common.ts +27 -0
- package/templates/react-ecs/packages/client/src/game/GameMap.tsx +112 -0
- package/templates/react-ecs/packages/client/src/mud/Synced.tsx +14 -0
- package/templates/react-ecs/packages/client/src/mud/recs.ts +6 -0
- package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +17 -0
- package/{dist/templates/threejs → templates/react-ecs}/packages/contracts/.env +1 -1
- package/templates/react-ecs/packages/contracts/mud.config.ts +18 -0
- package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +2039 -0
- package/templates/react-ecs/packages/contracts/src/Entity.sol +20 -0
- package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +30 -0
- package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +18 -0
- package/templates/react-ecs/packages/contracts/src/codegen/index.sol +8 -0
- package/{dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol → templates/react-ecs/packages/contracts/src/codegen/tables/EntityCount.sol} +35 -35
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +202 -0
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +321 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +16 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/ISpawnSystem.sol +15 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +17 -0
- package/templates/react-ecs/packages/contracts/src/createEntity.sol +11 -0
- package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +39 -0
- package/{dist/templates/react → templates/react-ecs}/packages/contracts/test/WorldTest.t.sol +0 -5
- package/templates/react-ecs/packages/contracts/worlds.json +5 -0
- package/templates/threejs/packages/contracts/worlds.json +5 -0
- package/templates/vanilla/packages/contracts/worlds.json +5 -0
- package/dist/templates/phaser/packages/contracts/worlds.json +0 -5
- package/dist/templates/react/packages/contracts/worlds.json +0 -5
- package/dist/templates/react-ecs/package.json +0 -32
- package/dist/templates/react-ecs/packages/client/src/App.tsx +0 -29
- package/dist/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +0 -51
- package/dist/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +0 -77
- package/dist/templates/react-ecs/packages/contracts/worlds.json +0 -5
- package/dist/templates/threejs/packages/client/src/MUDContext.tsx +0 -21
- package/dist/templates/threejs/packages/client/src/index.tsx +0 -34
- package/dist/templates/threejs/packages/contracts/worlds.json +0 -5
- package/dist/templates/vanilla/gitignore +0 -7
- package/dist/templates/vanilla/mprocs.yaml +0 -13
- package/dist/templates/vanilla/packages/client/gitignore +0 -3
- package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +0 -21
- package/dist/templates/vanilla/packages/client/src/mud/setup.ts +0 -21
- package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +0 -106
- package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +0 -20
- package/dist/templates/vanilla/packages/client/src/mud/world.ts +0 -3
- package/dist/templates/vanilla/packages/client/tsconfig.json +0 -11
- package/dist/templates/vanilla/packages/contracts/.env +0 -11
- package/dist/templates/vanilla/packages/contracts/gitignore +0 -9
- package/dist/templates/vanilla/packages/contracts/mud.config.ts +0 -13
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -13
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +0 -16
- package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +0 -14
- package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +0 -31
- package/dist/templates/vanilla/packages/contracts/worlds.json +0 -5
- /package/{dist/templates → templates}/phaser/.eslintrc +0 -0
- /package/{dist/templates → templates}/phaser/.gitattributes +0 -0
- /package/{dist/templates/phaser/gitignore → templates/phaser/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/phaser/.vscode/settings.json +0 -0
- /package/{dist/templates → templates}/phaser/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/phaser/package.json +0 -0
- /package/{dist/templates/phaser/packages/art/gitignore → templates/phaser/packages/art/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/README.md +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/config-sprites.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/scripts/cli.mjs +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/scripts/export-tiled-types.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/3.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/4.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/5.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/3.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/tilesets/images/world.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/tilesets/world.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/.env +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/.eslintrc +0 -0
- /package/{dist/templates/phaser/packages/client/gitignore → templates/phaser/packages/client/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/tilesets/world.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/artTypes/world.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/index.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/network/createNetworkLayer.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/configurePhaser.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/constants.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/index.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/store.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/App.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/index.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/PhaserLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/UIRoot.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/Wrapper.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/SpriteImage.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/tsconfig.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/vite.config.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.env +0 -0
- /package/{dist/templates/phaser/packages/contracts/gitignore → templates/phaser/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/phaser/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/phaser/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react/.eslintrc +0 -0
- /package/{dist/templates → templates}/react/.gitattributes +0 -0
- /package/{dist/templates → templates}/react/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/react/.vscode/settings.json +0 -0
- /package/{dist/templates → templates}/react/packages/client/.env +0 -0
- /package/{dist/templates → templates}/react/packages/client/.eslintrc +0 -0
- /package/{dist/templates → templates}/react/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/App.tsx +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/Providers.tsx +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/common.ts +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/game/GameMap.tsx +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/mud/stash.ts +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/mud/useSyncStatus.ts +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/MoveSystem.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/react/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/react/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react-ecs/.eslintrc +0 -0
- /package/{dist/templates → templates}/react-ecs/.gitattributes +0 -0
- /package/{dist/templates/react/gitignore → templates/react-ecs/.gitignore_} +0 -0
- /package/{dist/templates → templates}/react-ecs/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/react-ecs/.vscode/settings.json +0 -0
- /package/{dist/templates/react → templates/react-ecs}/package.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/client/.env +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/client/.eslintrc +0 -0
- /package/{dist/templates/react/packages/client/gitignore → templates/react-ecs/packages/client/.gitignore_} +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/index.html +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/postcss.config.cjs +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/game/useKeyboardMovement.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/index.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/mud/Explorer.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/mud/useWorldContract.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/AsyncButton.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/ErrorFallback.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/icons/ArrowDownIcon.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/icons/MUDIcon.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/wagmiConfig.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/tailwind.config.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react/packages/contracts/gitignore → templates/react-ecs/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/src/codegen/common.sol +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/react-ecs/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/react-ecs/tsconfig.json +0 -0
- /package/{dist/templates → templates}/threejs/.eslintrc +0 -0
- /package/{dist/templates → templates}/threejs/.gitattributes +0 -0
- /package/{dist/templates/react-ecs/gitignore → templates/threejs/.gitignore_} +0 -0
- /package/{dist/templates → templates}/threejs/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/threejs/.vscode/settings.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/threejs/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/.env +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/.eslintrc +0 -0
- /package/{dist/templates/react-ecs/packages/client/gitignore → templates/threejs/packages/client/.gitignore_} +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/App.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/MUDContext.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/index.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/useKeyboardMovement.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/contracts/.env +0 -0
- /package/{dist/templates/react-ecs/packages/contracts/gitignore → templates/threejs/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/systems/MoveSystem.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/test/WorldTest.t.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/threejs/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/threejs/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/.eslintrc +0 -0
- /package/{dist/templates → templates}/vanilla/.gitattributes +0 -0
- /package/{dist/templates/threejs/gitignore → templates/vanilla/.gitignore_} +0 -0
- /package/{dist/templates → templates}/vanilla/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/vanilla/.vscode/settings.json +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/vanilla/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/.env +0 -0
- /package/{dist/templates/threejs/packages/client/gitignore → templates/vanilla/packages/client/.gitignore_} +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/index.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react → templates/vanilla}/packages/contracts/.env +0 -0
- /package/{dist/templates/threejs/packages/contracts/gitignore → templates/vanilla/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/vanilla/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/vanilla/tsconfig.json +0 -0
package/README.md
CHANGED
package/bin/cli.js
ADDED
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import s from"node:fs/promises";import t from"node:path";import{fileURLToPath as j}from"node:url";import h from"yargs-interactive";import y from"fast-glob";var c={name:"create-mud",version:"2.2.17",description:"Create a new MUD project",license:"MIT",author:"Lattice <mud@lattice.xyz>",type:"module",bin:"bin/cli.js",files:["bin","dist","templates"],scripts:{build:"pnpm run build:js","build:js":"tsup && pnpm run copy-templates",clean:"pnpm run clean:js","clean:js":"shx rm -rf dist","copy-templates":"tsx ./scripts/copy-templates.ts",dev:"tsup --watch",prepublishOnly:"npm run clean && npm run build",test:"pnpm run copy-templates && pnpm vitest --run && pnpm run test:vanilla && pnpm run test:react && pnpm run test:react-ecs && pnpm run test:phaser && pnpm run test:threejs","test:ci":"pnpm run test","test:phaser":"bin/cli.js --name test-project --template phaser && pnpm --dir test-project install && shx rm -rf test-project","test:react":"bin/cli.js --name test-project --template react && pnpm --dir test-project install && shx rm -rf test-project","test:react-ecs":"bin/cli.js --name test-project --template react-ecs && pnpm --dir test-project install && shx rm -rf test-project","test:threejs":"bin/cli.js --name test-project --template threejs && pnpm --dir test-project install && shx rm -rf test-project","test:vanilla":"bin/cli.js --name test-project --template vanilla && pnpm --dir test-project install && shx rm -rf test-project"},dependencies:{"fast-glob":"^3.3.3","yargs-interactive":"^3.0.1"},devDependencies:{"@types/yargs-interactive":"^2.1.6",execa:"^7.0.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"}};var o=["react","react-ecs","phaser","threejs","vanilla"];import f from"node:fs/promises";async function m(e){try{return await f.access(e),!0}catch{return!1}}var v=j(import.meta.url),b=t.dirname(v);async function w(){h().usage("$0 [args]").interactive({interactive:{default:!0},name:{describe:"Name your project",type:"input"},template:{describe:"Pick a template",type:"list",choices:o},"mud-version":{type:"input",describe:"The version of MUD packages to use, defaults to latest",default:c.version}}).then(async e=>{if(!e.name)throw new Error("No project name provided.");let n=t.join(process.cwd(),e.name);if(await m(n))throw new Error(`Target directory "${n}" already exists.`);let a=t.join(b,"..","templates",e.template),l=await y("**/*",{cwd:a,dot:!0});for(let p of l){let r=t.join(a,p),i=t.join(n,p);if(await s.mkdir(t.dirname(i),{recursive:!0}),/package\.json$/.test(r)){let u=await s.readFile(r,"utf-8");await s.writeFile(i,u.replaceAll(/{{mud-version}}/g,e.mudVersion),"utf-8")}else/\.gitignore_$/.test(r)?await s.copyFile(r,i.replace(/_$/,"")):await s.copyFile(r,i)}console.log(`
|
|
2
|
+
New project created! Run it with:
|
|
3
|
+
|
|
4
|
+
cd ${e.name}
|
|
5
|
+
pnpm install
|
|
6
|
+
pnpm dev
|
|
7
|
+
|
|
8
|
+
Have fun! For more info, check the docs at https://mud.dev/
|
|
9
|
+
`)})}w();
|
|
3
10
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../package.json"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/bin/cli.ts","../package.json","../src/common.ts","../src/exists.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport yargsInteractive from \"yargs-interactive\";\nimport glob from \"fast-glob\";\nimport packageJson from \"../../package.json\";\nimport { templates } from \"../common\";\nimport { exists } from \"../exists\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nasync function run() {\n yargsInteractive()\n .usage(\"$0 [args]\")\n .interactive({\n interactive: { default: true },\n name: {\n describe: \"Name your project\",\n type: \"input\",\n },\n template: {\n describe: \"Pick a template\",\n type: \"list\",\n choices: templates,\n },\n \"mud-version\": {\n type: \"input\",\n describe: \"The version of MUD packages to use, defaults to latest\",\n default: packageJson.version,\n },\n })\n .then(async (args) => {\n if (!args.name) throw new Error(\"No project name provided.\");\n\n const destDir = path.join(process.cwd(), args.name);\n if (await exists(destDir)) {\n throw new Error(`Target directory \"${destDir}\" already exists.`);\n }\n\n const sourceDir = path.join(__dirname, \"..\", \"templates\", args.template);\n const files = await glob(\"**/*\", { cwd: sourceDir, dot: true });\n\n for (const filename of files) {\n const sourceFile = path.join(sourceDir, filename);\n const destFile = path.join(destDir, filename);\n\n await fs.mkdir(path.dirname(destFile), { recursive: true });\n\n if (/package\\.json$/.test(sourceFile)) {\n const source = await fs.readFile(sourceFile, \"utf-8\");\n await fs.writeFile(destFile, source.replaceAll(/{{mud-version}}/g, args.mudVersion), \"utf-8\");\n } else if (/\\.gitignore_$/.test(sourceFile)) {\n await fs.copyFile(sourceFile, destFile.replace(/_$/, \"\"));\n } else {\n await fs.copyFile(sourceFile, destFile);\n }\n }\n\n console.log(`\nNew project created! Run it with:\n\n cd ${args.name}\n pnpm install\n pnpm dev\n\nHave fun! For more info, check the docs at https://mud.dev/\n`);\n });\n}\n\nrun();\n","{\n \"name\": \"create-mud\",\n \"version\": \"2.2.17\",\n \"description\": \"Create a new MUD project\",\n \"license\": \"MIT\",\n \"author\": \"Lattice <mud@lattice.xyz>\",\n \"type\": \"module\",\n \"bin\": \"bin/cli.js\",\n \"files\": [\n \"bin\",\n \"dist\",\n \"templates\"\n ],\n \"scripts\": {\n \"build\": \"pnpm run build:js\",\n \"build:js\": \"tsup && pnpm run copy-templates\",\n \"clean\": \"pnpm run clean:js\",\n \"clean:js\": \"shx rm -rf dist\",\n \"copy-templates\": \"tsx ./scripts/copy-templates.ts\",\n \"dev\": \"tsup --watch\",\n \"prepublishOnly\": \"npm run clean && npm run build\",\n \"test\": \"pnpm run copy-templates && pnpm vitest --run && pnpm run test:vanilla && pnpm run test:react && pnpm run test:react-ecs && pnpm run test:phaser && pnpm run test:threejs\",\n \"test:ci\": \"pnpm run test\",\n \"test:phaser\": \"bin/cli.js --name test-project --template phaser && pnpm --dir test-project install && shx rm -rf test-project\",\n \"test:react\": \"bin/cli.js --name test-project --template react && pnpm --dir test-project install && shx rm -rf test-project\",\n \"test:react-ecs\": \"bin/cli.js --name test-project --template react-ecs && pnpm --dir test-project install && shx rm -rf test-project\",\n \"test:threejs\": \"bin/cli.js --name test-project --template threejs && pnpm --dir test-project install && shx rm -rf test-project\",\n \"test:vanilla\": \"bin/cli.js --name test-project --template vanilla && pnpm --dir test-project install && shx rm -rf test-project\"\n },\n \"dependencies\": {\n \"fast-glob\": \"^3.3.3\",\n \"yargs-interactive\": \"^3.0.1\"\n },\n \"devDependencies\": {\n \"@types/yargs-interactive\": \"^2.1.6\",\n \"execa\": \"^7.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org\"\n }\n}\n","// We define these here to keep them in the order we want to present in the CLI.\n// Tests will ensure this list stays up to date.\nexport const templates = [\"react\", \"react-ecs\", \"phaser\", \"threejs\", \"vanilla\"];\n","import fs from \"node:fs/promises\";\n\nexport async function exists(path: string) {\n try {\n await fs.access(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":"AAAA,OAAOA,MAAQ,mBACf,OAAOC,MAAU,YACjB,OAAS,iBAAAC,MAAqB,WAC9B,OAAOC,MAAsB,oBAC7B,OAAOC,MAAU,YCJjB,IAAAC,EAAA,CACE,KAAQ,aACR,QAAW,SACX,YAAe,2BACf,QAAW,MACX,OAAU,4BACV,KAAQ,SACR,IAAO,aACP,MAAS,CACP,MACA,OACA,WACF,EACA,QAAW,CACT,MAAS,oBACT,WAAY,kCACZ,MAAS,oBACT,WAAY,kBACZ,iBAAkB,kCAClB,IAAO,eACP,eAAkB,iCAClB,KAAQ,2KACR,UAAW,gBACX,cAAe,iHACf,aAAc,gHACd,iBAAkB,oHAClB,eAAgB,kHAChB,eAAgB,iHAClB,EACA,aAAgB,CACd,YAAa,SACb,oBAAqB,QACvB,EACA,gBAAmB,CACjB,2BAA4B,SAC5B,MAAS,QACX,EACA,cAAiB,CACf,OAAU,SACV,SAAY,4BACd,CACF,ECvCO,IAAMC,EAAY,CAAC,QAAS,YAAa,SAAU,UAAW,SAAS,ECF9E,OAAOC,MAAQ,mBAEf,eAAsBC,EAAOC,EAAc,CACzC,GAAI,CACF,aAAMF,EAAG,OAAOE,CAAI,EACb,EACT,MAAQ,CACN,MAAO,EACT,CACF,CHAA,IAAMC,EAAaC,EAAc,YAAY,GAAG,EAC1CC,EAAYC,EAAK,QAAQH,CAAU,EAEzC,eAAeI,GAAM,CACnBC,EAAiB,EACd,MAAM,WAAW,EACjB,YAAY,CACX,YAAa,CAAE,QAAS,EAAK,EAC7B,KAAM,CACJ,SAAU,oBACV,KAAM,OACR,EACA,SAAU,CACR,SAAU,kBACV,KAAM,OACN,QAASC,CACX,EACA,cAAe,CACb,KAAM,QACN,SAAU,yDACV,QAASC,EAAY,OACvB,CACF,CAAC,EACA,KAAK,MAAOC,GAAS,CACpB,GAAI,CAACA,EAAK,KAAM,MAAM,IAAI,MAAM,2BAA2B,EAE3D,IAAMC,EAAUN,EAAK,KAAK,QAAQ,IAAI,EAAGK,EAAK,IAAI,EAClD,GAAI,MAAME,EAAOD,CAAO,EACtB,MAAM,IAAI,MAAM,qBAAqBA,CAAO,mBAAmB,EAGjE,IAAME,EAAYR,EAAK,KAAKD,EAAW,KAAM,YAAaM,EAAK,QAAQ,EACjEI,EAAQ,MAAMC,EAAK,OAAQ,CAAE,IAAKF,EAAW,IAAK,EAAK,CAAC,EAE9D,QAAWG,KAAYF,EAAO,CAC5B,IAAMG,EAAaZ,EAAK,KAAKQ,EAAWG,CAAQ,EAC1CE,EAAWb,EAAK,KAAKM,EAASK,CAAQ,EAI5C,GAFA,MAAMG,EAAG,MAAMd,EAAK,QAAQa,CAAQ,EAAG,CAAE,UAAW,EAAK,CAAC,EAEtD,iBAAiB,KAAKD,CAAU,EAAG,CACrC,IAAMG,EAAS,MAAMD,EAAG,SAASF,EAAY,OAAO,EACpD,MAAME,EAAG,UAAUD,EAAUE,EAAO,WAAW,mBAAoBV,EAAK,UAAU,EAAG,OAAO,CAC9F,KAAW,gBAAgB,KAAKO,CAAU,EACxC,MAAME,EAAG,SAASF,EAAYC,EAAS,QAAQ,KAAM,EAAE,CAAC,EAExD,MAAMC,EAAG,SAASF,EAAYC,CAAQ,CAE1C,CAEA,QAAQ,IAAI;AAAA;AAAA;AAAA,OAGXR,EAAK,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,CAKf,CACG,CAAC,CACL,CAEAJ,EAAI","names":["fs","path","fileURLToPath","yargsInteractive","glob","package_default","templates","fs","exists","path","__filename","fileURLToPath","__dirname","path","run","yargsInteractive","templates","package_default","args","destDir","exists","sourceDir","files","glob","filename","sourceFile","destFile","fs","source"]}
|
package/package.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mud",
|
|
3
|
-
"version": "2.2.17
|
|
3
|
+
"version": "2.2.17",
|
|
4
4
|
"description": "Create a new MUD project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lattice <mud@lattice.xyz>",
|
|
7
|
-
"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": "bin/cli.js",
|
|
8
9
|
"files": [
|
|
9
|
-
"
|
|
10
|
+
"bin",
|
|
11
|
+
"dist",
|
|
12
|
+
"templates"
|
|
10
13
|
],
|
|
11
14
|
"dependencies": {
|
|
12
|
-
"
|
|
15
|
+
"fast-glob": "^3.3.3",
|
|
16
|
+
"yargs-interactive": "^3.0.1"
|
|
13
17
|
},
|
|
14
18
|
"devDependencies": {
|
|
19
|
+
"@types/yargs-interactive": "^2.1.6",
|
|
15
20
|
"execa": "^7.0.0"
|
|
16
21
|
},
|
|
17
22
|
"publishConfig": {
|
|
@@ -20,16 +25,17 @@
|
|
|
20
25
|
},
|
|
21
26
|
"scripts": {
|
|
22
27
|
"build": "pnpm run build:js",
|
|
23
|
-
"build:js": "tsup &&
|
|
28
|
+
"build:js": "tsup && pnpm run copy-templates",
|
|
24
29
|
"clean": "pnpm run clean:js",
|
|
25
30
|
"clean:js": "shx rm -rf dist",
|
|
31
|
+
"copy-templates": "tsx ./scripts/copy-templates.ts",
|
|
26
32
|
"dev": "tsup --watch",
|
|
27
|
-
"test": "pnpm run test:vanilla && pnpm run test:react && pnpm run test:react-ecs && pnpm run test:phaser && pnpm run test:threejs",
|
|
33
|
+
"test": "pnpm run copy-templates && pnpm vitest --run && pnpm run test:vanilla && pnpm run test:react && pnpm run test:react-ecs && pnpm run test:phaser && pnpm run test:threejs",
|
|
28
34
|
"test:ci": "pnpm run test",
|
|
29
|
-
"test:phaser": "
|
|
30
|
-
"test:react": "
|
|
31
|
-
"test:react-ecs": "
|
|
32
|
-
"test:threejs": "
|
|
33
|
-
"test:vanilla": "
|
|
35
|
+
"test:phaser": "bin/cli.js --name test-project --template phaser && pnpm --dir test-project install && shx rm -rf test-project",
|
|
36
|
+
"test:react": "bin/cli.js --name test-project --template react && pnpm --dir test-project install && shx rm -rf test-project",
|
|
37
|
+
"test:react-ecs": "bin/cli.js --name test-project --template react-ecs && pnpm --dir test-project install && shx rm -rf test-project",
|
|
38
|
+
"test:threejs": "bin/cli.js --name test-project --template threejs && pnpm --dir test-project install && shx rm -rf test-project",
|
|
39
|
+
"test:vanilla": "bin/cli.js --name test-project --template vanilla && pnpm --dir test-project install && shx rm -rf test-project"
|
|
34
40
|
}
|
|
35
41
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
scrollback: 10000
|
|
2
|
+
procs:
|
|
3
|
+
client:
|
|
4
|
+
cwd: packages/client
|
|
5
|
+
shell: pnpm run dev
|
|
6
|
+
contracts:
|
|
7
|
+
cwd: packages/contracts
|
|
8
|
+
shell: pnpm mud dev-contracts --rpc http://127.0.0.1:8545
|
|
9
|
+
deploy-prereqs:
|
|
10
|
+
cwd: packages/contracts
|
|
11
|
+
shell: pnpm entrykit-deploy
|
|
12
|
+
env:
|
|
13
|
+
DEBUG: "mud:*"
|
|
14
|
+
# Anvil default account (0x70997970C51812dc3A010C7d01b50e0d17dc79C8)
|
|
15
|
+
PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
16
|
+
anvil:
|
|
17
|
+
cwd: packages/contracts
|
|
18
|
+
shell: anvil --block-time 2
|
|
19
|
+
explorer:
|
|
20
|
+
cwd: packages/contracts
|
|
21
|
+
shell: pnpm explorer
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mud-template-react",
|
|
3
|
+
"private": true,
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "pnpm recursive run build",
|
|
6
|
+
"dev": "mprocs",
|
|
7
|
+
"dev:client": "pnpm --filter 'client' run dev",
|
|
8
|
+
"dev:contracts": "pnpm --filter 'contracts' dev",
|
|
9
|
+
"foundry:up": "curl -L https://foundry.paradigm.xyz | bash && bash $HOME/.foundry/bin/foundryup",
|
|
10
|
+
"mud:up": "pnpm mud set-version --tag main && pnpm install",
|
|
11
|
+
"prepare": "(forge --version || pnpm foundry:up)",
|
|
12
|
+
"test": "pnpm recursive run test"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@latticexyz/cli": "{{mud-version}}",
|
|
16
|
+
"@latticexyz/common": "{{mud-version}}",
|
|
17
|
+
"@latticexyz/explorer": "{{mud-version}}",
|
|
18
|
+
"@latticexyz/store-indexer": "{{mud-version}}",
|
|
19
|
+
"@types/debug": "4.1.7",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "7.1.1",
|
|
21
|
+
"@typescript-eslint/parser": "7.1.1",
|
|
22
|
+
"eslint": "8.57.0",
|
|
23
|
+
"mprocs": "^0.7.1",
|
|
24
|
+
"shx": "^0.3.4",
|
|
25
|
+
"typescript": "5.4.2"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": "^18",
|
|
29
|
+
"pnpm": "^8 || ^9"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>a
|
|
6
|
+
<title>a MUD app</title>
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<div id="react-root"></div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { Direction } from "../common";
|
|
3
|
+
|
|
4
|
+
const keys = new Map<KeyboardEvent["key"], Direction>([
|
|
5
|
+
["ArrowUp", "North"],
|
|
6
|
+
["ArrowRight", "East"],
|
|
7
|
+
["ArrowDown", "South"],
|
|
8
|
+
["ArrowLeft", "West"],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
export const useKeyboardMovement = (move: undefined | ((direction: Direction) => void)) => {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!move) return;
|
|
14
|
+
|
|
15
|
+
const listener = (event: KeyboardEvent) => {
|
|
16
|
+
const direction = keys.get(event.key);
|
|
17
|
+
if (direction == null) return;
|
|
18
|
+
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
move(direction);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
window.addEventListener("keydown", listener);
|
|
24
|
+
return () => window.removeEventListener("keydown", listener);
|
|
25
|
+
}, [move]);
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "tailwindcss/tailwind.css";
|
|
2
|
+
import { StrictMode } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { Providers } from "./Providers";
|
|
5
|
+
import { App } from "./App";
|
|
6
|
+
import { Explorer } from "./mud/Explorer";
|
|
7
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
8
|
+
import { ErrorFallback } from "./ui/ErrorFallback";
|
|
9
|
+
|
|
10
|
+
createRoot(document.getElementById("react-root")!).render(
|
|
11
|
+
<StrictMode>
|
|
12
|
+
<ErrorBoundary FallbackComponent={ErrorFallback}>
|
|
13
|
+
<Providers>
|
|
14
|
+
<App />
|
|
15
|
+
<Explorer />
|
|
16
|
+
</Providers>
|
|
17
|
+
</ErrorBoundary>
|
|
18
|
+
</StrictMode>,
|
|
19
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { getChain, getWorldAddress } from "../common";
|
|
3
|
+
import { MUDIcon } from "../ui/icons/MUDIcon";
|
|
4
|
+
|
|
5
|
+
export function Explorer() {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
|
|
8
|
+
const chain = getChain();
|
|
9
|
+
const worldAddress = getWorldAddress();
|
|
10
|
+
|
|
11
|
+
const explorerUrl = chain.blockExplorers?.worldsExplorer?.url;
|
|
12
|
+
if (!explorerUrl) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="fixed bottom-0 inset-x-0 flex flex-col opacity-80 transition hover:opacity-100">
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
onClick={() => setOpen(!open)}
|
|
19
|
+
className="outline-none flex justify-end gap-2 p-2 font-medium leading-none text-black"
|
|
20
|
+
>
|
|
21
|
+
{open ? (
|
|
22
|
+
<>Close</>
|
|
23
|
+
) : (
|
|
24
|
+
<>
|
|
25
|
+
Explore <MUDIcon className="text-orange-500" />
|
|
26
|
+
</>
|
|
27
|
+
)}
|
|
28
|
+
</button>
|
|
29
|
+
{open ? <iframe src={`${explorerUrl}/${worldAddress}`} className="bg-black h-[50vh]" /> : null}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { useSyncStatus } from "./useSyncStatus";
|
|
3
3
|
import { TableRecord } from "@latticexyz/stash/internal";
|
|
4
|
-
import { SyncProgress } from "@latticexyz/store-sync/
|
|
4
|
+
import { SyncProgress } from "@latticexyz/store-sync/internal";
|
|
5
5
|
|
|
6
6
|
export type Props = {
|
|
7
7
|
children: ReactNode;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useClient } from "wagmi";
|
|
2
|
+
import { chainId, getWorldAddress } from "../common";
|
|
3
|
+
import { Account, Chain, Client, GetContractReturnType, Transport, getContract } from "viem";
|
|
4
|
+
import { useQuery } from "@tanstack/react-query";
|
|
5
|
+
import { useSessionClient } from "@latticexyz/entrykit/internal";
|
|
6
|
+
import { observer } from "@latticexyz/explorer/observer";
|
|
7
|
+
import worldAbi from "contracts/out/IWorld.sol/IWorld.abi.json";
|
|
8
|
+
|
|
9
|
+
export function useWorldContract():
|
|
10
|
+
| GetContractReturnType<
|
|
11
|
+
typeof worldAbi,
|
|
12
|
+
{
|
|
13
|
+
public: Client<Transport, Chain>;
|
|
14
|
+
wallet: Client<Transport, Chain, Account>;
|
|
15
|
+
}
|
|
16
|
+
>
|
|
17
|
+
| undefined {
|
|
18
|
+
const client = useClient({ chainId });
|
|
19
|
+
const { data: sessionClient } = useSessionClient();
|
|
20
|
+
|
|
21
|
+
const { data: worldContract } = useQuery({
|
|
22
|
+
queryKey: ["worldContract", client?.uid, sessionClient?.uid],
|
|
23
|
+
queryFn: () => {
|
|
24
|
+
if (!client || !sessionClient) {
|
|
25
|
+
throw new Error("Not connected.");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return getContract({
|
|
29
|
+
abi: worldAbi,
|
|
30
|
+
address: getWorldAddress(),
|
|
31
|
+
client: {
|
|
32
|
+
public: client,
|
|
33
|
+
wallet: sessionClient.extend(observer()),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
staleTime: Infinity,
|
|
38
|
+
refetchOnMount: false,
|
|
39
|
+
refetchOnReconnect: false,
|
|
40
|
+
refetchOnWindowFocus: false,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return worldContract;
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DetailedHTMLProps, ButtonHTMLAttributes, useState, useRef, useCallback, MouseEventHandler } from "react";
|
|
2
|
+
|
|
3
|
+
export type AsyncButtonProps = {
|
|
4
|
+
pending?: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type Props = AsyncButtonProps & DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
8
|
+
|
|
9
|
+
export const AsyncButton = ({ pending, type, disabled, onClick, ...props }: Props) => {
|
|
10
|
+
// TODO: move all this logic into a hook so we can wrap other event handlers
|
|
11
|
+
|
|
12
|
+
const promiseRef = useRef<Promise<unknown>>();
|
|
13
|
+
const [promisePending, setPromisePending] = useState<true | undefined>(undefined);
|
|
14
|
+
|
|
15
|
+
const asyncOnClick = useCallback<MouseEventHandler<HTMLButtonElement>>(
|
|
16
|
+
(...args) => {
|
|
17
|
+
if (!onClick) return;
|
|
18
|
+
const result = onClick(...args);
|
|
19
|
+
const promise = Promise.resolve(result);
|
|
20
|
+
promiseRef.current = promise;
|
|
21
|
+
setPromisePending(true);
|
|
22
|
+
promise.finally(() => {
|
|
23
|
+
if (promiseRef.current === promise) {
|
|
24
|
+
setPromisePending(undefined);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
[onClick],
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<button
|
|
33
|
+
type={type || "button"}
|
|
34
|
+
aria-busy={pending || promisePending}
|
|
35
|
+
aria-disabled={disabled}
|
|
36
|
+
disabled={disabled || pending || promisePending}
|
|
37
|
+
onClick={onClick ? asyncOnClick : undefined}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { wait } from "@latticexyz/common/utils";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { FallbackProps } from "react-error-boundary";
|
|
4
|
+
|
|
5
|
+
export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
|
|
6
|
+
const when = new Date();
|
|
7
|
+
const isMounted = useRef(false);
|
|
8
|
+
const [retries, setRetries] = useState(1);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
isMounted.current = true;
|
|
12
|
+
return () => {
|
|
13
|
+
isMounted.current = false;
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="fixed inset-0 overflow-auto bg-red-50">
|
|
19
|
+
<div className="w-full max-w-screen-md mx-auto py-16 px-8 space-y-12">
|
|
20
|
+
<h1 className="text-4xl font-black text-red-500">Oops! It broke :(</h1>
|
|
21
|
+
<div className="space-y-6">
|
|
22
|
+
<div className="relative">
|
|
23
|
+
<div className="p-6 bg-red-100 border-l-8 -ml-[8px] border-red-500 font-semibold whitespace-pre-wrap">
|
|
24
|
+
{error instanceof Error ? error.message : String(error)}
|
|
25
|
+
</div>
|
|
26
|
+
{error instanceof Error && error.stack ? (
|
|
27
|
+
<div className="p-6 bg-white font-mono text-sm overflow-auto whitespace-pre">{error.stack}</div>
|
|
28
|
+
) : null}
|
|
29
|
+
<div className="absolute top-full right-0 text-sm text-stone-400" title={when.toISOString()}>
|
|
30
|
+
{when.toLocaleString()}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
{retries > 0 ? (
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
className="group bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 active:bg-red-700 transition aria-busy:pointer-events-none aria-busy:animate-pulse"
|
|
38
|
+
onClick={async (event) => {
|
|
39
|
+
// if we retry and the same error occurs, it'll look like the button click did nothing
|
|
40
|
+
// so we'll fake a pending state here to give users an indication something is happening
|
|
41
|
+
event.currentTarget.ariaBusy = "true";
|
|
42
|
+
await wait(1000);
|
|
43
|
+
resetErrorBoundary();
|
|
44
|
+
if (isMounted.current) {
|
|
45
|
+
setRetries((value) => value - 1);
|
|
46
|
+
event.currentTarget.ariaBusy = null;
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<span className="group-aria-busy:hidden">Retry?</span>
|
|
51
|
+
<span className="hidden group-aria-busy:inline">Retrying…</span>
|
|
52
|
+
</button>
|
|
53
|
+
) : null}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DetailedHTMLProps, SVGAttributes } from "react";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
export type Props = DetailedHTMLProps<SVGAttributes<SVGSVGElement>, SVGSVGElement>;
|
|
5
|
+
|
|
6
|
+
export function ArrowDownIcon({ className, ...props }: Props) {
|
|
7
|
+
return (
|
|
8
|
+
<svg
|
|
9
|
+
className={twMerge("h-[1em] w-[1em]", className)}
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
viewBox="0 0 16 16"
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
{...props}
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
fillRule="evenodd"
|
|
17
|
+
d="M8 2a.75.75 0 0 1 .75.75v8.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.22 3.22V2.75A.75.75 0 0 1 8 2Z"
|
|
18
|
+
clipRule="evenodd"
|
|
19
|
+
/>
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DetailedHTMLProps, SVGAttributes } from "react";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
export type Props = DetailedHTMLProps<SVGAttributes<SVGSVGElement>, SVGSVGElement>;
|
|
5
|
+
|
|
6
|
+
export function MUDIcon({ className, ...props }: Props) {
|
|
7
|
+
return (
|
|
8
|
+
<svg
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
viewBox="0 0 8 8"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
shapeRendering="crispEdges"
|
|
13
|
+
className={twMerge("-my-[0.125em] h-[1.25em] w-[1.25em]", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
{/* eslint-disable-next-line max-len */}
|
|
17
|
+
<path d="M0 0h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm2-1h1v1H7zm0 1h1v1H7zM6 7h1v1H6zm1-2h1v1H7zm0-1h1v1H7zm0-1h1v1H7z" />
|
|
18
|
+
<path
|
|
19
|
+
d="M2 2h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm1-3h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm0 1h1v1H5zm0 1h1v1H5zm0 1h1v1H5zM4 5h1v1H4zM3 5h1v1H3z"
|
|
20
|
+
opacity=".5"
|
|
21
|
+
/>
|
|
22
|
+
<path d="M7 2h1v1H7zm0-1h1v1H7zM1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z" />
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Chain, http, webSocket } from "viem";
|
|
2
|
+
import { anvil } from "viem/chains";
|
|
3
|
+
import { createWagmiConfig } from "@latticexyz/entrykit/internal";
|
|
4
|
+
import { rhodolite, garnet, redstone } from "@latticexyz/common/chains";
|
|
5
|
+
import { chainId } from "./common";
|
|
6
|
+
|
|
7
|
+
export const chains = [
|
|
8
|
+
redstone,
|
|
9
|
+
garnet,
|
|
10
|
+
rhodolite,
|
|
11
|
+
{
|
|
12
|
+
...anvil,
|
|
13
|
+
contracts: {
|
|
14
|
+
...anvil.contracts,
|
|
15
|
+
paymaster: {
|
|
16
|
+
address: "0xf03E61E7421c43D9068Ca562882E98d1be0a6b6e",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
blockExplorers: {
|
|
20
|
+
default: {} as never,
|
|
21
|
+
worldsExplorer: {
|
|
22
|
+
name: "MUD Worlds Explorer",
|
|
23
|
+
url: "http://localhost:13690/anvil/worlds",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
] as const satisfies Chain[];
|
|
28
|
+
|
|
29
|
+
export const transports = {
|
|
30
|
+
[anvil.id]: webSocket(),
|
|
31
|
+
[garnet.id]: http(),
|
|
32
|
+
[rhodolite.id]: http(),
|
|
33
|
+
[redstone.id]: http(),
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
export const wagmiConfig = createWagmiConfig({
|
|
37
|
+
chainId,
|
|
38
|
+
// TODO: swap this with another default project ID or leave empty
|
|
39
|
+
walletConnectProjectId: "14ce88fdbc0f9c294e26ec9b4d848e44",
|
|
40
|
+
appName: document.title,
|
|
41
|
+
chains,
|
|
42
|
+
transports,
|
|
43
|
+
pollingInterval: {
|
|
44
|
+
[anvil.id]: 2000,
|
|
45
|
+
[garnet.id]: 2000,
|
|
46
|
+
[rhodolite.id]: 2000,
|
|
47
|
+
[redstone.id]: 2000,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { defineConfig } from "vite";
|
|
2
2
|
import react from "@vitejs/plugin-react";
|
|
3
|
+
import { mud } from "vite-plugin-mud";
|
|
3
4
|
|
|
4
5
|
export default defineConfig({
|
|
5
|
-
plugins: [react()],
|
|
6
|
-
server: {
|
|
7
|
-
port: 3000,
|
|
8
|
-
fs: {
|
|
9
|
-
strict: false,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
6
|
+
plugins: [react(), mud({ worldsFile: "../contracts/worlds.json" })],
|
|
12
7
|
build: {
|
|
13
8
|
target: "es2022",
|
|
14
9
|
minify: true,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This .env file is for demonstration purposes only.
|
|
2
|
+
#
|
|
3
|
+
# This should usually be excluded via .gitignore and the env vars attached to
|
|
4
|
+
# your deployment environment, but we're including this here for ease of local
|
|
5
|
+
# development. Please do not commit changes to this file!
|
|
6
|
+
#
|
|
7
|
+
# Enable debug logs for MUD CLI
|
|
8
|
+
DEBUG=mud:*
|
|
9
|
+
#
|
|
10
|
+
# Anvil default private key
|
|
11
|
+
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|