Skip to content

Commit 836a4f4

Browse files
Merge pull request #859 from A-kirami/feat/engine-descriptor
feat: 添加 WebGAL 引擎描述文件规范实现
2 parents 200af92 + b0acd14 commit 836a4f4

3 files changed

Lines changed: 88 additions & 1 deletion

File tree

packages/webgal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "4.5.18",
44
"scripts": {
55
"dev": "vite --host --port 3000",
6-
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
6+
"build": "node scripts/update-engine-version.js && cross-env NODE_ENV=production tsc && vite build --base=./",
77
"preview": "vite preview",
88
"lint": "eslint src/** --fix",
99
"prepublishOnly": "npm run build"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "webgal",
3+
"version": "4.5.17",
4+
"type": "official",
5+
"webgalVersion": "4.5.17",
6+
"description": "界面美观、功能强大、易于开发的全新网页端视觉小说引擎",
7+
"descriptions": {
8+
"en": "A brand new web Visual Novel engine with a beautiful interface, powerful features, and easy development",
9+
"ja": "美しいインターフェース、強力な機能、簡単な開発を備えた全く新しいウェブビジュアルノベルエンジン",
10+
"ko": "시각적으로 매력적이며, 기능이 풍부하고, 쉽게 개발할 수 있는 새로운 웹 기반 비주얼 노벨 엔진",
11+
"fr": "Un moteur de visual novel basé sur le web, attrayant visuellement, riche en fonctionnalités et facile à développer"
12+
},
13+
"author": {
14+
"name": "Mahiru",
15+
"email": "Mahiru_@outlook.com"
16+
},
17+
"license": "MPL-2.0",
18+
"icon": "icons/icon-512.png",
19+
"readme": "README.md",
20+
"readmes": {
21+
"en": "README_EN.md",
22+
"ja": "README_JP.md",
23+
"ko": "README_KO.md",
24+
"fr": "README_FR.md"
25+
},
26+
"keywords": [
27+
"visual-novel",
28+
"galgame",
29+
"webgal",
30+
"game-engine",
31+
"web",
32+
"official",
33+
"original"
34+
],
35+
"live2dSupport": false,
36+
"spineSupport": false,
37+
"urls": {
38+
"homepage": "https://openwebgal.com",
39+
"repository": "https://github.com/OpenWebGAL/WebGAL",
40+
"bugs": "https://github.com/OpenWebGAL/WebGAL/issues",
41+
"documentation": "https://docs.openwebgal.com",
42+
"demo": "https://demo.openwebgal.com",
43+
"discord": "https://discord.gg/kPrQkJttJy"
44+
}
45+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* 自动更新 webgal-engine.json 中的版本号
5+
* 从 package.json 读取版本号并同步到 webgal-engine.json
6+
*/
7+
8+
const fs = require('fs');
9+
const path = require('path');
10+
11+
// 文件路径
12+
const packageJsonPath = path.resolve(__dirname, '../package.json');
13+
const engineJsonPath = path.resolve(__dirname, '../public/webgal-engine.json');
14+
15+
try {
16+
// 读取 package.json
17+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
18+
const version = packageJson.version;
19+
20+
if (!version) {
21+
console.error('❌ 错误: package.json 中未找到版本号');
22+
process.exit(1);
23+
}
24+
25+
// 读取 webgal-engine.json
26+
const engineJson = JSON.parse(fs.readFileSync(engineJsonPath, 'utf-8'));
27+
28+
// 更新版本号
29+
const oldVersion = engineJson.version;
30+
engineJson.version = version;
31+
engineJson.webgalVersion = version;
32+
33+
// 写回文件(保持格式化)
34+
fs.writeFileSync(engineJsonPath, JSON.stringify(engineJson, null, 2) + '\n', 'utf-8');
35+
36+
console.log('✅ 成功更新引擎描述文件版本号');
37+
console.log(` ${oldVersion}${version}`);
38+
console.log(` 文件: ${path.relative(process.cwd(), engineJsonPath)}`);
39+
} catch (error) {
40+
console.error('❌ 更新版本号失败:', error.message);
41+
process.exit(1);
42+
}

0 commit comments

Comments
 (0)