Skip to content

Commit

Permalink
Merge pull request #107 from dojoengine/update-example
Browse files Browse the repository at this point in the history
Update example
  • Loading branch information
ponderingdemocritus authored Jan 16, 2024
2 parents ce4b4e6 + 390e092 commit f1c8ff4
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 163 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ jobs:
- uses: actions/checkout@v2
- uses: oven-sh/setup-bun@v1

- name: Update Submodules
run: git submodule update --init --recursive

- run: curl -L https://install.dojoengine.org | bash
- run: /home/runner/.config/.dojo/bin/dojoup -v v0.4.4
- run: |
cd examples/dojo-starter
/home/runner/.config/.dojo/bin/sozo build
/home/runner/.config/.dojo/bin/sozo test
- name: Install Protobuf Compiler
run: sudo apt-get install -y protobuf-compiler

Expand All @@ -26,9 +36,9 @@ jobs:
run: bun x prettier --check .

- name: Build dependencies
run: bun run build
run: bun run build && bun run build-examples

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bun run prettier
2 changes: 1 addition & 1 deletion examples/react/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"codegen": "graphql-codegen",
"create-components": "npx @dojoengine/core ../../dojo-starter/target/dev/manifest.json src/dojo/contractComponents.ts http://localhost:5050 0x33ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e"
"create-components": "npx @dojoengine/core ../../dojo-starter/target/dev/manifest.json src/dojo/generated/contractComponents.ts http://localhost:5050 0x33ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e"
},
"dependencies": {
"@dojoengine/core": "^0.3.0",
Expand Down
5 changes: 2 additions & 3 deletions examples/react/react-app/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { getSyncEntities } from "@dojoengine/state";
import { DojoProvider } from "@dojoengine/core";
import * as torii from "@dojoengine/torii-client";
import { createClientComponents } from "../createClientComponents";
import { createSystemCalls } from "../createSystemCalls";

import { defineContractComponents } from "./contractComponents";
import { world } from "./world";
import { Config } from "../../../dojoConfig";
import { setupWorld } from "./generated";
import { DojoProvider } from "@dojoengine/core";

export type SetupResult = Awaited<ReturnType<typeof setup>>;

Expand All @@ -16,7 +15,7 @@ export async function setup({ ...config }: Config) {
const toriiClient = await torii.createClient([], {
rpcUrl: config.rpcUrl,
toriiUrl: config.toriiUrl,
worldAddress: config.manifest.world.address,
worldAddress: config.manifest.world.address || "",
});

// create contract components
Expand Down
8 changes: 1 addition & 7 deletions examples/react/react-phaser-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"codegen": "graphql-codegen",
"components": "npx @dojoengine/core ../../dojo-starter/target/dev/manifest.json src/dojo/contractComponents.ts http://localhost:5050 0x33ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e"
"components": "npx @dojoengine/core ../../dojo-starter/target/dev/manifest.json src/dojo/generated/contractComponents.ts http://localhost:5050 0x33ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e"
},
"dependencies": {
"@dojoengine/core": "^0.3.0",
Expand All @@ -28,8 +28,6 @@
"clsx": "^2.0.0",
"ethers": "^5.7.2",
"events": "^3.3.0",
"graphql": "^16.7.1",
"graphql-request": "^6.1.0",
"lucide-react": "^0.292.0",
"mobx": "^6.9.0",
"phaser": "3.60.0-beta.14",
Expand All @@ -47,10 +45,6 @@
"zustand": "^4.4.1"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-graphql-request": "^5.0.0",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@types/node": "^20.9.0",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function setup({ ...config }: Config) {
const toriiClient = await torii.createClient([], {
rpcUrl: config.rpcUrl,
toriiUrl: config.toriiUrl,
worldAddress: config.manifest.world.address,
worldAddress: config.manifest.world.address || "",
});

// create contract components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const useNetworkLayer = () => {
useEffect(() => {
return () => {
networkLayerPromise.then((networkLayer) =>
networkLayer.world.dispose()
networkLayer.recsWorld.dispose()
);
};
}, [networkLayerPromise]);
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"tsup": "^8.0.1",
"typedoc": "^0.25.4",
"typedoc-material-theme": "^1.0.1",
"typedoc-plugin-coverage": "^2.2.0"
"typedoc-plugin-coverage": "^2.2.0",
"husky": "^8.0.0"
},
"scripts": {
"build-core": "bun run --cwd packages/core build",
Expand All @@ -30,12 +31,15 @@
"build-react": "bun run --cwd packages/react build",
"build-state": "bun run --cwd packages/state build",
"build-phaser": "bun run --cwd examples/react/react-phaser-example build",
"build-react-app": "bun run --cwd examples/react/react-app build",
"build-watch": "bun run build-core --watch & bun run build-create-burner --watch & bun run build-create-dojo --watch & bun run build-utils --watch & bun run build-react --watch & bun run build-torii-wasm --watch & bun run build-torii-client --watch & bun run build-state --watch",
"build": "bun run build-torii-wasm && bun run build-torii-client && bun run build-state && bun run build-core && bun run build-create-burner && bun run build-create-dojo && bun run build-utils && bun run build-react",
"build-examples": "bun run build-phaser && bun run build-react-app",
"clean": "rm -rf node_modules packages/create-burner/node_modules node_modules packages/create-dojo/node_modules packages/core/node_modules packages/utils/node_modules packages/torii-client/node_modules packages/torii-wasm/node_modules packages/react/node_modules bun.lockb packages/create-burner/bun.lockb packages/core/bun.lockb packages/utils/bun.lockb packages/torii-client/bun.lockb packages/torii-wasm/bun.lockb packages/react/bun.lockb && rm -rf examples/react/react-app/node_modules examples/react/react-app/bun.lockb examples/react/react-phaser-example/node_modules examples/react/react-phaser-example/bun.lockb",
"prettier-check": "bun x prettier --check .",
"prettier": "bun x prettier --write .",
"release": "bun run build && bun run prettier && npx lerna publish --no-private --force-publish",
"docs": "npx typedoc --out docs"
"docs": "npx typedoc --out docs",
"prepare": "husky install"
}
}
Loading

0 comments on commit f1c8ff4

Please sign in to comment.