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

feat: support PsychicHttp v2 #29

Merged
merged 3 commits into from
Sep 1, 2024
Merged

feat: support PsychicHttp v2 #29

merged 3 commits into from
Sep 1, 2024

Conversation

BCsabaEngine
Copy link
Owner

@BCsabaEngine BCsabaEngine commented Sep 1, 2024

Summary by CodeRabbit

  • New Features

    • Introduced support for a new engine type, psychic2, enhancing functionality for PsychicHttp v2.
    • Added a new command-line option for psychic2, allowing for additional configurations.
    • Implemented a new PsychicHttpServer setup for the PSYCHIC2 platform.
  • Bug Fixes

    • Updated dependencies and scripts to improve performance and resolve potential issues.
  • Documentation

    • Enhanced README to clarify support for PsychicHttp v2 and updated command line options.
  • Chores

    • Incremented package version to 1.5.0 and updated related dependencies.

@BCsabaEngine BCsabaEngine linked an issue Sep 1, 2024 that may be closed by this pull request
Copy link

coderabbitai bot commented Sep 1, 2024

Walkthrough

The changes involve updates across various configuration files and source code to support the new psychic2 version of the PsychicHttp library. This includes updating Node.js versions in CI workflows, enhancing documentation, and expanding command-line options. Additionally, new environment configurations and templates were introduced in the ESP32 project, along with updates to testing methodologies and package dependencies.

Changes

Files Change Summary
.github/workflows/ci-dev.yaml, .github/workflows/ci-full.yaml Updated Node.js version from 20.16.0 to 20.17.0 in CI workflow configurations.
CHANGELOG.md Added a new version section (1.5) with updates on engine types and testing methodology changes.
README.md Enhanced documentation to include support for PsychicHttp v2 and updated command line options to reflect new engine types.
demo/esp32/platformio.ini Updated library dependencies to full URLs and introduced new environment configurations for psychic2.
demo/esp32/src/main.cpp Added new setup for PsychicHttpServer with conditional compilation for PSYCHIC2.
package.json Incremented version to 1.5.0, added a new script for psychic2, updated @types/node, and introduced a new dependency psychichttpserverV2.
package.script Introduced new command-line instructions for psychic2 mode, enhancing output file generation capabilities.
src/commandLine.ts Expanded ICopyFilesArguments interface to include psychic2 as a valid engine option.
src/cppCode.ts Added psychic2Template with enhanced handling for ETag and GZip configurations, modifying the getCppCode function to accommodate new logic.

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 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 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 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

@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 04c6bd4 and 1dc263c.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (10)
  • .github/workflows/ci-dev.yaml (1 hunks)
  • .github/workflows/ci-full.yaml (1 hunks)
  • CHANGELOG.md (1 hunks)
  • README.md (3 hunks)
  • demo/esp32/platformio.ini (1 hunks)
  • demo/esp32/src/main.cpp (1 hunks)
  • package.json (3 hunks)
  • package.script (1 hunks)
  • src/commandLine.ts (2 hunks)
  • src/cppCode.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/ci-full.yaml
Additional context used
Markdownlint
README.md

16-16: null
Blank line inside blockquote

(MD028, no-blanks-blockquote)

Additional comments not posted (31)
.github/workflows/ci-dev.yaml (1)

17-17: LGTM!

The Node.js version update from 20.16.0 to 20.17.0 is approved.

The change is minor and should not break the workflow. It may introduce new features, performance improvements, or bug fixes associated with the newer Node.js version, which could be beneficial for supporting PsychicHttp v2.

CHANGELOG.md (2)

3-5: LGTM!

The code changes are approved. The new version section (1.5) and sub-version (1.5.0) are correctly formatted and follow the existing changelog structure.


7-9: LGTM! The changes are significant.

The code changes are approved. The documented changes are significant and reflect the updates mentioned in the summary:

  • The new engine type (-e psychic2) for PsychicHttp v2 indicates an enhancement or expansion of functionality related to the engine types available.
  • Running tests with GitHub repos instead of packages may improve the testing process by allowing for more direct integration with source control.

These modifications reflect significant updates to the functionality and testing approach of the project.

demo/esp32/src/main.cpp (4)

69-102: LGTM!

The new conditional compilation block for the PSYCHIC2 platform is correctly implemented and follows the same structure as the existing blocks for other platforms.


77-79: LGTM!

The preprocessor directives are correctly implemented and serve as a safety check to ensure the correct number of files and the presence of an index file.

Also applies to: 81-83


89-89: LGTM!

The server setup and initialization are correctly implemented. The server is declared with the correct port and initialized in the setup() function. The initSvelteStaticFiles function is called to initialize static files for Svelte.

Also applies to: 98-99


92-96: LGTM!

The WiFi configuration is correctly implemented. The WiFi mode is set to station mode, and the connection is established using the credentials from the credentials.h file. The code handles the connection failure by entering an infinite loop, which is a common practice in embedded systems.

package.json (4)

3-3: LGTM! The version increment is appropriate.

The version has been incremented from 1.4.2 to 1.5.0, which follows semantic versioning. The minor version increment is suitable for adding new backwards compatible functionality.


33-33: LGTM! The new script addition is consistent.

The new dev:psychic2 script enhances the development capabilities by providing an alternative setup for testing or running the application. The script is consistent with the existing dev:psychic script, with the only difference being the environment flag -e psychic2.


58-58: LGTM! The dependency version update is a minor increment.

The @types/node dependency has been updated from ^22.5.1 to ^22.5.2, which is a minor version increment. This may include bug fixes or improvements. The caret ^ sign ensures that npm installs a version with the same major version.


53-53: LGTM! But verify the usage of the new dependency.

The addition of the new psychichttpserverV2 dependency suggests an expansion of the project's capabilities or support for new features related to the PsychicHttp library. The dependency name follows the naming convention of the existing psychichttpserver dependency, with the addition of V2 suffix, indicating a new version.

Verify that the new dependency is being used correctly in the codebase by running the following script:

src/commandLine.ts (3)

6-6: LGTM!

The code changes are approved.


23-23: LGTM!

The code changes are approved.


28-28: LGTM!

The code changes are approved.

package.script (9)

21-21: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag and gzip disabled.


22-22: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag disabled and gzip enabled.


23-23: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag disabled and gzip set to compiler.


24-24: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag enabled and gzip disabled.


25-25: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag and gzip enabled.


26-26: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag enabled and gzip set to compiler.


27-27: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag set to compiler and gzip disabled.


28-28: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag set to compiler and gzip enabled.


29-29: LGTM!

The command is correctly structured and specifies the appropriate options for generating the output file in the psychic2 mode with etag and gzip set to compiler.

demo/esp32/platformio.ini (4)

74-74: LGTM!

The change to use the full URL for the PsychicHttp library dependency enhances clarity and ensures that the specific source of the library is explicitly defined.


80-80: LGTM!

The changes to use the full URL for the PsychicHttp library dependency across various psychic environments enhance clarity and ensure that the specific source of the library is explicitly defined.

Also applies to: 87-87, 94-94, 102-102, 108-108, 115-115, 121-121, 128-128


132-136: LGTM!

The introduction of the new psychic2 environment configuration, along with the appropriate build_flags and lib_deps entries, supports the updated version of the PsychicHttp library.


138-190: LGTM!

The introduction of the new psychic2 environment configurations, along with the appropriate build_flags and lib_deps entries, supports the updated version of the PsychicHttp library and provides various options for enabling features like ETAG and GZIP.

README.md (1)

225-236: Approve updated command line options.

The update to the command line options table to include psychic2 as a valid engine option is accurate and reflects the new capabilities introduced with PsychicHttp v2. The table is well-structured and the addition fits seamlessly with the existing options.

src/cppCode.ts (3)

203-378: LGTM! The new psychic2Template enhances configurability and maintainability.

The introduction of the psychic2Template constant brings significant improvements to the codebase:

  • It incorporates additional conditional compilation directives for handling ETag and GZip configurations, allowing for more granular control over these features.
  • The template includes checks for the etag and gzip flags, generating warnings if these features are enabled or disabled, enhancing the clarity of the configuration.
  • The template defines constants for versioning and file counts, which were previously absent.
  • The handling of HTTP requests has been updated to include these new configurations, ensuring that the server responds correctly based on the specified settings.

Overall, the changes enhance the configurability and maintainability of the code, allowing for better handling of HTTP responses based on the defined settings. The code follows the existing patterns and is well-structured.


551-553: LGTM! The changes to getCppCode improve flexibility.

The modifications to the getCppCode function enhance the flexibility of the code generation process:

  • The function now accommodates the new psychic2Template, allowing it to generate code for the PsychicHttpServerV2 engine.
  • The introduction of the ternary operator to select between the three templates (psychic, psychic2, and asyncTemplate) based on the cmdLine.engine value is a concise and effective way to adapt the code generation process based on the specified engine.

These changes improve the adaptability of the code generation process and maintain a clean and readable structure.


551-553: LGTM! The changes to getCppCode do not affect its public interface.

The modifications to the getCppCode function do not alter its exported signature:

  • The function still accepts the same parameters (sources: CppCodeSources, filesByExtension: ExtensionGroups) and returns a string.
  • The changes are internal to the function, improving its flexibility and maintainability by accommodating the new psychic2Template.

As the public interface remains unchanged, the modifications do not impact the usage of the getCppCode function.

README.md Outdated Show resolved Hide resolved
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 1dc263c and acd7471.

Files selected for processing (1)
  • README.md (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • README.md

@BCsabaEngine BCsabaEngine merged commit 2e1c7b7 into main Sep 1, 2024
1 check passed
@BCsabaEngine BCsabaEngine deleted the 28-psychichttp-v2 branch September 1, 2024 18:15
@coderabbitai coderabbitai bot mentioned this pull request Sep 9, 2024
@coderabbitai coderabbitai bot mentioned this pull request Dec 6, 2024
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.

PsychicHttp V2
1 participant