Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docs and example #231

Merged
merged 4 commits into from
Jul 2, 2024
Merged

fix: docs and example #231

merged 4 commits into from
Jul 2, 2024

Conversation

ponderingdemocritus
Copy link
Contributor

@ponderingdemocritus ponderingdemocritus commented Jul 2, 2024

  • adds docs and some cleanups

Summary by CodeRabbit

  • New Features

    • Added functions for entity synchronization and fetching in the state package.
  • Documentation

    • Updated README files across projects to improve clarity and add useful links.
    • Enhanced autogenerated file comments with additional information about the generation process.
  • Chores

    • Updated subproject commit hashes and renamed projects for consistency.
    • Removed unnecessary console.log statements to clean up console output.
    • Adjusted import statements and removed redundant comments in various autogenerated files.
    • Updated script commands and configurations for setting up and running Dojo worlds.

Copy link

coderabbitai bot commented Jul 2, 2024

Walkthrough

The updates span across various parts of the codebase, including renaming sections and files, adding book links in README files, and adjusting import statements. Major functionality updates focus on expanding entity-related operations in packages/state/src/recs/index.ts. Additional changes include modifying build commands in readme.md and updating git clone instructions in packages/torii-wasm/build.sh. Autogenerated file headers also received updates to include more generation process details.

Changes

Files & Paths Change Summary
examples/dojo-starter Updated subproject commit hash
examples/react/react-app/readme.md Renamed "React-app" to "Dojo React Vite App" and added a book link
examples/react/react-app/src/App.tsx Removed console.log statement in App function
examples/react/react-phaser-example/readme.md Renamed section title to "Dojo Phaser React App" and added book link in place of script instructions
packages/state/src/recs/index.ts Added getSyncEntities, getEntities, and syncEntities functions; updated setEntities function
readme.md Updated command line syntax and added new commands for Dojo.js SDK
Multiple Files (examples/.../contractComponents.ts, .../generated.ts, .../world.ts) Updated file comments to include generation details and minor import statement adjustments
packages/torii-wasm/build.sh Modified git clone command to include --depth 1 and --branch v0.7.0 options

Poem

In the land of Dojo, updates we weave,
New commands and entities, fresh to achieve.
React and Phaser, with headers adorned,
Building worlds with syntax reformed.
From Vite to Torii, the rabbit's dance,
Code and comment in a swift, enhanced prance.
🌟✨🛠️


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c3e260d and 0e66b7f.

Files ignored due to path filters (1)
  • examples/react/react-app/src/assets/react.svg is excluded by !**/*.svg
Files selected for processing (5)
  • examples/dojo-starter (1 hunks)
  • examples/react/react-app/readme.md (1 hunks)
  • examples/react/react-app/src/App.tsx (1 hunks)
  • examples/react/react-phaser-example/readme.md (1 hunks)
  • packages/state/src/recs/index.ts (4 hunks)
Files skipped from review due to trivial changes (3)
  • examples/dojo-starter
  • examples/react/react-app/readme.md
  • examples/react/react-phaser-example/readme.md
Additional context used
Biome
packages/state/src/recs/index.ts

[error] 84-84: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 86-86: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

examples/react/react-app/src/App.tsx

[error] 117-117: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 60-60: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 64-64: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 68-68: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 95-95: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 106-106: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 131-137: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 142-148: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 151-153: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 158-160: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

Additional comments not posted (4)
packages/state/src/recs/index.ts (4)

12-19: Improve the docstring for clarity.

The docstring is comprehensive but can be made more concise and clear.

- * @param entities - An array of entities to synchronize.
+ * @param entities - The entities to synchronize.

30-35: Improve the docstring for clarity.

The docstring is comprehensive but can be made more concise and clear.

- * @param components - An array of component definitions.
+ * @param components - The component definitions.

57-63: Improve the docstring for clarity.

The docstring is comprehensive but can be made more concise and clear.

- * @param entities - An array of entities to watch for updates.
+ * @param entities - The entities to watch for updates.

74-78: Improve the docstring for clarity.

The docstring is comprehensive but can be made more concise and clear.

- * @param entities - An array of entities with their updated component data.
+ * @param entities - The entities with their updated component data.

Comment on lines +15 to +19
* @param components - An array of component definitions.
* @param entities - An array of entities to synchronize.
* @param limit - The maximum number of entities to fetch per request (default: 100).
* @returns A promise that resolves when synchronization is complete.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using any type for entities.

Using any type reduces type safety. Consider defining a specific type or interface for entities.

entities: Entity[],

Comment on lines +33 to +35
* @param components - An array of component definitions.
* @param limit - The maximum number of entities to fetch per request (default: 100).
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using any type for entities.

Using any type reduces type safety. Consider defining a specific type or interface for entities.

entities: Entity[],

Comment on lines +61 to +63
* @param entities - An array of entities to watch for updates.
* @returns A promise that resolves with the subscription handler.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using any type for entities.

Using any type reduces type safety. Consider defining a specific type or interface for entities.

entities: Entity[],

Comment on lines +77 to +78
* @param components - An array of component definitions.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using any type for entities.

Using any type reduces type safety. Consider defining a specific type or interface for entities.

entities: Entity[],

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0e66b7f and 6cacdba.

Files selected for processing (1)
  • readme.md (5 hunks)
Additional context used
LanguageTool
readme.md

[uncategorized] ~69-~69: Possible missing comma found.
Context: ...you have issues on WSL, install package first then run command: ```bash npm i @dojoe...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~100-~100: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...efa2519b18 --allowed-origins "*" **Terminal 3**: Start the App bash cd examples...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

Markdownlint
readme.md

41-41: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)


41-41: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


57-57: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


2-2: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


5-5: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


6-6: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

Additional comments not posted (6)
readme.md (6)

22-22: LGTM!

The command to bootstrap a dojo world looks good.


37-37: LGTM!

The command to install package dependencies using pnpm looks good.


47-47: LGTM!

The command to build all packages using pnpm looks good.


53-53: LGTM!

The command to watch for changes on all packages using pnpm looks good.


61-61: LGTM!

The command to install dojo-starter submodule looks good.


89-97: LGTM!

The commands to build, migrate, and run Torii look good.

Comment on lines +82 to +84
```bash
cd examples/dojo-starter
katana --disable-fee --block-time 1000
katana --disable-fee --allowed-origins "*"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Ensure the --allowed-origins flag is documented

The --allowed-origins flag is used in the readme.md file but lacks an explanation of its purpose and implications. Please add documentation or comments to clarify its usage.

  • readme.md: Lines containing --allowed-origins
Analysis chain

LGTM! But verify the usage of --allowed-origins flag.

The command to set up the dojo starter with specific configurations looks good.

However, ensure that users understand the purpose and implications of the --allowed-origins flag.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `--allowed-origins` flag.

# Test: Search for the flag usage in the codebase. Expect: Documentation or comments explaining its purpose.
rg --type markdown --type js --type ts $'--allowed-origins'

Length of output: 478



Script:

#!/bin/bash
# Description: Verify the usage of `--allowed-origins` flag.

# Test: Search for the flag usage in the codebase. Expect: Documentation or comments explaining its purpose.
rg --type markdown --type js --type ts '--allowed-origins'

Length of output: 478



Script:

#!/bin/bash
# Description: Verify the usage of `--allowed-origins` flag.

# Test: Search for the flag usage in the codebase. Expect: Documentation or comments explaining its purpose.
rg --type markdown --type js --type ts '\-\-allowed-origins'

Length of output: 226

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6cacdba and eb28675.

Files selected for processing (19)
  • examples/react/react-app/src/dojo/generated/contractComponents.ts (1 hunks)
  • examples/react/react-app/src/dojo/generated/generated.ts (1 hunks)
  • examples/react/react-app/src/dojo/generated/world.ts (1 hunks)
  • examples/react/react-phaser-example/src/dojo/generated/contractComponents.ts (1 hunks)
  • examples/react/react-phaser-example/src/dojo/generated/generated.ts (1 hunks)
  • examples/react/react-phaser-example/src/dojo/generated/world.ts (1 hunks)
  • examples/react/react-pwa-app/src/dojo/generated/contractComponents.ts (1 hunks)
  • examples/react/react-pwa-app/src/dojo/generated/generated.ts (1 hunks)
  • examples/react/react-pwa-app/src/dojo/generated/world.ts (1 hunks)
  • examples/react/react-threejs/src/dojo/generated/contractComponents.ts (1 hunks)
  • examples/react/react-threejs/src/dojo/generated/generated.ts (1 hunks)
  • examples/react/react-threejs/src/dojo/generated/world.ts (1 hunks)
  • examples/react/starknet-react-app/src/dojo/generated/contractComponents.ts (1 hunks)
  • examples/react/starknet-react-app/src/dojo/generated/generated.ts (1 hunks)
  • examples/react/starknet-react-app/src/dojo/generated/world.ts (1 hunks)
  • examples/vue/vue-app/src/dojo/generated/contractComponents.ts (1 hunks)
  • examples/vue/vue-app/src/dojo/generated/generated.ts (1 hunks)
  • examples/vue/vue-app/src/dojo/generated/world.ts (1 hunks)
  • packages/torii-wasm/build.sh (1 hunks)
Files skipped from review due to trivial changes (19)
  • examples/react/react-app/src/dojo/generated/contractComponents.ts
  • examples/react/react-app/src/dojo/generated/generated.ts
  • examples/react/react-app/src/dojo/generated/world.ts
  • examples/react/react-phaser-example/src/dojo/generated/contractComponents.ts
  • examples/react/react-phaser-example/src/dojo/generated/generated.ts
  • examples/react/react-phaser-example/src/dojo/generated/world.ts
  • examples/react/react-pwa-app/src/dojo/generated/contractComponents.ts
  • examples/react/react-pwa-app/src/dojo/generated/generated.ts
  • examples/react/react-pwa-app/src/dojo/generated/world.ts
  • examples/react/react-threejs/src/dojo/generated/contractComponents.ts
  • examples/react/react-threejs/src/dojo/generated/generated.ts
  • examples/react/react-threejs/src/dojo/generated/world.ts
  • examples/react/starknet-react-app/src/dojo/generated/contractComponents.ts
  • examples/react/starknet-react-app/src/dojo/generated/generated.ts
  • examples/react/starknet-react-app/src/dojo/generated/world.ts
  • examples/vue/vue-app/src/dojo/generated/contractComponents.ts
  • examples/vue/vue-app/src/dojo/generated/generated.ts
  • examples/vue/vue-app/src/dojo/generated/world.ts
  • packages/torii-wasm/build.sh

@ponderingdemocritus ponderingdemocritus merged commit f73e08c into main Jul 2, 2024
4 checks passed
@ponderingdemocritus ponderingdemocritus deleted the feat/state branch July 2, 2024 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant