Skip to content

Conversation

@JakeSCahill
Copy link
Contributor

@JakeSCahill JakeSCahill commented Jul 6, 2025

This pull request introduces significant updates to the build system by adopting esbuild for React bundling, improving the handling of JavaScript vendor files, and updating dependencies in package.json.

The migration to esbuild for React components was necessary because the latest @kapaai/react-sdk package uses dependencies that require ES modules support, which Browserify doesn't handle well. This hybrid approach gives us:

  • ES modules compatibility: esbuild properly processes ES modules used by the Kapa React SDK.
  • Performance improvement: esbuild is 10-100x faster than Browserify for React components.
  • Backward compatibility: Maintaining Browserify for non-React code ensures all existing functionality continues to work as expected. By only changing the bundling of React components, we've reduced the risk of introducing regressions.

This change supports our ongoing efforts to modernize our documentation UI while maintaining compatibility with our existing components and libraries.

Build System Improvements

  • Replaced browserify and babelify with esbuild for bundling React components in gulp.d/tasks/bundle-react.js. This change simplifies the build process, adds support for modern JavaScript features, and improves build performance. The new implementation also ensures compatibility with JSX and includes sourcemap generation.
  • Updated the gulp.d/tasks/build.js file to handle sorttable.js separately without applying uglify, ensuring better flexibility for specific vendor files.

Dependency Updates

  • Upgraded @asciidoctor/tabs from ^1.0.0-beta.5 to ^1.0.0-beta.6 and @kapaai/react-sdk from ^0.0.3 to ^0.3.0 in package.json. These updates bring in the latest features and fixes.
  • Added esbuild as a new dependency in package.json to support the updated React bundling process.

@netlify
Copy link

netlify bot commented Jul 6, 2025

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit ee4a2fa
🔍 Latest deploy log https://app.netlify.com/projects/docs-ui/deploys/686b871f6d45910008a4c924
😎 Deploy Preview https://deploy-preview-311--docs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 6, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes update the JavaScript build process in two main areas. First, the handling of vendor bundle files is adjusted so that sorttable.js is excluded from minification and processed separately, ensuring it remains unminified while other vendor bundles are still uglified. Second, the React component bundling task is refactored to use esbuild instead of Browserify and Babelify. This involves switching from a streaming build pipeline to an async, file-by-file build using esbuild's API, with updated error handling and logging. Additionally, package.json is updated to add esbuild as a development dependency and to update two other package versions.

Sequence Diagram(s)

Updated React Bundling Flow with esbuild

sequenceDiagram
    participant GulpTask as Gulp Task
    participant Glob as glob
    participant esbuild as esbuild
    participant FS as File System

    GulpTask->>Glob: Find all .js/.jsx files in srcDir
    Glob-->>GulpTask: Return list of entry files
    GulpTask->>FS: Ensure destDir exists
    loop For each entry file
        GulpTask->>esbuild: Build file with options (bundle, minify, sourcemap, etc.)
        alt Build succeeds
            esbuild-->>GulpTask: Success
            GulpTask->>FS: Write output file to destDir
        else Build fails
            esbuild-->>GulpTask: Error
            GulpTask->>GulpTask: Log error
        end
    end
    GulpTask-->>GulpTask: Complete when all builds finish
Loading

Suggested reviewers

  • kbatuigas

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

@JakeSCahill JakeSCahill changed the title Use esbuild and browserify Upgrade Kapa SDK Jul 6, 2025
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: 3

🧹 Nitpick comments (2)
gulp.d/tasks/build.js (1)

69-75: LGTM! Consider documenting why sorttable.js needs special handling.

The implementation correctly excludes sorttable.js from minification. This is a clean approach when dealing with vendor scripts that don't work correctly when minified.

Consider adding a comment explaining why sorttable.js requires special handling (e.g., minification breaks functionality, relies on specific formatting, etc.) to help future maintainers understand this exception.

gulp.d/tasks/bundle-react.js (1)

19-19: Consider using async glob for consistency.

Since the function is async, consider using the async version of glob to avoid blocking:

-  const entries = glob.sync(path.join(srcDir, '**/*.{js,jsx}'))
+  const { glob } = require('glob')
+  const entries = await glob(path.join(srcDir, '**/*.{js,jsx}'))
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cef9cf8 and c09082a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • gulp.d/tasks/build.js (1 hunks)
  • gulp.d/tasks/bundle-react.js (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
gulp.d/tasks/build.js (1)
gulp.d/tasks/build-preview-pages.js (1)
  • vfs (12-12)
gulp.d/tasks/bundle-react.js (2)
gulp.d/tasks/build.js (3)
  • require (17-17)
  • path (11-11)
  • fs (7-7)
gulpfile.js (7)
  • require (3-3)
  • require (7-7)
  • glob (22-26)
  • path (8-8)
  • log (6-6)
  • srcDir (15-15)
  • destDir (16-16)
🔇 Additional comments (2)
package.json (1)

26-26: Verify breaking changes in @kapaai/react-sdk upgrade

The bump from ^0.0.3 to ^0.3.0 likely includes breaking API changes—please confirm that all usages in your code match the new version’s API:

• src/js/react/AskAI.jsx
– Imported KapaProvider—verify its required props (e.g., config shape, required keys) haven’t changed.
• src/js/react/components/ChatInterface.jsx
– Imported useChat hook—check whether its signature or returned values (methods, state) differ in v0.3.0.

Review the SDK’s changelog or docs for any renamed exports, changed hook parameters, or updated initialization patterns and update these components accordingly.

gulp.d/tasks/bundle-react.js (1)

9-17: Excellent documentation!

The JSDoc comments clearly describe the function's purpose, parameters, and return value. The async function signature is appropriate for the esbuild operations.

coderabbitai bot added a commit that referenced this pull request Jul 6, 2025
Docstrings generation was requested by @JakeSCahill.

* #311 (comment)

The following files were modified:

* `gulp.d/tasks/bundle-react.js`
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 6, 2025

Note

Generated docstrings for this pull request at #312

JakeSCahill and others added 4 commits July 6, 2025 10:26
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Docstrings generation was requested by @JakeSCahill.

* #311 (comment)

The following files were modified:

* `gulp.d/tasks/bundle-react.js`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@JakeSCahill JakeSCahill requested review from a team and kbatuigas July 7, 2025 14:29
@JakeSCahill JakeSCahill merged commit fec0992 into main Jul 7, 2025
6 checks passed
@JakeSCahill JakeSCahill deleted the upgrade-kapa branch July 7, 2025 18:33
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.

3 participants