Skip to content

chore: standardize repository maintenance#869

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

chore: standardize repository maintenance#869
afc163 wants to merge 10 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

  • New Features
    • 文档站点支持按环境自动调整基础路径与资源路径,并切换到统一的发布输出目录。
    • 新增预览发布与健康检查类的自动化工作流(含 Surge、React Doctor),并加强代码质量扫描流程。
  • Documentation
    • 重写 README,更新安装/使用示例与 API 说明,精简结构并补充类型/方法文档。
  • Bug Fixes
    • 调整构建与部署目录一致性(避免产物路径不匹配)。
    • 更新忽略规则,减少本地与构建输出干扰。

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 5:32pm

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

❌ Deploy failed

PR preview ❌ Failed ❌ Failed
🔗 Preview https://react-component-menu-preview-pr-869.surge.sh (may be unavailable)
📝 Commit970f8c6
🪵 LogsView logs
📋 Build log (last lines)
npm warn exec The following package was not found and will be installed: surge@0.27.4

   Running as afc163@gmail.com (Student)

        project: ./docs-dist
         domain: react-component-menu-preview-pr-869.surge.sh
           size: 93 files, 2.0 MB

   Aborted - you do not have permission to publish to react-component-menu-preview-pr-869.surge.sh

🤖 Powered by surge-preview

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

站点构建与发布配置改为 docs-dist,README 与赞助信息重写,GitHub Actions 的 CodeQL、测试、医生检查和 PR 预览工作流也同步更新。

Changes

文档站点与自动化更新

Layer / File(s) Summary
构建与发布配置
.dumirc.ts, package.json, tsconfig.json, .gitignore, vercel.json
GH_PAGES 切换的站点 base/publicPath、docs-dist 输出、脚本、编译输入范围、忽略项和 Vercel 构建配置一并更新。
README 与赞助信息
README.md, .github/FUNDING.yml
README 重写为新的标题、Highlights、安装/使用、API、ItemTypeRef、开发/发布和许可结构,赞助配置缩减为两个入口。
CI 与校验工作流
.github/workflows/codeql.yml, .github/workflows/react-component-ci.yml, .github/workflows/react-doctor.yml
CodeQL、可复用测试和 React Doctor 工作流更新了触发条件、权限与 action 版本。
PR 预览部署
.github/workflows/surge-preview.yml
Surge Preview 工作流在 PR 上按 SURGE_TOKEN 分支执行构建与预览发布,并使用 docs-dist 作为产物目录。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • zombieJ

Poem

我是一只兔子,跳进 docs-dist 的晨光里,
叼着 README 的新标题,轻轻落笔。
CI 咚咚跑过,像胡萝卜味的鼓点,
预览页在 PR 上眨了眨眼睛。
咻——部署完成,草叶都在笑。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
✨ Finishing Touches
🧪 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 Outdated
"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 (970f8c6).

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.

@socket-security

socket-security Bot commented Jun 26, 2026

Copy link
Copy Markdown

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​cross-env@​7.0.310010010082100

View full report

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/afc163s-projects?upgradeToPro=build-rate-limit

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