Update VersionTable to show MC version compatibility range

This commit is contained in:
CPTProgrammer 2026-07-10 08:37:23 +08:00
parent e8d4994cec
commit ef276b6ef4
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions

View File

@ -34,10 +34,11 @@
### VersionTable
- 每行MC 版本 | 构建产物文件名 | 源码文件名
- MC 版本来自 `minecraft_properties_dir` 目录文件名
- 每行MC 版本 | 兼容范围 | 构建产物文件名 | 源码文件名
- MC 版本与兼容范围由后端计算,版本范围计算逻辑封装在 `lib/utils/mcVersion.ts`,前后端共用
- 构建产物和源码分别匹配 `filename_format``source_filename_format`
- 全部只读展示
- 最后一个版本的兼容范围含泛匹配,显示格式:若覆盖完整的大版本则显示 `1.19.x` / `26.x` 等,否则显示 `1.20.1-1.20.3` 等具体范围。截止版本下拉框可编辑;下拉可选值取 Modrinth 与 CurseForge 元数据 API 返回的 MC 版本并集
- 已发布版本对比(平台差异)留到 PublishModal 第一页分别展示
- 切换 config 后后台解析期间Table 使用 Ant Design 自带的加载状态
### PublishModal

View File

@ -95,11 +95,14 @@
1. 读取 `{project_dir}/{project_properties_path}`,提取 `mod_version_field` 对应的值 → `version`
2. 扫描 `{project_dir}/{minecraft_properties_dir}/` 目录,获取所有 `${mc_version}.properties` 文件名 → `mc_version[]`
3. 遍历每个 `mc_version`
3. 对 `mc_version[]` 排序后计算每个版本的兼容范围:
- 非最后一个版本:范围为 `[当前版本, 下一个版本)`,如 `"1.19.1"``"1.19.1-1.19.2"`
- 最后一个版本:`< 26` 的版本用 `~` 匹配次版本号 `1.21.x``≥ 26` 的版本用 `^` 匹配主版本号 `26.x`截止版本由用户在下拉框中选择
4. 遍历每个 `mc_version`
- 用 `version``mc_version` 填入 `filename_format` 模板,生成构建产物文件名
- 用 `version``mc_version` 填入 `source_filename_format` 模板,生成源码文件名
- 检查 `{project_dir}/build/libs/` 下是否存在对应文件
4. 将所有匹配结果返回前端,由 VersionTable 展示MC 版本 | 构建产物 | 源码)
5. 将所有匹配结果返回前端,由 VersionTable 展示MC 版本 | 兼容范围 | 构建产物 | 源码)
### 4. 版本确认与发布