-
-
Notifications
You must be signed in to change notification settings - Fork 320
feat: 添加 WebGAL 引擎描述文件规范实现 #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
- 新增 webgal-engine.json 引擎描述文件,包含引擎元数据 - 新增 update-engine-version.js 脚本,自动同步版本号 - 修改构建流程,在构建前自动更新引擎描述文件版本 - 为第三方工具提供标准化的引擎识别和版本管理支持
Summary of ChangesHello @A-kirami, I'm Gemini Code Assist1! 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! 此拉取请求旨在实现 WebGAL 引擎描述文件规范(RFC v2.0),通过引入标准化的元数据描述文件 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe 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
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 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 👍 and 👎 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. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 实现了一个自动化脚本,用于在构建时同步 package.json 和 webgal-engine.json 的版本号,并添加了引擎描述文件 webgal-engine.json。这是一个很好的改进,遵循了 RFC 规范,提高了版本管理的一致性和自动化程度。代码整体实现清晰,错误处理也比较周全。我只在版本更新脚本中发现了一个可以优化的地方,即在版本号未变更时跳过文件写入操作,以避免不必要的 I/O。具体建议请见文件评论。
| const oldVersion = engineJson.version; | ||
| engineJson.version = version; | ||
| engineJson.webgalVersion = version; | ||
|
|
||
| // 写回文件(保持格式化) | ||
| fs.writeFileSync(engineJsonPath, JSON.stringify(engineJson, null, 2) + '\n', 'utf-8'); | ||
|
|
||
| console.log('✅ 成功更新引擎描述文件版本号'); | ||
| console.log(` ${oldVersion} → ${version}`); | ||
| console.log(` 文件: ${path.relative(process.cwd(), engineJsonPath)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
脚本目前即使版本号没有变化也会执行文件写操作。建议增加一个判断,当版本号相同时,跳过文件写入,并打印提示信息。这样可以避免不必要的文件 I/O 操作,并使脚本在版本未变更时也能提供清晰的输出。
const oldVersion = engineJson.version;
if (oldVersion === version && engineJson.webgalVersion === version) {
console.log(`ℹ️ 引擎描述文件版本号已是最新 (${version}),无需更新。`);
console.log(` 文件: ${path.relative(process.cwd(), engineJsonPath)}`);
} else {
engineJson.version = version;
engineJson.webgalVersion = version;
// 写回文件(保持格式化)
fs.writeFileSync(engineJsonPath, JSON.stringify(engineJson, null, 2) + '\n', 'utf-8');
console.log('✅ 成功更新引擎描述文件版本号');
console.log(` ${oldVersion} → ${version}`);
console.log(` 文件: ${path.relative(process.cwd(), engineJsonPath)}`);
}
🎯 PR 目的
实现 WebGAL 引擎描述文件规范(RFC v2.0),为引擎提供标准化的元数据描述,便于第三方工具识别和管理。
📦 主要变更
1. 新增引擎描述文件 (
webgal-engine.json)2. 新增版本同步脚本 (
update-engine-version.js)package.json读取版本号webgal-engine.json中的version和webgalVersion字段3. 修改构建流程
build脚本中添加版本同步步骤🎨 设计亮点
📚 相关文档
✅ 测试建议
npm run build验证版本同步脚本正常工作webgal-engine.json版本号是否正确更新