Skip to content

feat: esp-idf #43

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

Merged
merged 5 commits into from
Mar 31, 2025
Merged

feat: esp-idf #43

merged 5 commits into from
Mar 31, 2025

Conversation

BCsabaEngine
Copy link
Owner

@BCsabaEngine BCsabaEngine commented Mar 31, 2025

Summary by CodeRabbit

  • New Features

    • Introduced support for the ESP-IDF framework with a code generator.
    • Added a dedicated demo project showcasing ESP-IDF integration for ESP32.
  • Documentation

    • Updated release notes and package documentation to reflect ESP-IDF support.
  • Chores

    • Upgraded dependency versions and enhanced build configurations for improved developer experience.

Copy link

coderabbitai bot commented Mar 31, 2025

Walkthrough

This pull request introduces version 1.9.0 and adds native support for the esp-idf framework. The update includes changes to versioning and documentation in the root files, new demo project files under demo/esp32idf (including configuration for PlatformIO and an HTTP server implementation), updates to dependency versions and test scripts, and modifications to the code generator setup and its respective import in src/cppCode.ts.

Changes

File(s) Change Summary
CHANGELOG.md, README.md Added new version entry 1.9.0 with a feature description indicating that the code generator now supports the esp-idf framework. The README documentation now lists ESP-IDF as an available integration option and notes that the code generator for ESP-IDF is available starting with v1.9.0.
demo/esp32idf/ (all files: .gitignore, .vscode/extensions.json, README.md, include/placeholder.txt, platformio.ini, src/main.c) Introduced a new demo project for ESP32 development using ESP-IDF. This includes a gitignore configuration, recommended VS Code extension settings, a README outlining minimal project usage, a placeholder file in the include folder, a comprehensive PlatformIO configuration with multiple environments, and a main C file that implements an HTTP server using the ESP-IDF framework.
demo/svelte/package.json Updated several dependency versions (e.g., @typescript-eslint/*, eslint-plugin-svelte, flowbite-svelte-icons, and vite) for the demo svelte package.
package.json Updated the package version from 1.8.1 to 1.9.0, modified the test:all script to include an additional testing command for the esp32idf demo, and upgraded versions of several dependencies including @types/node, @typescript-eslint/*, and mime-types.
package.script Added multiple new command lines for the espidf environment. These commands run the code generator with various configurations (differing in etag and gzip options) to output header files into specific subdirectories within demo/esp32idf/include/.
src/cppCode.ts Modified the import for the esp-idf template by switching from ./template_espidf to ./cppCodeEspIdf and updated the syntax of the getTemplate function for consistency with TypeScript conventions.

Sequence Diagram(s)

sequenceDiagram
    participant A as app_main
    participant B as start_http_server
    participant C as initSvelteStaticFiles
    participant D as HTTP Server

    A->>B: Call start_http_server()
    B->>C: Initialize static file handlers
    B->>D: Configure and start HTTP server with SVELTEESP32_COUNT
    D-->>B: Confirmation (server port/info)
    B-->>A: Return control to app_main
    A->>A: Enter infinite loop (1s delay cycles)
Loading
sequenceDiagram
    participant Dev as Developer
    participant S as package.script
    participant G as Code Generator (tsx src/index.ts)
    participant O as Output Header File

    Dev->>S: Execute espidf command line
    S->>G: Run code generator command with espidf parameters
    G->>O: Generate header file with specified etag/gzip/cache settings
Loading

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@BCsabaEngine
Copy link
Owner Author

Used @karlp 's esp-idf example

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

🧹 Nitpick comments (5)
demo/esp32idf/include/placeholder.txt (1)

1-2: Placeholder Content Check

The file "placeholder.txt" correctly contains the placeholder text. Consider adding a brief comment or renaming the file in the future to better describe its role (e.g., "generated_headers.info") if it’s meant to indicate the location of generated header files.

demo/esp32idf/README.md (1)

1-9: README Documentation Clarity

The README provides a clear and concise overview of the minimalistic ESP-IDF project along with a well-formatted build command. For improved guidance, consider adding extra details about project configuration, troubleshooting tips, or references to ESP-IDF documentation for users unfamiliar with the environment.

demo/esp32idf/src/main.c (1)

1-14: HTTP Server implementation looks good with a minor consideration.

The HTTP server implementation looks solid. The configuration sets a large buffer for URI handlers (SVELTEESP32_COUNT + 99), which ensures plenty of handlers are available.

Consider adding error handling for the initSvelteStaticFiles() call to handle potential initialization failures:

- initSvelteStaticFiles(httpd);
+ esp_err_t err = initSvelteStaticFiles(httpd);
+ if (err != ESP_OK) {
+   printf("Failed to initialize static files: %s\n", esp_err_to_name(err));
+   return;
+ }
README.md (1)

13-15: Good addition of ESP-IDF documentation.

The README has been properly updated to include ESP-IDF in the list of supported frameworks, with a clear note about the version that introduced this feature.

There's a bare URL in line 13. Consider making it a proper markdown link:

- This npm package provides a solution for **inserting any JS client application into the ESP web server** (PsychicHttp and also ESPAsyncWebServer (https://github.com/ESP32Async/ESPAsyncWebServer) and ESP-IDF available, PsychicHttp is the default). For this, JS, html, css, font, assets, etc. files must be converted to binary byte array. Npm mode is easy to use and easy to **integrate into your CI/CD pipeline**.
+ This npm package provides a solution for **inserting any JS client application into the ESP web server** (PsychicHttp and also ESPAsyncWebServer ([https://github.com/ESP32Async/ESPAsyncWebServer](https://github.com/ESP32Async/ESPAsyncWebServer)) and ESP-IDF available, PsychicHttp is the default). For this, JS, html, css, font, assets, etc. files must be converted to binary byte array. Npm mode is easy to use and easy to **integrate into your CI/CD pipeline**.
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

13-13: Bare URL used
null

(MD034, no-bare-urls)

demo/esp32idf/platformio.ini (1)

8-48: Consider adding documentation comments for each environment

The environment configurations are well-structured with a clear naming convention that reflects different feature combinations (E for ETAG, G for GZIP, C for compiler). However, adding brief comments explaining the purpose of each environment would improve maintainability for future contributors.

 [env:idf]
+# Base configuration without any features enabled
 build_flags =
   -I include/_

 [env:idf_E]
+# Configuration with ETAG support enabled
 build_flags =
   -I include/e
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d901141 and f2adc77.

⛔ Files ignored due to path filters (3)
  • demo/svelte/dist/favicon.png.gz is excluded by !**/dist/**, !**/*.gz
  • demo/svelte/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • CHANGELOG.md (1 hunks)
  • README.md (1 hunks)
  • demo/esp32idf/.gitignore (1 hunks)
  • demo/esp32idf/.vscode/extensions.json (1 hunks)
  • demo/esp32idf/README.md (1 hunks)
  • demo/esp32idf/include/placeholder.txt (1 hunks)
  • demo/esp32idf/platformio.ini (1 hunks)
  • demo/esp32idf/src/main.c (1 hunks)
  • demo/svelte/package.json (2 hunks)
  • package.json (4 hunks)
  • package.script (1 hunks)
  • src/cppCode.ts (2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

13-13: Bare URL used
null

(MD034, no-bare-urls)

🔇 Additional comments (14)
demo/esp32idf/.gitignore (1)

1-10: Gitignore Patterns Verification

The .gitignore file is appropriate for the ESP-IDF demo project. It excludes typical build and configuration directories (e.g., .pio, .vscode) as well as specific files like src/credentials.h and header files in the include directory. Please verify that ignoring all header files (include/**/*.h) is intentional, as it might prevent trackable changes if headers are updated.

demo/esp32idf/.vscode/extensions.json (1)

1-10: VSCode Extensions Configuration

This configuration file effectively recommends the PlatformIO extension to ensure a streamlined development experience and explicitly excludes the unwanted cpptools extension pack. The file is correctly formatted and aligns with the project's ESP-IDF focus.

CHANGELOG.md (1)

3-8: Changelog Update for ESP-IDF Support

The new changelog entry for version 1.9.0 clearly documents the addition of the ESP-IDF code generator feature. Ensure that the documentation in this file remains consistent with the project README and other related files.

demo/esp32idf/src/main.c (1)

16-24: Main function uses standard ESP-IDF pattern.

The app_main function follows the common ESP-IDF pattern with an infinite loop to keep the main thread alive, which is appropriate for this embedded application.

README.md (1)

53-54: Example for ESP-IDF usage is well documented.

The command line example for ESP-IDF code generation is correctly documented, making it easy for users to understand how to use the new feature.

demo/svelte/package.json (1)

27-49: Dependencies updated to latest minor versions.

The dependency updates are good practice to keep up with bug fixes and improvements. All changes are to minor versions which should maintain compatibility.

src/cppCode.ts (2)

4-4: Updated import path for ESP-IDF template.

The import statement has been updated to reflect the new location of the ESP-IDF template implementation.


587-592: ESP-IDF template correctly integrated into template selection.

The ESP-IDF template has been properly integrated into the getTemplate function, making it available when the 'espidf' engine is specified.

demo/esp32idf/platformio.ini (1)

1-5: LGTM - Well-structured base configuration

The base environment configuration correctly sets up the ESP-IDF framework with the appropriate platform (espressif32) and board (lolin_s3_mini) settings.

package.json (4)

3-3: LGTM - Version bump aligns with new feature

The version bump from 1.8.1 to 1.9.0 appropriately reflects the addition of a significant new feature (ESP-IDF framework support).


34-34: LGTM - Test script updated to include ESP-IDF environment

The test:all script has been expanded to include the new ESP-IDF environment, ensuring comprehensive testing across all supported platforms.


58-60: LGTM - Minor dependency updates

The incremental updates to TypeScript-related dependencies are appropriate and maintain compatibility.


74-74:

❓ Verification inconclusive

Verify compatibility with mime-types major version update

The update from mime-types v2.1.35 to v3.0.1 represents a major version change that could potentially introduce breaking changes.


🌐 Web query:

What breaking changes were introduced in mime-types v3.0.0?

💡 Result:

The mime-types gem version 3.0.0 introduced several breaking changes for Ruby applications:

Major Breaking Changes

1. Ruby Version Requirement

  • Dropped support for Ruby versions below 2.0[1][3][7].

2. Registry Data Separation

  • MIME type registry data was moved to the mime-types-data gem[1][3][7]. This means:
    • Applications must now include both mime-types and mime-types-data as dependencies[1][7].
    • The columnar registry format became the primary format, replacing older registry styles[1][7].

3. License and Governance

  • Switched exclusively to the MIT license[1][3].
  • Added a formal code of conduct[1][3].

4. API Changes

  • Removed all methods deprecated in the 2.x series[3][7]:
    • Array-based and string-based MIME::Type initialization warnings became errors.
    • Legacy registry formats (v1) were eliminated[3].
  • MIME::Types::Loader::PATH replaced with MIME::Types::Data::PATH[3].
  • Caching now uses the data gem's version rather than the library version[3].

5. Structural Changes

  • The data_version attribute was removed[3].
  • Internal class methods were moved to separate files for better modularity[3].

Impact Summary

Applications upgrading to v3.0.0 needed to:

  1. Ensure Ruby ≥ 2.0 compatibility.
  2. Add mime-types-data as a dependency.
  3. Replace deprecated initialization methods.
  4. Update any hardcoded registry paths or version checks.

For JavaScript/Node.js implementations (unrelated to the Ruby gem), breaking changes in mime-types v3.0.0 included dropping Node < 18 support and removing CJS/module fallbacks[4][10][13].

Citations:


Action: Verify Node.js Runtime and Module Compatibility for mime-types v3.0.1

  • The upgrade from "mime-types": "^2.1.35" to "mime-types": "^3.0.1" is a major version change.
  • For Node.js, mime-types v3.x drops support for Node versions below 18. Please confirm that your project runs on Node.js v18 or later.
  • The v3 update also removes CommonJS/module fallbacks. Verify that any existing usage of module resolution in your codebase (especially if relying on CommonJS) is compatible with this change.
  • Ensure these conditions are met to avoid any runtime or module-loading issues.
package.script (1)

31-39: LGTM - Consistent implementation of ESP-IDF configurations

The added commands for ESP-IDF follow the same pattern as the existing environments, creating a complete set of configurations with different combinations of ETAG and GZIP settings. This maintains consistency and ensures all feature combinations are available to users.

@BCsabaEngine BCsabaEngine merged commit 7c3d607 into main Mar 31, 2025
4 checks passed
@BCsabaEngine BCsabaEngine deleted the chore/espidf branch March 31, 2025 19:30
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.

1 participant