Skip to content

refactor: Consolidate base configuration in .fatherrc.ts#9506

Open
zzjiaxiang wants to merge 2 commits intoant-design:masterfrom
zzjiaxiang:father
Open

refactor: Consolidate base configuration in .fatherrc.ts#9506
zzjiaxiang wants to merge 2 commits intoant-design:masterfrom
zzjiaxiang:father

Conversation

@zzjiaxiang
Copy link
Contributor

@zzjiaxiang zzjiaxiang commented Feb 24, 2026

提取出统一的配置,移除 input:src默认值不用写. 同时开启并发编译

Summary by CodeRabbit

  • Chores
    • 重构了构建配置的默认项管理,集中统一了各构建目标的默认设置以减少重复配置。
    • 该调整提升了配置一致性和可维护性,使后续修改和扩展更简单,运行行为对最终用户无可见变化。

- Introduced a baseConfig object to streamline esm and cjs configurations.
- Removed redundant input, platform, transformer, and targets definitions in both configurations.
- Enhanced maintainability and clarity of the configuration file.
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 24, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zzjiaxiang, 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!

此拉取请求通过将 .fatherrc.ts 配置文件中的通用构建设置集中到一个 baseConfig 对象中,对配置进行了重构。这一更改简化了 esmcjs 模块的配置,使其更易于维护和阅读。此外,它还激活了并发编译,预计将显著提升项目的整体构建性能。

Highlights

  • 配置重构: 提取了 esmcjs 模块的共同配置项,将其整合到 baseConfig 对象中,减少了重复代码,提高了配置的可维护性。
  • 并发编译: 在 baseConfig 中新增了 parallel: true 配置,启用了 Father 构建工具的并发编译功能,以提高构建效率。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .fatherrc.ts
    • 提取了 esmcjs 配置中的公共部分到 baseConfig
    • baseConfig 添加了 parallel: true 以启用并发编译。
    • 移除了 esmcjs 配置中重复的 input, platform, transformer, targets 字段,并使用 ...baseConfig 替代。
Activity
  • 没有检测到任何活动,例如评论或审查。
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.

@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d19e223 and fd3e288.

📒 Files selected for processing (1)
  • .fatherrc.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .fatherrc.ts

📝 Walkthrough

Walkthrough

.fatherrc.ts 中新增并使用共享的 baseConfig 对象,esmcjs 配置通过扩展运算符 ...baseConfig 引入默认字段,移除了这两处的重复字段声明;umd 配置保持不变。

Changes

Cohort / File(s) Summary
配置集中化
\.fatherrc\.ts
新增 baseConfig(包含 platform: 'browser', transformer: 'babel', parallel: true, targets 等),并在 esmcjs 配置中用 ...baseConfig 取代重复字段(input、platform、transformer、parallel、targets);umd 未改动。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 分钟

🐰 配置归一心欢喜,
baseConfig 展翅去飞翔,
扩展运算符轻轻点,
重复之患一扫空,
代码更洁净,维护更舒畅!✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确反映了主要变更:将 .fatherrc.ts 中的基础配置进行了整合,通过提取 baseConfig 对象来集中管理默认值。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@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

这次的 PR 重构了 father 的构建配置,通过提取 baseConfig 减少了重复代码,这对于可维护性是一个很好的提升。同时,开启了并发编译,应该能改善构建速度。我发现 CJS 构建配置中有一个潜在问题需要注意。

Comment on lines 25 to 28
cjs: {
input: 'src', // 默认编译目录
output: 'lib',
platform: 'browser', // 默认构建为 Node.js 环境的产物
transformer: 'babel', // 默认使用 esbuild 以获得更快的构建速度
targets,
...baseConfig,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

high

CJS 构建产物(lib 目录)通常是为 Node.js 环境准备的,package.json 中的 main 字段也指向了它。之前的配置中,CJS 的 platform 被设为 'browser',但注释却表明是用于 Node.js 环境。这次重构保留了 platform'browser' 的设定。

为了确保构建产物针对目标环境进行正确优化,建议为 CJS 构建显式地设置 platform: 'node'。由于 baseConfig 中已设置 platform: 'browser',你需要在 cjs 配置中覆盖它。

建议修改如下:

  cjs: {
    output: 'lib',
    ...baseConfig,
    platform: 'node',
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏗 scaffold size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant