Skip to content

chore: standardize repository maintenance#869

Open
afc163 wants to merge 4 commits into
masterfrom
codex/standardize-rc-config
Open

chore: standardize repository maintenance#869
afc163 wants to merge 4 commits into
masterfrom
codex/standardize-rc-config

Conversation

@afc163

@afc163 afc163 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Redesign the README with a clearer package overview, badges, install command, usage examples, API notes, development commands, release instructions, and a subtle Ant Design ecosystem brand note.
  • Standardize repository maintenance config: test-utoo reusable CI, React Doctor, pinned CodeQL actions, Funding, Vercel, Surge fallback, and optional Cloudflare Pages preview.
  • Align docs output on docs-dist, replace legacy now.json with vercel.json, and add tsc / docs build scripts for local and preview validation.

Test Plan

  • npm install
  • npx prettier --check README.md package.json .dumirc.ts tsconfig.json vercel.json .github/FUNDING.yml .github/workflows/*.yml
  • npm run lint
  • npm run tsc
  • npm test -- --runInBand
  • npm run compile
  • npm run build
  • npx vercel build --yes

Summary by CodeRabbit

  • 新功能
    • 新增拉取请求预览部署:支持 Cloudflare Pages、Surge,并加入 React Doctor 校验流程。
  • CI
    • 新增只读触发的组件测试工作流,并更新 CodeQL 运行方式;同时调整既有测试工作流配置。
  • 文档
    • 重写并精简 README,更新安装/使用示例与 API、类型说明。
  • 构建与部署
    • 将文档构建输出与部署目录统一为 docs-dist,并按环境启用站点路径配置;新增 gh-pages 与 Vercel 配置,移除旧的 Now 配置。
  • 修复/维护
    • 更新忽略规则,新增格式化与类型检查脚本。

Refs ant-design/ant-design#58514

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
menu Ready Ready Preview, Comment Jun 26, 2026 7:08am

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

✅ Preview is ready!

PR preview ✅ Ready ✅ Ready
🔗 Preview https://react-component-menu-preview-pr-869.surge.sh
📝 Commit37170c7
⏱️ Build time83.772s
📦 Size2.0 MB (no change) · 93 files
🪵 LogsView logs
📱 MobileScan to open preview on mobile

↩️ Previous: ⚡️ 37170c7 · react-component-menu-preview-pr-869.surge.sh (open ↗) · 2026-06-26 07:06:24 UTC

🤖 Powered by surge-preview

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

构建输出切换到 docs-dist,站点路径按 GH_PAGES 调整,并更新了 README、预览部署、CI 工作流和仓库配置。

Changes

文档发布与自动化配置更新

Layer / File(s) Summary
构建输出与基础配置
.dumirc.ts, package.json, tsconfig.json, .gitignore, vercel.json
dumi 基础路径和公共路径按 GH_PAGES 切换,构建输出改为 docs-dist,相关脚本、TypeScript 输入、忽略项和 Vercel 配置同步更新。
README 与赞助信息
README.md, .github/FUNDING.yml
README 重写为新的标题、示例、API 表格和开发/发布说明,赞助配置缩减为 GitHub Sponsors 与 Open Collective。
预览部署工作流
.github/workflows/cloudflare-pages-preview.yml, .github/workflows/surge-preview.yml
Cloudflare Pages 和 Surge 预览工作流在 pull request 上运行,包含并发控制、密钥门控、构建步骤和 docs-dist 部署。
CI 与检查工作流
.github/workflows/react-component-ci.yml, .github/workflows/codeql.yml, .github/workflows/react-doctor.yml
新增可复用的 CI 工作流,CodeQL 触发与 action 版本更新,React Doctor 工作流也新增到仓库中。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • react-component/menu#739: 两个 PR 都改动了测试工作流委派到 react-component/rc-test 的 CI 连接方式。

Suggested reviewers

  • zombieJ

Poem

🐰 我跳进 docs-dist 的新门廊,
预览云朵排好队,轻轻上场。
菜单叶片翻新,月光也鼓掌,
兔子耳朵一抖,发布就开张。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了本次对仓库维护、文档和部署配置的标准化调整。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/standardize-rc-config

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.

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

Copy link
Copy Markdown
Contributor

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 updates the documentation configuration, migrates the build output directory to docs-dist, cleans up configuration files, and significantly rewrites the README. Additionally, it introduces a Vercel configuration and updates the package.json scripts. The review feedback suggests using cross-env in the gh-pages script to ensure cross-platform compatibility and recommends decoupling the documentation deployment from the postpublish script to prevent publishing pipeline issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread package.json
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"docs:deploy": "gh-pages -d docs-dist",
"gh-pages": "GH_PAGES=1 npm run docs:build && npm run docs:deploy",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Setting environment variables directly like GH_PAGES=1 is not cross-platform and will fail on Windows environments (e.g., in default Command Prompt or PowerShell).

To ensure cross-platform compatibility for all contributors, consider using cross-env.

Note: Please remember to add cross-env to your devDependencies (e.g., npm install --save-dev cross-env).

Suggested change
"gh-pages": "GH_PAGES=1 npm run docs:build && npm run docs:deploy",
"gh-pages": "cross-env GH_PAGES=1 npm run docs:build && npm run docs:deploy",

Comment thread package.json Outdated
"now-build": "npm run docs:build",
"prepublishOnly": "npm run compile && rc-np",
"postpublish": "tnpm sync @rc-component/menu",
"postpublish": "npm run gh-pages && tnpm sync @rc-component/menu",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Running documentation deployment (npm run gh-pages) inside the postpublish script can be problematic:

  1. It significantly slows down the publishing process for maintainers.
  2. It requires the publishing environment (or maintainer's local machine) to have write access to the repository's gh-pages branch, which might fail in automated CI/CD release pipelines or for certain maintainers.
  3. If the deployment fails, the npm publish command will exit with a non-zero code even though the package has already been successfully published to the registry.

It is generally recommended to decouple documentation deployment from the package publishing lifecycle and instead automate it via a GitHub Actions workflow triggered on pushes/merges to the main branch.

Suggested change
"postpublish": "npm run gh-pages && tnpm sync @rc-component/menu",
"postpublish": "tnpm sync @rc-component/menu",

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (282f38b) to head (37170c7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #869   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          26       26           
  Lines         734      734           
  Branches      205      205           
=======================================
  Hits          732      732           
  Misses          2        2           

☔ View full report in Codecov by Harness.
📢 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/react-doctor.yml (1)

9-13: 🔒 Security & Privacy | 🔵 Trivial

请移除 push 场景下的不必要写权限,遵循最小权限原则。

根据 millionco/react-doctor 官方文档,该 Action 仅需 contents: read 即可运行。pull-requests: writeissues: writestatuses: write 仅在需要在 PR 上发表评论或更新提交状态时必需。当工作流在 push 事件(如推送到主分支)触发时,这些写权限通常是不必要的。当前配置将写权限应用于所有 push 事件,扩大了 GITHUB_TOKEN 的攻击面。

建议将权限配置拆分:仅针对 pull_request 事件授予写权限,或为 push 事件定义仅包含 contents: read 的专用权限块。

建议的权限配置示例
permissions:
  contents: read # 默认仅保留读权限

# 针对需要写权限的 PR 事件进行覆盖
on:
  pull_request:
    permissions:
      contents: read
      pull-requests: write
      issues: write
      statuses: write
  push:
    permissions:
      contents: read
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/react-doctor.yml around lines 9 - 13, The workflow
permissions are too broad for push-triggered runs, so split the permissions in
react-doctor.yml to keep only contents: read for push while reserving
pull-requests: write, issues: write, and statuses: write for pull_request runs.
Update the workflow-level permissions block and the on: pull_request / on: push
configuration so the React Doctor action still has write access only when it
needs to comment or update statuses, using the existing permissions and
react-doctor job setup as the anchor points.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/react-component-ci.yml:
- Around line 6-8: Update the reusable workflow call in the test job to avoid
drift and overexposure of secrets: replace the current react-component/rc-test
workflow reference in the test job from the moving branch target to the pinned
SHA b8ebddc81ef706b50faff0242ab34ad8ecdd9a59, and remove secrets: inherit so
only the required CODECOV_TOKEN is passed explicitly via the test job’s secrets
block.

In `@README.md`:
- Line 112: Update the README prop table entry for overflowedIndicator so the
Default column matches the actual default used in Menu.tsx: change the generic
... to the string literal "..." and keep the description aligned with the
default value shown by the overflowedIndicator prop.
- Around line 130-153: `ItemType` 中 `type: 'submenu'` 的 `key` 限制为 string
需要补充原因说明,避免和 `type: 'item'` 允许 React.Key 的设计混淆。请在 `SubMenuType` 的 `key`
定义附近添加注释,明确这是为了匹配 `Menu` 组件的 `openKeys` / `defaultOpenKeys`(以及相关
`selectedKeys`)使用 string[] 的约束;同时保留 `MenuItemType` 使用 React.Key 的现状,并说明其在内部如
`onSelect` 处理时会统一转成 string。

In `@tsconfig.json`:
- Around line 16-17: TypeScript checking is pulling in the JavaScript config
file via the tsconfig.json include list, which will fail under tsc --noEmit
without allowJs. Update the tsconfig.json include configuration by removing
.fatherrc.js unless it must be type-checked, or alternatively enable allowJs in
compilerOptions if that file should stay included. Keep the fix localized to the
include/compilerOptions settings so the tsc check script stops hitting TS6504.

---

Nitpick comments:
In @.github/workflows/react-doctor.yml:
- Around line 9-13: The workflow permissions are too broad for push-triggered
runs, so split the permissions in react-doctor.yml to keep only contents: read
for push while reserving pull-requests: write, issues: write, and statuses:
write for pull_request runs. Update the workflow-level permissions block and the
on: pull_request / on: push configuration so the React Doctor action still has
write access only when it needs to comment or update statuses, using the
existing permissions and react-doctor job setup as the anchor points.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5d94616a-9097-4b0e-8dd8-ae31330ee3c7

📥 Commits

Reviewing files that changed from the base of the PR and between 282f38b and 679af40.

📒 Files selected for processing (14)
  • .dumirc.ts
  • .github/FUNDING.yml
  • .github/workflows/cloudflare-pages-preview.yml
  • .github/workflows/codeql.yml
  • .github/workflows/main.yml
  • .github/workflows/react-component-ci.yml
  • .github/workflows/react-doctor.yml
  • .github/workflows/surge-preview.yml
  • .gitignore
  • README.md
  • now.json
  • package.json
  • tsconfig.json
  • vercel.json
💤 Files with no reviewable changes (2)
  • now.json
  • .github/workflows/main.yml

Comment on lines +6 to +8
test:
uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
secrets: inherit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Resolved SHA for react-component/rc-test@main:"
gh api repos/react-component/rc-test/commits/main --jq '.sha'

echo
echo "Reusable workflow definition:"
gh api repos/react-component/rc-test/contents/.github/workflows/test-utoo.yml?ref=main --jq '.content' \
  | base64 -d \
  | sed -n '1,220p'

Repository: react-component/menu

Length of output: 809


请固定复用工作流版本并收窄 secrets 暴露面。

当前配置引用 @main 分支且使用 secrets: inherit,存在上游代码漂移风险和敏感信息过度暴露风险。经核实,上游工作流实际需要 CODECOV_TOKEN,建议锁定提交版本并仅传递该必要密钥。

具体建议:

  1. uses 版本锁定为 SHA:b8ebddc81ef706b50faff0242ab34ad8ecdd9a59
  2. 移除 secrets: inherit,改为显式配置 CODECOV_TOKEN
建议修改
  test:
    uses: react-component/rc-test/.github/workflows/test-utoo.yml@b8ebddc81ef706b50faff0242ab34ad8ecdd9a59
    secrets:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
🧰 Tools
🪛 zizmor (1.26.1)

[error] 7-7: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[warning] 7-7: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow

(secrets-inherit)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/react-component-ci.yml around lines 6 - 8, Update the
reusable workflow call in the test job to avoid drift and overexposure of
secrets: replace the current react-component/rc-test workflow reference in the
test job from the moving branch target to the pinned SHA
b8ebddc81ef706b50faff0242ab34ad8ecdd9a59, and remove secrets: inherit so only
the required CODECOV_TOKEN is passed explicitly via the test job’s secrets
block.

Source: Linters/SAST tools

Comment thread README.md Outdated
Comment thread README.md
Comment thread tsconfig.json
Comment on lines +16 to +17
"include": ["src", "docs", ".dumirc.ts", ".fatherrc.js"],
"exclude": ["node_modules", "lib", "es", "dist", "docs-dist", ".dumi"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does TypeScript emit error TS6504 when a .js file is explicitly listed in tsconfig include without allowJs enabled?

💡 Result:

Yes, TypeScript will emit error TS6504 if a.js file is explicitly included in the project via the tsconfig.json files or include arrays while allowJs is disabled [1][2][3]. When allowJs is set to false (the default), the TypeScript compiler restricts valid input files to supported extensions—specifically.ts,.tsx, and.d.ts [4][5][2]. If a.js file is explicitly provided to the compiler, either via the configuration file or directly as a command-line argument, TypeScript identifies it as a JavaScript file and raises TS6504, suggesting that the allowJs option should be enabled to process such files [6][2][7]. It is important to note that TypeScript ignores the tsconfig.json file if you pass specific source files as arguments directly to the tsc command-line tool [7][8]. In such cases, the compiler defaults to its internal settings (where allowJs is false), which will also trigger this error even if your configuration file has allowJs set to true [5][8]. To ensure your configuration is respected, you should run tsc without specifying individual files, allowing it to pick up the configuration automatically [7][8].

Citations:


include 中的 .fatherrc.js 将导致 tsc --noEmit 报错 TS6504

tsconfig.jsoninclude 字段显式包含了 JavaScript 文件 .fatherrc.js,但 compilerOptions 未启用 allowJs。TypeScript 默认禁止直接编译或检查 .js 文件,这会触发 TS6504 错误(“Did you mean to enable the 'allowJs' option?”),导致新的 tsc 检查脚本失败。

建议方案(二选一):

  1. 移除 JS 文件(推荐):如果无需对 .fatherrc.js 进行类型检查,将其从 include 中删除。
  2. 启用 JS 支持:在 compilerOptions 中添加 "allowJs": true(如需检查该 JS 文件)。
🔧 建议修改
-  "include": ["src", "docs", ".dumirc.ts", ".fatherrc.js"],
+  "include": ["src", "docs", ".dumirc.ts"],
📝 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
"include": ["src", "docs", ".dumirc.ts", ".fatherrc.js"],
"exclude": ["node_modules", "lib", "es", "dist", "docs-dist", ".dumi"]
"include": ["src", "docs", ".dumirc.ts"],
"exclude": ["node_modules", "lib", "es", "dist", "docs-dist", ".dumi"]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tsconfig.json` around lines 16 - 17, TypeScript checking is pulling in the
JavaScript config file via the tsconfig.json include list, which will fail under
tsc --noEmit without allowJs. Update the tsconfig.json include configuration by
removing .fatherrc.js unless it must be type-checked, or alternatively enable
allowJs in compilerOptions if that file should stay included. Keep the fix
localized to the include/compilerOptions settings so the tsc check script stops
hitting TS6504.

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