Skip to content

Conversation

@kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented Aug 5, 2025

Summary by CodeRabbit

  • Chores

    • Simplified the pre-commit hook script for improved reliability and reduced dependency on user-specific configurations.
    • Enhanced build process with automated export generation and improved handling of TypeScript declaration files.
    • Updated TypeScript configuration to emit declaration files only.
    • Refactored build configuration to separately handle JavaScript and type declaration bundles.
    • Introduced new scripts to dynamically generate package export mappings and process component files.
    • Added a list of released components to support export generation.
  • Documentation

    • Streamlined the README by condensing the project description and removing detailed sections about technology stack, status, and distinguishing features.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

This change simplifies the .husky/pre-commit script by removing redundant shell initialization steps, making it more environment-agnostic. The README.md is streamlined by condensing the project description and removing several informational sections. The build process is enhanced by removing the static exports field from package.json and introducing a new script to dynamically generate it. Rollup configuration is updated to separately build JavaScript and TypeScript declaration files. The TypeScript config is adjusted to emit declaration files only. New scripts automate component processing and export generation, and a released components list is added.

Changes

Cohort / File(s) Change Summary
Pre-commit Hook Simplification
.husky/pre-commit
Removed redundant shebang and shell configuration sourcing; script is now minimal and environment-agnostic.
README Streamlining
README.md
Condensed project description; removed "Technology stack," "Status," and "What sets this apart" sections; minor formatting cleanup.
Package Configuration Updates
package.json
Removed static exports field; added build:generate-exports script; updated process-components to copy .js and .d.ts files; added rollup-plugin-dts dependency; integrated dynamic export generation into build.
Rollup Build Configuration
rollup.config.cjs
Refactored to separate JS and TypeScript declaration bundles; introduced dtsBundles using rollup-plugin-dts; combined exports array; simplified warning handling.
Dynamic Export Generation Script
scripts/generate-exports.cjs
Added new script to auto-generate exports field in package.json based on built components and theme files, supporting typings and tree shaking.
Released Components List
scripts/RELEASED_COMPONENTS.cjs
Added exported constant array listing released components for use in export generation.
Component Processing Script
scripts/process-components.cjs
Added new Node.js script to copy built component .js and .d.ts files from a temporary directory to the final components directory and clean up.
TypeScript Configuration Update
tsconfig.json
Added "emitDeclarationOnly": true to emit only .d.ts files without JavaScript output.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • GoldGroove06

Poem

A bunny hopped through scripts and docs,
Tidying up with gentle knocks.
Pre-commit now sleek and lean,
README’s words are crisp and clean.
Build scripts hum with fresh new might,
Types and exports shining bright! 🥕🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kotapi/5-aug-maintenance

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.

@kotAPI kotAPI linked an issue Aug 5, 2025 that may be closed by this pull request
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 (1)
README.md (1)

78-81: Inconsistent list formatting in “Credits and references” section

Line 80 reintroduces plain text after a numbered list item (Line 78), breaking Markdown list continuity and rendering unpredictably on some platforms. Align it with the list style and add a link for clarity.

-This project is tested with BrowserStack
+2. This project is tested with [BrowserStack](https://www.browserstack.com/)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f089588 and 8897085.

📒 Files selected for processing (2)
  • .husky/pre-commit (0 hunks)
  • README.md (2 hunks)
💤 Files with no reviewable changes (1)
  • .husky/pre-commit
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and...
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.

Applied to files:

  • README.md
📚 Learning: the accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props l...
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.

Applied to files:

  • README.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
README.md (1)

63-65: Extraneous blank line removed—looks good

Removing the superfluous blank line tightens the markdown section without affecting readability. No further action needed.

@kotAPI kotAPI changed the title Improvements and chores - 5 Aug 2025 Improvements and chores - 5 Aug 2025 [OFFICIAL TS SUPPORT] Aug 5, 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 (1)
rollup.config.cjs (1)

70-82: LGTM! Well-configured TypeScript declaration builds.

The DTS bundle configuration correctly mirrors the JS build structure and properly handles external dependencies.

Consider adding react/jsx-runtime to the external dependencies list for consistency with the JS bundles:

-        external: ['react', 'react-dom']
+        external: ['react', 'react-dom', 'react/jsx-runtime']
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8897085 and 40198ab.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json (4 hunks)
  • rollup.config.cjs (4 hunks)
  • scripts/generate-exports.cjs (1 hunks)
  • tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tsconfig.json
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.
📚 Learning: in npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their co...
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.

Applied to files:

  • scripts/generate-exports.cjs
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (11)
scripts/generate-exports.cjs (1)

1-38: Excellent documentation!

The comprehensive comment block clearly explains the script's purpose, benefits, and output format. This will greatly help future maintainers understand the automation.

package.json (5)

7-7: LGTM! Exports field prepared for dynamic generation.

The empty exports object correctly serves as a placeholder that will be populated by the generate-exports.cjs script during the build process.


21-21: LGTM! Updated to handle TypeScript declaration files.

The script correctly copies both .js and .d.ts files, supporting the new build process that generates type declarations.


23-23: LGTM! Export generation script properly integrated.

The new script is well-named and follows the established naming convention for build-related tasks.


26-26: LGTM! Export generation correctly integrated into build pipeline.

The export generation step is properly placed after component compilation, ensuring the exports are generated from the built artifacts.


102-102: rollup-plugin-dts version verified

Confirmed that ^6.2.1 is the latest published release as of March 2025. No changes needed.

rollup.config.cjs (5)

9-9: LGTM! Correct import for TypeScript declaration generation.

The destructured import efficiently imports only the needed dts function from the plugin.


27-27: LGTM! Good documentation improvement.

The comment clearly explains the purpose of the shared plugin instances section, improving code organization.


44-44: LGTM! Clear separation of JS and TS builds.

The explicit jsBundles naming improves code clarity and prepares for the dual-build architecture.

Also applies to: 68-68


49-49: LGTM! Cleaner warning suppression logic.

The simplified conditional maintains the same functionality while being more concise.


84-84: LGTM! Proper combination of build configurations.

The spread operator correctly combines both JS and TypeScript declaration builds into a single configuration array for Rollup.

Comment on lines +50 to +51
exportsMap['./themes/default.css'] = './dist/themes/default.css';
exportsMap['./themes/tailwind-presets/default.js'] = './dist/themes/tailwind-presets/default.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify hardcoded theme file paths exist.

Ensure these theme files are actually generated during the build process.


🏁 Script executed:

#!/bin/bash
# Check if the hardcoded theme files exist in the expected locations
echo "Checking for theme files..."
if [ -f "dist/themes/default.css" ]; then
    echo "✅ dist/themes/default.css exists"
else
    echo "❌ dist/themes/default.css not found"
fi

if [ -f "dist/themes/tailwind-presets/default.js" ]; then
    echo "✅ dist/themes/tailwind-presets/default.js exists"
else
    echo "❌ dist/themes/tailwind-presets/default.js not found"
fi

Length of output: 348


Missing generated theme files in exports map

The hardcoded entries in scripts/generate-exports.cjs reference dist/themes/default.css and dist/themes/tailwind-presets/default.js, but neither file exists after the build. Please either:

  • Update the build to emit these files at the expected paths
  • Or adjust the exportsMap keys/values to match the actual output filenames

Files to fix:

  • scripts/generate-exports.cjs (around lines 50–51)
🤖 Prompt for AI Agents
In scripts/generate-exports.cjs around lines 50 to 51, the exportsMap references
files that do not exist after the build. To fix this, verify the actual output
filenames and paths generated by the build process and update the exportsMap
keys and values accordingly to match those real output files, or modify the
build configuration to emit the missing files at the expected paths.

kotAPI and others added 4 commits August 5, 2025 22:33
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 (1)
scripts/process-components.cjs (1)

39-59: Eliminate code duplication in file processing loops.

The two loops for .js and .d.ts files are nearly identical and can be consolidated to improve maintainability.

Apply this diff to consolidate the loops:

-// Copy .js files
-files.forEach(file => {
-    if (file.endsWith('.js')) {
-        const sourcePath = path.join(tempCleanupPath, file);
-        const destPath = path.join(componentsPath, file);
-        fs.copyFileSync(sourcePath, destPath);
-        copiedFiles++;
-        console.log(`📄 Copied: ${file}`);
-    }
-});
-
-// Copy .d.ts files
-files.forEach(file => {
-    if (file.endsWith('.d.ts')) {
-        const sourcePath = path.join(tempCleanupPath, file);
-        const destPath = path.join(componentsPath, file);
-        fs.copyFileSync(sourcePath, destPath);
-        copiedFiles++;
-        console.log(`📄 Copied: ${file}`);
-    }
-});
+// Copy .js and .d.ts files
+files.forEach(file => {
+    if (file.endsWith('.js') || file.endsWith('.d.ts')) {
+        const sourcePath = path.join(tempCleanupPath, file);
+        const destPath = path.join(componentsPath, file);
+        fs.copyFileSync(sourcePath, destPath);
+        copiedFiles++;
+        console.log(`📄 Copied: ${file}`);
+    }
+});
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a0344e4 and 8e35965.

📒 Files selected for processing (2)
  • package.json (4 hunks)
  • scripts/process-components.cjs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.
📚 Learning: in npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their co...
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.

Applied to files:

  • scripts/process-components.cjs
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (8)
scripts/process-components.cjs (3)

1-15: Excellent documentation and clear rationale.

The comprehensive documentation clearly explains the purpose, benefits, and rationale for this approach over shell commands. This will help future maintainers understand the design decisions.


17-33: Good path resolution and error handling.

The script properly resolves paths relative to the script location and handles missing directories gracefully with informative logging.


61-67: Proper cleanup and informative logging.

The cleanup process uses appropriate options (recursive: true, force: true) and provides helpful summary information for build processes.

package.json (5)

21-21: Good migration from shell to Node.js script.

The change from shell command to Node.js script improves cross-platform compatibility and error handling, as documented in the process-components.cjs file.


23-23: New script for dynamic export generation.

The addition of build:generate-exports supports the dynamic generation of the exports field, which should improve maintainability over static definitions.


26-26: Proper integration of export generation step.

The build:rollup script correctly includes the new build:generate-exports step to ensure the exports field is populated after component processing.


102-102: rollup-plugin-dts version is up to date

The devDependency "rollup-plugin-dts": "^6.2.1" uses the latest stable release (6.2.1) for bundling TypeScript declaration files, so no changes are needed.


7-7: Exports Automation Verified

The scripts/generate-exports.cjs script exists, is referenced by the build:generate-exports task in package.json, and calls fs.writeFileSync on package.json to populate the exports field. It’s also chained into the build:rollup script, ensuring exports are regenerated on each build. No additional changes are needed.

@kotAPI kotAPI merged commit 49e6d53 into main Aug 5, 2025
7 checks passed
@kotAPI kotAPI deleted the kotapi/5-aug-maintenance branch August 5, 2025 17:23
Segundavid-Dev pushed a commit to Segundavid-Dev/ui that referenced this pull request Aug 6, 2025
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

Better zsh config for linux based environment precommit hooks

2 participants