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

Documented new frontend development script #2483

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

martetassyns
Copy link
Contributor

@martetassyns martetassyns commented Dec 2, 2024

Proposed change

Documented new development script added in home-assistant/frontend#23062.

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Removed stale or deprecated documentation

Additional information

Summary by CodeRabbit

Summary by CodeRabbit

  • Documentation
    • Restructured and enhanced frontend development documentation.
    • Expanded section on configuring Home Assistant for testing with two distinct methods.
    • Introduced detailed instructions for connecting the development frontend to an existing Home Assistant instance.
    • Added new subsections and improved overall document clarity with organized sections.
    • Clarified installation instructions for Node.js and Yarn, along with the development process.
    • Retained cautionary notes regarding local paths in pull requests.

Copy link
Contributor

coderabbitai bot commented Dec 2, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The documentation for frontend development has been significantly revised to enhance clarity and usability. It now presents two distinct methods for configuring Home Assistant for frontend testing, with detailed instructions for each method. A new command, script/develop_and_serve, has been introduced for running the frontend against an existing Home Assistant instance. The document's overall structure has been improved, and additional cautionary notes have been retained. Installation instructions for Node.js and Yarn remain largely unchanged but have been clarified.

Changes

File Path Change Summary
docs/frontend/development.md Restructured documentation with expanded sections on configuring Home Assistant for frontend testing. Introduced two methods for testing, detailed instructions, and a new command script/develop_and_serve. Retained cautionary notes about .devcontainer/devcontainer.json. Improved overall structure and clarity of the document. Installation instructions for Node.js and Yarn clarified.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant HomeAssistant
    participant Frontend

    Developer->>HomeAssistant: Configure Home Assistant with development frontend
    Developer->>Frontend: Run `script/develop_and_serve`
    Frontend->>HomeAssistant: Connect to existing Home Assistant instance
    Note over Developer, Frontend: Ensure to log out when changing URL
Loading

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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
Contributor

@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

🧹 Outside diff range and nitpick comments (2)
docs/frontend/development.md (2)

28-29: Minor grammatical improvement needed

The content effectively explains the two testing approaches and their tradeoffs. Add a comma after "However" for better readability:

-However the downside is that not everything can be tested this way.
+However, the downside is that not everything can be tested this way.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~28-~28: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...ng Home Assistant without modifying it. However the downside is that not everything can...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


59-79: Address grammatical issues in the new section

The content effectively documents the new script/develop_and_serve feature, but requires several grammatical corrections:

-If you setup your frontend development environment
+If you set up your frontend development environment

-run the frontend on http://localhost:8124 and it will connect
+run the frontend on http://localhost:8124, and it will connect

-you will need to logout from your development frontend
+you will need to log out from your development frontend

-you will need to setup port forwarding
+you will need to set up port forwarding

Also, consider completing the sentence about port forwarding setup with specific instructions or requirements.

🧰 Tools
🪛 LanguageTool

[grammar] ~61-~61: The word “setup” is a noun. The verb is spelled with a space.
Context: ... use an existing Home Assistant If you setup your frontend development environment s...

(NOUN_VERB_CONFUSION)


[uncategorized] ~61-~61: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)


[misspelling] ~67-~67: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[misspelling] ~67-~67: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


[grammar] ~73-~73: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

🪛 Markdownlint (0.35.0)

61-61: null
Bare URL used

(MD034, no-bare-urls)


61-61: null
Bare URL used

(MD034, no-bare-urls)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9dcf4c7 and ee25cac.

📒 Files selected for processing (1)
  • docs/frontend/development.md (2 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/frontend/development.md

[uncategorized] ~28-~28: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...ng Home Assistant without modifying it. However the downside is that not everything can...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[grammar] ~61-~61: The word “setup” is a noun. The verb is spelled with a space.
Context: ... use an existing Home Assistant If you setup your frontend development environment s...

(NOUN_VERB_CONFUSION)


[uncategorized] ~61-~61: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)


[misspelling] ~67-~67: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[misspelling] ~67-~67: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


[grammar] ~73-~73: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

🪛 Markdownlint (0.35.0)
docs/frontend/development.md

61-61: null
Bare URL used

(MD034, no-bare-urls)


61-61: null
Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (1)
docs/frontend/development.md (1)

Line range hint 30-58: Well-documented configuration instructions

The section provides clear, complete instructions for configuring the development frontend, including:

  • Clear YAML configuration examples
  • Detailed devcontainer setup steps
  • Important caution about excluding local paths from PRs
🧰 Tools
🪛 LanguageTool

[uncategorized] ~28-~28: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...ng Home Assistant without modifying it. However the downside is that not everything can...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

Comment on lines +63 to +71
```shell
script/develop_and_serve
```

You can change the Home Assistant url the frontend connects to by passing the -c option. This will also work for existing production core instances. It does not need to be a development version hosted locally. However, if you change the value for this option you will need to logout from your development frontend before it actually switches to the new value. For example:

```shell
script/develop_and_serve -c https://myhost.duckdns.org:8123
```
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Documentation refers to a non-existent script

The documentation refers to a script/develop_and_serve script and its -c option, but this script does not exist in the codebase. The development server is actually managed through npm scripts defined in package.json, which uses Docusaurus commands and doesn't support the documented URL configuration option.

  • Remove or update the documentation at docs/frontend/development.md to reflect the correct development server setup using npm start or the appropriate Docusaurus commands
  • Remove the incorrect information about the -c option for changing the Home Assistant URL
🔗 Analysis chain

Verify documentation against the frontend implementation

Let's verify that the documented command and options match the implementation in PR #23062.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the script implementation matches the documentation

# Check if the script exists and verify its contents
if [ -f "script/develop_and_serve" ]; then
    echo "Checking script/develop_and_serve implementation..."
    cat script/develop_and_serve
else
    echo "Warning: script/develop_and_serve not found"
fi

# Search for related test files
fd -t f -e ts -e js "develop.*serve" test/

Length of output: 272


Script:

#!/bin/bash
# Let's check if the script exists in a different location and search for related files
fd -t f "develop_and_serve"

# Search for any files containing references to the script or its options
rg -i "develop_and_serve"

# Search for any configuration or URL-related patterns in the frontend code
rg -i "hass_url|hassUrl|HASS_URL" src/

Length of output: 299


Script:

#!/bin/bash
# Let's check the dev scripts directory and package.json for development commands
fd -t f "package.json"

# Check the content of package.json for development scripts
cat package.json

# Look for any development server or configuration related files
fd -t f -e js -e ts "dev-server|webpack.config"

Length of output: 1140

🧰 Tools
🪛 LanguageTool

[misspelling] ~67-~67: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[misspelling] ~67-~67: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)

@wendevlin
Copy link

@martetassyns thanks,

could you maybe use tabs instead of 1. and 2.? I think that would make it clearer that these are 2 options.

@joostlek joostlek changed the title Documented new feature added in pull request 23062 Documented new frontend development script Dec 3, 2024
@bramkragten
Copy link
Member

We should not document this until it fully works. Right now REST API calls will not work.

@martetassyns
Copy link
Contributor Author

@wendevlin Could you point me to an example in the existing code where tabs are used? I tried to use the markdown {.tabset} feature I found documented online, but that doesn't work both in the visual code preview (attribute is printed instead of used) nor when running the Docusaurus site (errror: Could not parse expression with acorn).

@martetassyns
Copy link
Contributor Author

martetassyns commented Dec 4, 2024

@bramkragten I wasn't aware that the frontend also made calls through that api and not just the websocket. I will make the changes

@wendevlin
Copy link

@bramkragten I wasn't aware that the frontend also made calls through that api and not just the websocket. I will make the changes

@MindFreeze will look into it, we need to add a proxy and maybe replace @web/dev-server with another alternative

@wendevlin
Copy link

@wendevlin Could you point me to an example in the existing code where tabs are used? I tried to use the markdown {.tabset} feature I found documented online, but that doesn't work both in the visual code preview (attribute is printed instead of used) nor when running the Docusaurus site (errror: Could not parse expression with acorn).

Sure, here is an example: https://docusaurus.io/docs/markdown-features/tabs

you need to import Tabs and TabItem below the frontmatter section (second ---)

When you do it correctly you would need to rename from .md to .mdx but docusaurus don't really care, it works with both.

@martetassyns
Copy link
Contributor Author

@wendevlin @MindFreeze I assume this approach is what you are referring to?
https://github.com/martetassyns/home-assistant-frontend/tree/feat/develop-and-serve-improvements
I'm still looking into how to make the authorization flow work properly if I also proxy the websocket.

@MindFreeze
Copy link
Contributor

@wendevlin @MindFreeze I assume this approach is what you are referring to? https://github.com/martetassyns/home-assistant-frontend/tree/feat/develop-and-serve-improvements I'm still looking into how to make the authorization flow work properly if I also proxy the websocket.

we don't need to proxy thr websocket it it's problem but it make everything cleaner. I started looking into using rspack's dec server but didn't have much time today

@martetassyns
Copy link
Contributor Author

@wendevlin The Tabs/TabItem feature in docusaurus in only available from version 3.6.3, while this repo is using 3.5.2 (at least I assume that is why I get an error Could not parse import/exports with acorn). I Feel that upgrading this should not be part of the scope of this change. Do you have any other recommendation on how we can make this more readable?

@wendevlin
Copy link

@wendevlin The Tabs/TabItem feature in docusaurus in only available from version 3.6.3, while this repo is using 3.5.2 (at least I assume that is why I get an error Could not parse import/exports with acorn). I Feel that upgrading this should not be part of the scope of this change. Do you have any other recommendation on how we can make this more readable?

Mhh ok. I tested it for you in dev mode. Need to check details tomorrow.

@martetassyns
Copy link
Contributor Author

martetassyns commented Dec 4, 2024

@MindFreeze it would be nice if everything could be proxied. Because the hostname under which the core is accessible can be different between the browser and your node server hosting the files if you're running in devcontainer and use localhost. (it would be docker.host.internal in that case). It would also remove the need to have a special build of the frontend. I'll try to look into that some more.

@wendevlin
Copy link

@wendevlin The Tabs/TabItem feature in docusaurus in only available from version 3.6.3, while this repo is using 3.5.2 (at least I assume that is why I get an error Could not parse import/exports with acorn). I Feel that upgrading this should not be part of the scope of this change. Do you have any other recommendation on how we can make this more readable?

Tabs are available since version 2.0 see here

@martetassyns
Copy link
Contributor Author

@wendevlin I found what was going wrong and have made the requested changes to tabs.

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (4)
docs/frontend/development.md (4)

28-29: Improve readability with proper punctuation

The content effectively explains the two configuration methods. However, there are minor grammatical improvements needed:

-However the downside is that not everything can be tested this way.
+However, the downside is that not everything can be tested this way.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~28-~28: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...ng Home Assistant without modifying it. However the downside is that not everything can...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


66-67: Fix grammar and improve URL formatting

Several improvements needed:

-If you setup your frontend development environment
+If you set up your frontend development environment

-frontend on http://localhost:8124 and it will connect
+frontend on `http://localhost:8124`, and it will connect
🧰 Tools
🪛 LanguageTool

[grammar] ~66-~66: The word “setup” is a noun. The verb is spelled with a space.
Context: ...ontend outside Home Assistant"> If you setup your frontend development environment s...

(NOUN_VERB_CONFUSION)


[uncategorized] ~66-~66: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)

🪛 Markdownlint (0.35.0)

66-66: null
Bare URL used

(MD034, no-bare-urls)


66-66: null
Bare URL used

(MD034, no-bare-urls)


78-83: Fix grammar and clarify port forwarding setup

-you will need to setup port forwarding
+you will need to set up port forwarding

Consider adding brief instructions or a link to documentation about configuring port forwarding in devcontainers.

🧰 Tools
🪛 LanguageTool

[grammar] ~78-~78: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)


72-73: Fix grammar in configuration instructions

Several grammar improvements needed:

-by passing the -c option
+bypassing the -c option

-you will need to logout from
+you will need to log out from
🧰 Tools
🪛 LanguageTool

[misspelling] ~72-~72: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~72-~72: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~72-~72: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ee25cac and 9d93755.

📒 Files selected for processing (1)
  • docs/frontend/development.md (2 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/frontend/development.md

[uncategorized] ~28-~28: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...ng Home Assistant without modifying it. However the downside is that not everything can...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[grammar] ~66-~66: The word “setup” is a noun. The verb is spelled with a space.
Context: ...ontend outside Home Assistant"> If you setup your frontend development environment s...

(NOUN_VERB_CONFUSION)


[uncategorized] ~66-~66: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)


[misspelling] ~72-~72: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~72-~72: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~72-~72: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


[grammar] ~78-~78: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

🪛 Markdownlint (0.35.0)
docs/frontend/development.md

66-66: null
Bare URL used

(MD034, no-bare-urls)


66-66: null
Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (3)
docs/frontend/development.md (3)

30-34: Well-structured tab implementation

The use of Docusaurus tabs improves the documentation's organization and readability, making it easier for users to choose their preferred configuration method.

Also applies to: 62-63, 85-87


68-76: ⚠️ Potential issue

Documentation refers to a non-existent script

Based on the previous review, the script/develop_and_serve script and its -c option don't exist in the codebase yet. This documentation should be added after the script is implemented in PR #23062.

🧰 Tools
🪛 LanguageTool

[misspelling] ~72-~72: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~72-~72: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~72-~72: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


64-84: Hold documentation updates pending script implementation

As mentioned by bramkragten in the PR comments, this documentation should be finalized after the new script is fully functional and REST API calls are operational. Consider:

  1. Holding these changes until PR #23062 is merged
  2. Adding a note about REST API limitations
  3. Including examples of common use cases once the script is working
✅ Verification successful

Documentation should be added after script implementation

The script/develop_and_serve referenced in the documentation does not exist in the codebase yet. This documentation should be held until the actual script implementation is completed in PR #23062 to ensure accuracy and prevent confusion for developers.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify if the script exists in the frontend repository
if [ -f "script/develop_and_serve" ]; then
    echo "Script exists"
    cat script/develop_and_serve
else
    echo "Script does not exist yet"
fi

Length of output: 98

🧰 Tools
🪛 LanguageTool

[grammar] ~66-~66: The word “setup” is a noun. The verb is spelled with a space.
Context: ...ontend outside Home Assistant"> If you setup your frontend development environment s...

(NOUN_VERB_CONFUSION)


[uncategorized] ~66-~66: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)


[misspelling] ~72-~72: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~72-~72: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~72-~72: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


[grammar] ~78-~78: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

🪛 Markdownlint (0.35.0)

66-66: null
Bare URL used

(MD034, no-bare-urls)


66-66: null
Bare URL used

(MD034, no-bare-urls)

@wendevlin
Copy link

@wendevlin I found what was going wrong and have made the requested changes to tabs.

Thanks, we'll review it when frontend PR is merged.

@martetassyns
Copy link
Contributor Author

@bramkragten I think that CORS is not an issue since the calls to /api/ don't seem to use the $hassUrl and are relative (for which support was added in home-assistant/frontend#23144). Can you confirm that this is the case, or point me to a part of the UI were it is an issue?

@bramkragten
Copy link
Member

As mentioned in the frontend PR, we should document that the user should set cors_allowed_orgins

@martetassyns
Copy link
Contributor Author

@bramkragten done

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (4)
docs/frontend/development.md (4)

28-29: Add a heading for better document structure

Consider adding a clear heading like "## Configuration Methods" before introducing the two approaches. This would improve the document's structure and make it easier to navigate.


Line range hint 35-62: Improve configuration example formatting

Consider adding language identifiers to the code blocks for better syntax highlighting:

  • Use yaml configuration.yaml instead of just yaml
  • Use json devcontainer.json instead of just json

This helps readers quickly identify which file they're looking at.


80-84: Fix grammar and improve clarity

Several writing improvements needed:

  1. "by passing" should be "by-passing"
  2. Add a comma after "for this option"
  3. Use "log out" instead of "logout" (it's a verb in this context)

Suggested revision:

-You can change the Home Assistant url the frontend connects to by passing the -c option. This will also work for existing production core instances. However, if you change the value for this option you will need to logout from your development frontend before it actually switches to the new value.
+You can change the Home Assistant URL the frontend connects to by by-passing the -c option. This will also work for existing production core instances. However, if you change the value for this option, you will need to log out from your development frontend before it actually switches to the new value.
🧰 Tools
🪛 LanguageTool

[misspelling] ~80-~80: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~80-~80: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~80-~80: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


86-91: Fix grammar and improve port forwarding explanation

  1. "setup" should be "set up" (it's a verb in this context)
  2. The port forwarding explanation could be clearer

Suggested revision:

-You can change the port the frontend is served on by passing the -p option. Note that if you are running from a devcontainer, you will need to setup
-port forwarding as well if you want to access it from the container host. For example:
+You can change the port the frontend is served on by passing the -p option. Note that if you are running from a devcontainer, you will need to set up
+port forwarding in your devcontainer configuration if you want to access it from the container host. For example:
🧰 Tools
🪛 LanguageTool

[grammar] ~86-~86: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d93755 and 07e41cd.

📒 Files selected for processing (1)
  • docs/frontend/development.md (2 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/frontend/development.md

[style] ~74-~74: In American English, “you” and “have” do not usually form a contraction unless they’re followed by a past participle.
Context: ... - http://localhost:8124 ``` After you've setup your frontend development environ...

(IVE_I_HAVE_AMERICAN_STYLE)


[uncategorized] ~74-~74: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)


[misspelling] ~80-~80: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~80-~80: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~80-~80: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


[grammar] ~86-~86: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

🪛 Markdownlint (0.37.0)
docs/frontend/development.md

74-74: null
Bare URL used

(MD034, no-bare-urls)


74-74: null
Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (2)
docs/frontend/development.md (2)

30-34: LGTM! Good improvement using tabs

The tabs implementation is a great improvement over numbered lists, making it easier for users to focus on their chosen configuration method.


74-78: ⚠️ Potential issue

Documentation references non-existent script

The documentation refers to script/develop_and_serve, but according to previous reviews, this script doesn't exist in the codebase. This needs to be addressed before the documentation can be merged.

🧰 Tools
🪛 LanguageTool

[style] ~74-~74: In American English, “you” and “have” do not usually form a contraction unless they’re followed by a past participle.
Context: ... - http://localhost:8124 ``` After you've setup your frontend development environ...

(IVE_I_HAVE_AMERICAN_STYLE)


[uncategorized] ~74-~74: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)

🪛 Markdownlint (0.37.0)

74-74: null
Bare URL used

(MD034, no-bare-urls)


74-74: null
Bare URL used

(MD034, no-bare-urls)

Comment on lines +74 to +91
After you've setup your frontend development environment so that you can run the `script/develop` script as described in section [Development](#development). You can use the following command as a replacement to develop and run the frontend on http://localhost:8124 and it will connect to the Home Assistant running on http://localhost:8123. Note that if you are running this command from a devcontainer, the url should be accessed from the container host.

```shell
script/develop_and_serve
```

You can change the Home Assistant url the frontend connects to by passing the -c option. This will also work for existing production core instances. It does not need to be a development version hosted locally. However, if you change the value for this option you will need to logout from your development frontend before it actually switches to the new value. For example:

```shell
script/develop_and_serve -c https://myhost.duckdns.org:8123
```

You can change the port the frontend is served on by passing the -p option. Note that if you are running from a devcontainer, you will need to setup
port forwarding as well if you want to access it from the container host. For example:

```shell
script/develop_and_serve -p 8654
```
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Documentation refers to a non-existent script

The documentation in docs/frontend/development.md refers to a script/develop_and_serve script that does not exist in the repository. The repository is actually a Docusaurus-based documentation site with different development commands:

  • The actual development server is started using npm run start:development or npm run start:devcontainer
  • The documented functionality about connecting to Home Assistant and port configuration is not present in the codebase
🔗 Analysis chain

Verify the development server implementation

Let's verify how the development server is actually implemented to ensure the documentation matches reality.


Let's gather more information by checking the actual script content and related files.


Let's check the docusaurus configuration and look for any development-related scripts in the root directory, as the script might be in a different location.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the actual implementation of the development server

# Look for development server related files and scripts
echo "Checking for development server scripts..."
fd -t f "develop.*serve|dev-server" 

# Check package.json for development scripts
echo "Checking package.json for development scripts..."
if [ -f "package.json" ]; then
    jq '.scripts | with_entries(select(.key | contains("develop")))' package.json
fi

# Look for webpack configurations
echo "Checking for webpack configurations..."
fd -t f "webpack.*config"

Length of output: 506


Script:

#!/bin/bash
# Check the content of the script/develop_and_serve
echo "Checking script/develop_and_serve content..."
cat script/develop_and_serve

# Look for any related development scripts
echo -e "\nChecking other development scripts..."
fd -t f "^develop" script/

# Check if there are any related configuration files
echo -e "\nChecking for configuration files..."
fd -t f "config|\.rc" -d 1

# Check docusaurus configuration since we saw docusaurus in package.json
echo -e "\nChecking docusaurus configuration..."
fd -t f "docusaurus\.config\.js"

Length of output: 588


Script:

#!/bin/bash
# Check docusaurus configuration content
echo "Checking docusaurus.config.js content..."
cat docusaurus.config.js

# Look for development scripts in the root directory
echo -e "\nChecking for development scripts in root..."
fd -t f "develop.*serve|develop" .

# Check if there are any npm/yarn scripts in package.json
echo -e "\nChecking complete package.json..."
cat package.json

Length of output: 6257

🧰 Tools
🪛 LanguageTool

[style] ~74-~74: In American English, “you” and “have” do not usually form a contraction unless they’re followed by a past participle.
Context: ... - http://localhost:8124 ``` After you've setup your frontend development environ...

(IVE_I_HAVE_AMERICAN_STYLE)


[uncategorized] ~74-~74: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...un the frontend on http://localhost:8124 and it will connect to the Home Assistant r...

(COMMA_COMPOUND_SENTENCE)


[misspelling] ~80-~80: The verb or noun ‘bypass’ is spelled as one word.
Context: ... Assistant url the frontend connects to by passing the -c option. This will also work for ...

(BY_PASS)


[uncategorized] ~80-~80: Possible missing comma found.
Context: ...wever, if you change the value for this option you will need to logout from your devel...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~80-~80: Did you mean the verb “log out” instead of the noun ‘logout’?
Context: ... value for this option you will need to logout from your development frontend before i...

(LOG_IN)


[grammar] ~86-~86: The word “setup” is a noun. The verb is spelled with a space.
Context: ...g from a devcontainer, you will need to setup port forwarding as well if you want to ...

(NOUN_VERB_CONFUSION)

🪛 Markdownlint (0.37.0)

74-74: null
Bare URL used

(MD034, no-bare-urls)


74-74: null
Bare URL used

(MD034, no-bare-urls)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants