umi icon indicating copy to clipboard operation
umi copied to clipboard

feat: 支持3.x的htmlSuffix、dynamicRoot配置

Open flgame opened this issue 9 months ago • 3 comments

https://github.com/umijs/umi/issues/12301

  1. 添加htmlSuffix配置,支持生成xxx.html静态文件及路由
  2. 添加dynamicRoot配置,支持任意目录部署

Summary by CodeRabbit

  • 新功能
    • 增加了 htmlSuffix 参数以支持自定义 HTML 文件后缀。
    • 支持 dynamicRoot 配置以处理动态根路径。
    • 添加了 isHtmlRoute 函数以检查路由是否为 HTML 路由。
    • 添加了 getHtmlPath 函数以根据路由路径生成 HTML 路径。
    • getExportHtmlData 函数中使用了 isHtmlRoutegetHtmlPath
    • 更新了模式定义以包括 htmlSuffixdynamicRoot 选项。
    • 修改了逻辑以处理相对 publicPathdynamicRoot 配置。
    • 更新了资源路径处理以考虑 dynamicRoot 配置。
    • 添加了处理基于 dynamicRootrouterBasepublicPath 的逻辑。
    • 修改了 onGenerateFiles 以将 htmlSuffix 传递给 getExportHtmlData
    • modifyRoutes 中添加了 htmlSuffix 处理以调整路由路径。
    • 添加了 modifyContextOpts 函数以使用 basename 修改上下文选项。

flgame avatar May 16 '24 12:05 flgame

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
umi ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 9:52am

vercel[bot] avatar May 16 '24 12:05 vercel[bot]

概览

这次更新的高层次变更是增强和优化了 exportStatic 功能。新增了 isHtmlRoutegetHtmlPath 函数来处理 HTML 路由和生成 HTML 路径,引入了 htmlSuffix 参数以支持 HTML 后缀。此外,还增加了对 dynamicRoot 配置的支持,改进了资源路径处理逻辑,并在生成文件时传递相关参数来调整路由路径和上下文选项。

变更

文件路径 更改摘要
packages/preset-umi/src/features/exportStatic/exportStatic.ts - 引入 sep 模块
- 新增 isHtmlRoute 函数和 getHtmlPath 函数
- 修改 getExportHtmlData 函数以使用新函数
- 增加 htmlSuffix 参数
- 更新 schema 定义
- 修改逻辑以处理 publicPathdynamicRoot 配置
- 更新资源路径处理逻辑
- 增加对 routerBasepublicPath 的处理逻辑
- 修改 markupArgs.headScripts
- 更新 onGenerateFiles 函数
- 新增 htmlSuffix 处理逻辑
- 新增 modifyContextOpts 函数

诗歌

🐰✨代码更新如春风,
路由优化显神通。
HTML 后缀添新意,
动态根目录更灵动。
静态导出更完善,
未来开发更轻松。
CodeRabbit 与你共进步,
代码世界乐无穷。


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 16 '24 12:05 coderabbitai[bot]

@fz6m 已解答并修改

flgame avatar May 23 '24 09:05 flgame