Skip to content

Conversation

@GoldGroove06
Copy link
Contributor

@GoldGroove06 GoldGroove06 commented Jul 14, 2025

uses tsc --noEmit to point out the issues in prebuild failing it in first place if having types error

currently the script is adding a 'use client' ---- not sure of how it helps or is it right way (can be removed)

we have faced problems of using rad ui in ssr comps, might be helpful in clearing those issues

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated the build process for UI components to use a new automated script, improving bundling and build reliability.
    • Added esbuild as a dependency to streamline component builds.
    • Simplified build commands and improved build orchestration.
  • Style
    • Minor formatting adjustment in a console warning message within the Accordion component (no functional impact).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Warning

Rate limit exceeded

@GoldGroove06 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 123232d and 853d93e.

📒 Files selected for processing (3)
  • .github/workflows/build-rad-ui.yml (1 hunks)
  • .github/workflows/release.yml (1 hunks)
  • package.json (2 hunks)

"""

Walkthrough

A new Node.js build script using esbuild was introduced to automate bundling of UI components, replacing the previous Rollup-based build process. The build orchestration in package.json was updated to use this new script, add esbuild as a dependency, and simplify the build steps. A minor whitespace change was made to a warning message in the Accordion component.

Changes

File(s) Change Summary
build-components.cjs Added new build script using esbuild to bundle UI components individually.
package.json Updated build scripts to use the new build script, added esbuild dependency, simplified workflow.
src/components/ui/Accordion/Accordion.tsx Added a trailing space to a console warning message.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant NPM as npm
    participant Script as build-components.cjs
    participant Esbuild as esbuild
    participant FS as File System

    Dev->>NPM: run build:components
    NPM->>Script: node build-components.cjs
    Script->>FS: Read src/components/ui/*
    Script->>Esbuild: Bundle each component .tsx
    Esbuild->>FS: Output bundled JS to dist/temp-cleanup
    Script->>NPM: Log success/failure
Loading

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • kotAPI

Poem

🐇
A hop and a skip, our build takes flight,
With esbuild's speed, the bundles are light.
Rollup retires, a new script appears,
Components now build with far fewer tears.
A whitespace tweak, a warning anew—
The codebase is fresh, and the carrots are too!

"""


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.

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 (3)
src/components/ui/Accordion/Accordion.tsx (1)

16-16: Remove trailing space from console warning message.

The trailing space at the end of the console.warn message appears to be unintentional and should be removed for consistency.

-    console.warn('Direct usage of Accordion is not supported. Please use Accordion.Root, Accordion.Item, etc. instead. ');
+    console.warn('Direct usage of Accordion is not supported. Please use Accordion.Root, Accordion.Item, etc. instead.');
build-components.cjs (2)

11-12: Consider using asynchronous file operations for better performance.

The script uses synchronous file system operations which could block the event loop. For better performance and scalability, consider using async operations.

-const components = fs.readdirSync(componentsPath)
-  .filter((file) => fs.statSync(path.join(componentsPath, file)).isDirectory());
+const components = await fs.promises.readdir(componentsPath);
+const componentDirs = [];
+for (const file of components) {
+  const stat = await fs.promises.stat(path.join(componentsPath, file));
+  if (stat.isDirectory()) {
+    componentDirs.push(file);
+  }
+}

Note: This would require wrapping the logic in an async function.


23-23: Document the external dependencies list for future maintenance.

The external dependencies list is hard-coded and may need updates as the project evolves. Consider adding a comment explaining why these specific packages are externalized.

-    external: ['react', 'react-dom', 'react/jsx-runtime'],
+    external: [
+      'react',           // Core React library
+      'react-dom',       // React DOM bindings
+      'react/jsx-runtime' // JSX runtime for React 17+
+    ],
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 63923c3 and 6685cae.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • build-components.cjs (1 hunks)
  • package.json (2 hunks)
  • src/components/ui/Accordion/Accordion.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
src/components/ui/Accordion/Accordion.tsx (3)
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.
Learnt from: kotAPI
PR: rad-ui/ui#1031
File: src/components/ui/Accordion/fragments/AccordionRoot.tsx:41-44
Timestamp: 2025-04-07T04:38:34.864Z
Learning: The Accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props like `value`, `defaultValue`, and `onValueChange`. When implementing controlled components, remember to: 1) Initialize state from defaultValue, 2) Update internal state when value changes (controlled mode), 3) Call onValueChange callback, and 4) Prevent internal state updates when in controlled mode.
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.tsx:0-0
Timestamp: 2024-12-12T08:22:59.375Z
Learning: The `Dropdown.Trigger` component is customizable and needs to be used with `Dropdown.Root`.
package.json (1)
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
🔇 Additional comments (1)
package.json (1)

59-59: LGTM: Updated to use the new esbuild-based build script.

The script change correctly points to the new build-components.cjs file, aligning with the PR objective to replace Rollup with esbuild.

Comment on lines +14 to +17
Promise.all(components.map(component => {
const entry = path.join(componentsPath, component, `${component}.tsx`);
const outfile = path.join(outDir, `${component}.js`);
return esbuild.build({
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add validation for entry file existence.

The script assumes all components follow the naming convention ${component}/${component}.tsx but doesn't validate that the entry file exists before attempting to build it. This could cause the entire build to fail if a component doesn't follow this convention.

Promise.all(components.map(component => {
  const entry = path.join(componentsPath, component, `${component}.tsx`);
+ if (!fs.existsSync(entry)) {
+   console.warn(`Skipping ${component}: Entry file ${entry} not found`);
+   return Promise.resolve();
+ }
  const outfile = path.join(outDir, `${component}.js`);
  return esbuild.build({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Promise.all(components.map(component => {
const entry = path.join(componentsPath, component, `${component}.tsx`);
const outfile = path.join(outDir, `${component}.js`);
return esbuild.build({
Promise.all(components.map(component => {
const entry = path.join(componentsPath, component, `${component}.tsx`);
if (!fs.existsSync(entry)) {
console.warn(`Skipping ${component}: Entry file ${entry} not found`);
return Promise.resolve();
}
const outfile = path.join(outDir, `${component}.js`);
return esbuild.build({
// ...rest of build options
});
}));
🤖 Prompt for AI Agents
In build-components.cjs around lines 14 to 17, the code assumes the entry file
`${component}/${component}.tsx` exists without validation, risking build failure
if missing. Add a check to verify the existence of the entry file before calling
esbuild.build. If the file does not exist, skip building that component or
handle the error gracefully to prevent the entire build from failing.

@kotAPI kotAPI merged commit 53edc92 into main Jul 15, 2025
7 checks passed
@kotAPI kotAPI deleted the build-improvements branch July 15, 2025 11:30
@coderabbitai coderabbitai bot mentioned this pull request Sep 13, 2025
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