Skip to content

perf: uninstall classnames, install clsx#84

Merged
li-jia-nan merged 2 commits intomasterfrom
clsx-update
Sep 28, 2025
Merged

perf: uninstall classnames, install clsx#84
li-jia-nan merged 2 commits intomasterfrom
clsx-update

Conversation

@li-jia-nan
Copy link
Member

@li-jia-nan li-jia-nan commented Sep 27, 2025

Summary by CodeRabbit

  • 新特性

  • 重构

    • 统一类名合并实现(切换为更轻量的合并方案),提升一致性与可维护性
    • 精简与规范化组件类型与 SVG 样式设置,减少冗余同时保持界面与交互不变
  • 杂务

    • 调整依赖与类型声明配置(替换类名工具、添加/调整类型相关依赖)
    • 更新忽略规则,避免锁文件被提交

@vercel
Copy link

vercel bot commented Sep 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tour Ready Ready Preview Comment Sep 28, 2025 6:57am

@coderabbitai
Copy link

coderabbitai bot commented Sep 27, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

本次变更将项目中的 classnames 替换为 clsx,更新依赖与类型声明,新增 .gitignore 忽略 pnpm-lock.yaml,并在 Mask 组件补充类型与小幅重构;未引入新的控制流或对外 API 变更。

Changes

Cohort / File(s) Change Summary
Git 忽略规则
\.gitignore
新增忽略条目:pnpm-lock.yaml
依赖与类型声明
package.json
将依赖 classnames 替换为 clsx;添加/调整开发依赖(typescript@types/node,并对 @types/minimatch 做出调整/移除)。
React 组件:className 迁移与类型强化
src/Mask.tsx src/Tour.tsx src/TourStep/DefaultPanel.tsx
classNames(...) 全量替换为 clsx(...)Mask 标注为 React.FC<MaskProps>,并为 COVER_PROPS 增加 React.SVGAttributes<SVGRectElement> 类型注解;将部分 svg 宽高样式内联;不改变渲染逻辑或公开签名。

Sequence Diagram(s)

(本次变更为依赖与类名替换、类型注解与轻微重构,未引入新的控制流或组件交互,故无序列图。)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • fix: pannel to panel #85 — 也修改了 src/TourStep/DefaultPanel.tsx,涉及 className/面板类名相关变更,代码层面存在强关联。

Suggested reviewers

  • zombieJ

Poem

兔子细嗅代码香,clsx 换旧装;
忽略锁文件轻轻放,类型添上行。
遮罩小改添注释,渲染如常忙。
我跃过评审岗,鼓掌又蹦跶。 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed 标题简洁明了地概括了此次 PR 的主要改动,即移除 classnames 并安装 clsx 包,能够让团队成员快速了解核心变更。

📜 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 b76da55 and 1c9036f.

📒 Files selected for processing (2)
  • package.json (2 hunks)
  • src/TourStep/DefaultPanel.tsx (5 hunks)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Sep 27, 2025

😭 Deploy PR Preview 1c9036f failed. Build logs

🤖 By surge-preview

@gemini-code-assist
Copy link

Summary of Changes

Hello @li-jia-nan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a performance enhancement by migrating the project's class name utility from classnames to clsx. This change aims to improve runtime performance and reduce bundle size by leveraging clsx's more optimized approach to class string generation. The update also includes minor dependency adjustments and a .gitignore entry for pnpm-lock.yaml to align with potential pnpm usage.

Highlights

  • Performance Optimization: The project has migrated from using the classnames library to clsx for managing CSS classes, which is known for its smaller bundle size and faster execution.
  • Dependency Management: The package.json file has been updated to reflect the removal of classnames and the addition of clsx. Additionally, @types/node has been added to development dependencies, and @types/minimatch has been re-positioned.
  • Code Refactoring: All instances of classNames imports and usage have been replaced with clsx across src/Mask.tsx, src/Tour.tsx, and src/TourStep/DefaultPanel.tsx.
  • Build Configuration: The .gitignore file has been updated to include pnpm-lock.yaml, ensuring that pnpm lock files are not committed to the repository.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@socket-security
Copy link

socket-security bot commented Sep 27, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedclsx@​2.1.11001009678100

View full report

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully replaces the classnames library with clsx for better performance, which is a commendable optimization. The changes also introduce some nice code style improvements and dependency updates. I've found one minor typo in a CSS class name that I've suggested a fix for. Overall, this is a solid contribution.

@codecov
Copy link

codecov bot commented Sep 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.07%. Comparing base (64523d4) to head (1c9036f).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #84   +/-   ##
=======================================
  Coverage   99.07%   99.07%           
=======================================
  Files          10       10           
  Lines         217      217           
  Branches       96       98    +2     
=======================================
  Hits          215      215           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f724eff and b76da55.

📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • package.json (2 hunks)
  • src/Mask.tsx (4 hunks)
  • src/Tour.tsx (3 hunks)
  • src/TourStep/DefaultPanel.tsx (5 hunks)
⏰ 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: preview

@li-jia-nan li-jia-nan merged commit c25065a into master Sep 28, 2025
11 of 13 checks passed
@li-jia-nan li-jia-nan deleted the clsx-update branch September 28, 2025 06:55
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