-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Open
A-kirami
wants to merge
1
commit into
OpenWebGAL:dev
Choose a base branch
from
A-kirami:feat/engine-descriptor
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "name": "WebGAL", | ||
| "version": "4.5.17", | ||
| "type": "official", | ||
| "webgalVersion": "4.5.17", | ||
| "description": "界面美观、功能强大、易于开发的全新网页端视觉小说引擎", | ||
| "descriptions": { | ||
| "en": "A brand new web Visual Novel engine with a beautiful interface, powerful features, and easy development", | ||
| "ja": "美しいインターフェース、強力な機能、簡単な開発を備えた全く新しいウェブビジュアルノベルエンジン" | ||
| }, | ||
| "author": { | ||
| "name": "Mahiru", | ||
| "email": "Mahiru_@outlook.com" | ||
| }, | ||
| "license": "MPL-2.0", | ||
| "icon": "icons/icon-512.png", | ||
| "urls": { | ||
| "homepage": "https://openwebgal.com", | ||
| "repository": "https://github.com/OpenWebGAL/WebGAL", | ||
| "bugs": "https://github.com/OpenWebGAL/WebGAL/issues", | ||
| "documentation": "https://docs.openwebgal.com", | ||
| "demo": "https://demo.openwebgal.com", | ||
| "discord": "https://discord.gg/kPrQkJttJy" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /** | ||
| * 自动更新 webgal-engine.json 中的版本号 | ||
| * 从 package.json 读取版本号并同步到 webgal-engine.json | ||
| */ | ||
|
|
||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| // 文件路径 | ||
| const packageJsonPath = path.resolve(__dirname, '../package.json'); | ||
| const engineJsonPath = path.resolve(__dirname, '../public/webgal-engine.json'); | ||
|
|
||
| try { | ||
| // 读取 package.json | ||
| const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); | ||
| const version = packageJson.version; | ||
|
|
||
| if (!version) { | ||
| console.error('❌ 错误: package.json 中未找到版本号'); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| // 读取 webgal-engine.json | ||
| const engineJson = JSON.parse(fs.readFileSync(engineJsonPath, 'utf-8')); | ||
|
|
||
| // 更新版本号 | ||
| 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)}`); | ||
| } catch (error) { | ||
| console.error('❌ 更新版本号失败:', error.message); | ||
| process.exit(1); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 操作,并使脚本在版本未变更时也能提供清晰的输出。