picker icon indicating copy to clipboard operation
picker copied to clipboard

fix(resolve): Export generateConfig to fix pnpm module resolution

Open DanielChutkowskiJMMJ opened this issue 2 months ago • 6 comments

This PR exports the generateConfig helpers (momentGenerateConfig, dayjsGenerateConfig, etc.) from the main package entry point.

This change allows consumers to use a robust, top-level import: import { momentGenerateConfig } from '@rc-component/picker';

This is necessary to fix module resolution failures in strict package managers like pnpm, which cannot reliably handle the current deep-import pattern (rc-picker/lib/generate/moment).

Closes #949

Summary by CodeRabbit

发布说明

  • 新功能
    • 新增四个日期库生成配置的公开导出:Moment、Day.js、Date-fns 和 Luxon,方便用户直接使用这些配置与日期选择组件集成。
    • 将通用的配置类型(GenerateConfig)公开导出,便于类型安全的自定义与扩展。
    • 核心日期选择组件(Picker、RangePicker、PickerPanel)对外可见性保持不变,仅扩展了公共 API。

✏️ Tip: You can customize this high-level summary in your review settings.

DanielChutkowskiJMMJ avatar Nov 18 '25 17:11 DanielChutkowskiJMMJ

@DanielChutkowskiJMMJ is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Nov 18 '25 17:11 vercel[bot]

[!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

将四个 generateConfig(dateFnsGenerateConfig、dayjsGenerateConfig、luxonGenerateConfig、momentGenerateConfig)及类型 GenerateConfigsrc/generate 通过主入口导出,并在 src/generate/index.ts 中为四个实现添加对应的 re-export,消除对深层导入的依赖;未修改运行时逻辑。

Changes

Cohort / File(s) 变更摘要
主入口导出扩展
src/index.tsx
新增导入并导出:dateFnsGenerateConfigdayjsGenerateConfigluxonGenerateConfigmomentGenerateConfig 与类型 GenerateConfig;将原先的聚合导出替换为包含这些项的显式导出列表。
generate 模块 re-export
src/generate/index.ts
为四个具体实现添加 re-export:export { default as dateFnsGenerateConfig } from './dateFns'export { default as dayjsGenerateConfig } from './dayjs'export { default as luxonGenerateConfig } from './luxon'export { default as momentGenerateConfig } from './moment'

Sequence Diagram(s)

sequenceDiagram
  participant Consumer as 使用方
  participant PackageIndex as `@rc-component/picker` (index)
  participant GenerateIndex as src/generate
  participant Impl as date/moment/dayjs/luxon 模块

  Note over Consumer,PackageIndex `#D5F5E3`: 顶层导入替代深层导入
  Consumer->>PackageIndex: import { momentGenerateConfig } from '@rc-component/picker'
  PackageIndex->>GenerateIndex: 请求 re-export 的 symbol
  GenerateIndex->>Impl: 转发到具体实现模块 (./moment)
  Impl-->>GenerateIndex: 返回默认导出配置对象
  GenerateIndex-->>PackageIndex: 提供配置对象
  PackageIndex-->>Consumer: 返回配置对象

Estimated code review effort

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

  • 评审重点:
    • 确认 src/generate/* 各实现的默认导出名称与 re-export 匹配。
    • 校验 GenerateConfig 类型路径与导出声明正确、无命名冲突。
    • 测试顶层导入在常见包管理器(npm/pnpm/yarn)下解析正常。

"🐰 四路配置来相会,
主入口处不再藏,
pnpm 旅途少了坑,
深层导入成旧章,
小兔欢跳写新行! 🥕"

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确概括了主要改动:导出generateConfig以修复pnpm模块解析问题。
Linked Issues check ✅ Passed PR的代码改动完全满足#949中的所有编码要求:将generateConfig及其四个实现从生成文件导出到主入口点。
Out of Scope Changes check ✅ Passed 所有改动均直接对应#949的目标,未发现超出范围或无关的代码修改。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

📜 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 26e3328de284cbfb328ac70ddecb098e9fb99bf1 and 745bdd13948ef13ed10d3da54a61bba2a8e57e06.

📒 Files selected for processing (1)
  • src/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.tsx

[!TIP]

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions: | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

coderabbitai[bot] avatar Nov 18 '25 17:11 coderabbitai[bot]

Summary of Changes

Hello @DanielChutkowskiJMMJ, I'm Gemini Code Assist[^1]! 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 resolves module resolution issues, particularly for strict package managers like pnpm, by making several generateConfig helper functions directly exportable from the main package entry point. This modification simplifies import paths for consumers, allowing for more robust and straightforward module resolution.

Highlights

  • Module Export: The generateConfig helper functions (momentGenerateConfig, dayjsGenerateConfig, dateFnsGenerateConfig, and luxonGenerateConfig) are now directly exported from the main package entry point (src/index.tsx).
  • Improved Import Paths: Consumers can now use a robust, top-level import pattern, such as import { momentGenerateConfig } from '@rc-component/picker';, simplifying how these helpers are accessed.
  • Pnpm Module Resolution Fix: This change specifically addresses and fixes module resolution failures encountered in strict package managers like pnpm, which previously struggled with deep-import patterns.
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 :thumbsup: and :thumbsdown: 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.

[^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.

gemini-code-assist[bot] avatar Nov 18 '25 17:11 gemini-code-assist[bot]

@zombieJ, @afc163, @meet-student, @divyeshagrawal, could you please take a look when you have a moment? 🙂

DanielChutkowskiJMMJ avatar Nov 18 '25 17:11 DanielChutkowskiJMMJ

@zombieJ , @afc163 , @meet-student , @divyeshagrawal, do you think you will have time to take a look this week? 🙂

DanielChutkowskiJMMJ avatar Nov 27 '25 11:11 DanielChutkowskiJMMJ

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 98.80%. Comparing base (4e3723b) to head (745bdd1). :warning: Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #950   +/-   ##
=======================================
  Coverage   98.80%   98.80%           
=======================================
  Files          65       65           
  Lines        2680     2680           
  Branches      744      744           
=======================================
  Hits         2648     2648           
  Misses         29       29           
  Partials        3        3           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Nov 28 '25 02:11 codecov[bot]