Skip to content

Conversation

SutuSebastian
Copy link
Collaborator

@SutuSebastian SutuSebastian commented Aug 11, 2025

Summary by CodeRabbit

  • Bug Fixes

    • CLI plugin setup now correctly detects Bun.build-style configs so the Flowbite React Bun plugin is imported and added to the plugins list.
  • Tests

    • Added unit test coverage for Bun.build-style configurations to validate plugin injection and integration.
  • Documentation

    • Manual setup guide updated to use a non-interactive Bun init command that preconfigures React + Tailwind.
  • Chores

    • Added a patch release entry for Flowbite React.

@SutuSebastian SutuSebastian requested a review from rluders August 11, 2025 13:19
@SutuSebastian SutuSebastian self-assigned this Aug 11, 2025
@SutuSebastian SutuSebastian added the 🐛 bug Something isn't working label Aug 11, 2025
Copy link

changeset-bot bot commented Aug 11, 2025

🦋 Changeset detected

Latest commit: 9336ab1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
flowbite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Aug 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2025 1:41pm
flowbite-react-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2025 1:41pm

Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The updateBuildConfig utility now recognizes Bun.build() calls in addition to build() when injecting a plugin and import. A new unit test covers Bun.build-style configs. A changeset marks a patch release noting Bun.build detection. The Bun docs guide now uses a non-interactive bun init --react=tailwind command.

Changes

Cohort / File(s) Summary
Build config update logic
packages/ui/src/cli/utils/update-build-config.ts
Extend detection to handle Bun.build() alongside build(); preserve plugin import/injection and de-duplication logic; update explanatory comment.
Unit tests for Bun.build config
packages/ui/src/cli/utils/update-build-config.test.ts
Add test ensuring import insertion and plugins array update when config uses Bun.build(...).
Changeset entry
.changeset/many-nights-nail.md
Add patch release note: UI CLI plugin setup now detects Bun.build.
Bun docs
apps/web/content/docs/guides/bun.mdx
Change manual setup step to use non-interactive bun init --react=tailwind and remove interactive prompt screenshots/steps.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant CLI as updateBuildConfig
  participant Parser as AST Parser
  participant File as build.config.ts

  Dev->>CLI: run updateBuildConfig(File, pluginName, importPath)
  CLI->>Parser: parse File to AST
  Parser-->>CLI: AST
  CLI->>CLI: detect call to build() or Bun.build()
  alt Detected
    CLI->>CLI: ensure import for plugin is present
    CLI->>CLI: ensure plugins array includes plugin (de-duplicated)
    CLI->>File: write updated config
  else Not detected
    CLI-->>Dev: no changes
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

confirmed

Suggested reviewers

  • rluders
  • tulup-conner

Poem

I twitch my nose at Bun’s new build,
A hop, a skip—our plugins filled.
Import seeds neatly sown in rows,
The config garden calmly grows.
Thump-thump! The tests all pass—what fun! 🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2d47223 and 9336ab1.

📒 Files selected for processing (1)
  • apps/web/content/docs/guides/bun.mdx (1 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ui/plugins/bun-plugin

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

Support

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

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 generate unit tests to generate unit tests for 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.

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

🧹 Nitpick comments (3)
.changeset/many-nights-nail.md (1)

5-5: Polish wording for clarity/tense

Consider tightening the message:

  • Current: fix(ui/cli/plugins): setup-plugin-bun also detect Bun.build
  • Suggested: fix(ui/cli/plugins): setup-plugin-bun also detects Bun.build()
-fix(ui/cli/plugins): `setup-plugin-bun` also detect `Bun.build`
+fix(ui/cli/plugins): setup-plugin-bun also detects Bun.build()
packages/ui/src/cli/utils/update-build-config.ts (1)

43-51: Harden callee detection: computed access and optional chaining (Bun['build'], Bun?.build)

Edge cases not currently recognized:

Also, plain Identifier build(...) could match non-Bun functions in rare cases. If you want to be stricter, confirm build is imported from "bun" (including alias).

Minimal change within this block to support computed access and optional chaining:

-      // Check if this is a build() or Bun.build() call
-      if (
-        ((node.callee.type === "Identifier" && node.callee.name === "build") ||
-          (node.callee.type === "MemberExpression" &&
-            node.callee.object.type === "Identifier" &&
-            node.callee.object.name === "Bun" &&
-            node.callee.property.type === "Identifier" &&
-            node.callee.property.name === "build")) &&
+      // Check if this is a build() or Bun.build()/Bun["build"] call (incl. optional chaining)
+      const callee =
+        node.callee.type === "ChainExpression" ? node.callee.expression : node.callee;
+      if (
+        ((callee.type === "Identifier" && callee.name === "build") ||
+          (callee.type === "MemberExpression" &&
+            callee.object.type === "Identifier" &&
+            callee.object.name === "Bun" &&
+            (
+              (callee.property.type === "Identifier" && callee.property.name === "build") ||
+              (callee.property.type === "Literal" && callee.property.value === "build")
+            ))) &&
         node.arguments.length > 0 &&
         node.arguments[0].type === "ObjectExpression"
       ) {

Follow-up (optional): cross-check that an Identifier build comes from import ... from "bun" (and support alias import) to reduce false positives. I can sketch that if useful.

packages/ui/src/cli/utils/update-build-config.test.ts (1)

94-120: Add a couple more cases to harden behavior (optional)

Consider adding:

  • Bun"build" to cover computed access.
  • Alias import: import { build as bunBuild } from "bun"; await bunBuild({...}); to ensure Identifier checks work with aliases (if/when supported in code).

Example test sketch:

it("should handle config with Bun['build']", () => {
  const input = `
    const result = await Bun["build"]({
      plugins: [],
    });
  `;
  const result = updateBuildConfig({
    content: input,
    pluginName: "flowbiteReact",
    pluginImportPath: "flowbite-react/plugin/bun",
  });
  expect(result).toContain('import flowbiteReact from "flowbite-react/plugin/bun"');
  expect(result).toMatch(/plugins:\s*\[\s*flowbiteReact\s*\]/);
});

it("should handle aliased build import from bun", () => {
  const input = `
    import { build as bunBuild } from "bun";
    const result = await bunBuild({ plugins: [] });
  `;
  const result = updateBuildConfig({
    content: input,
    pluginName: "flowbiteReact",
    pluginImportPath: "flowbite-react/plugin/test",
  });
  expect(result).toContain('import flowbiteReact from "flowbite-react/plugin/test"');
  expect(result).toMatch(/plugins:\s*\[\s*flowbiteReact\s*\]/);
});
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0018bc6 and 2d47223.

📒 Files selected for processing (3)
  • .changeset/many-nights-nail.md (1 hunks)
  • packages/ui/src/cli/utils/update-build-config.test.ts (1 hunks)
  • packages/ui/src/cli/utils/update-build-config.ts (1 hunks)
🔇 Additional comments (2)
packages/ui/src/cli/utils/update-build-config.ts (1)

43-51: LGTM: Bun.build() detection added correctly

The callee check now handles both build(...) and Bun.build(...). This aligns with the PR goal and keeps downstream plugin insertion unchanged.

packages/ui/src/cli/utils/update-build-config.test.ts (1)

94-120: Good coverage for Bun.build() path

The test validates both the added import and plugin injection order with Bun.build. Matches the updated logic.

@SutuSebastian SutuSebastian merged commit 50ae2ee into main Aug 11, 2025
8 checks passed
@SutuSebastian SutuSebastian deleted the fix/ui/plugins/bun-plugin branch August 11, 2025 13:42
@github-actions github-actions bot mentioned this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant