[Update] バージョン管理: package.json, tauri.conf.json, config.pyのバージョンを更新し、update_version.pyを追加

This commit is contained in:
misyaguziya
2025-11-25 00:22:23 +09:00
parent d22c6c8f0c
commit 54ec5ba45d
4 changed files with 69 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "vrct", "name": "vrct",
"private": true, "private": true,
"version": "0.0.0", "version": "3.3.2",
"type": "module", "type": "module",
"scripts": { "scripts": {
"setup-python": "install.bat", "setup-python": "install.bat",
@@ -14,14 +14,15 @@
"tauri-dev": "tauri dev", "tauri-dev": "tauri dev",
"task-kill": "python task_kill.py", "task-kill": "python task_kill.py",
"clean": "python clean.py", "clean": "python clean.py",
"dev": "npm run task-kill && npm run build-python && npm run dev-ui", "update-version": "python update_version.py",
"dev-cuda": "npm run task-kill && npm run build-python-cuda && npm run dev-ui", "dev": "npm run task-kill && npm run clean && npm run update-version && npm run build-python && npm run dev-ui",
"dev-ui": "npm-run-all --parallel vite tauri-dev", "dev-cuda": "npm run task-kill && npm run clean && npm run update-version && npm run build-python-cuda && npm run dev-ui",
"build": "npm run clean && npm run build-python && npm run vite-build && npm run tauri build", "dev-ui": "npm run task-kill && npm-run-all --parallel vite tauri-dev",
"build-cuda": "npm run clean && npm run build-python-cuda && npm run vite-build && npm run tauri build", "build": "npm run task-kill && npm run clean && npm run update-version && npm run build-python && npm run vite-build && npm run tauri build",
"release": "npm run build && python zip.py --zip_name VRCT.zip", "build-cuda": "npm run task-kill && npm run clean && npm run update-version && npm run build-python-cuda && npm run vite-build && npm run tauri build",
"release-cuda": "npm run build-cuda && python zip.py --zip_name VRCT_cuda.zip", "release": "npm run update-version && npm run build && python zip.py --zip_name VRCT.zip",
"release-all": "npm run release && npm run release-cuda" "release-cuda": "npm run update-version && npm run build-cuda && python zip.py --zip_name VRCT_cuda.zip",
"release-all": "npm run update-version && npm run release && npm run release-cuda"
}, },
"dependencies": { "dependencies": {
"@babel/standalone": "7.27.0", "@babel/standalone": "7.27.0",

View File

@@ -736,7 +736,7 @@ class Config:
def init_config(self): def init_config(self):
# Read Only # Read Only
self._VERSION = "3.3.1" self._VERSION = "0.0.0"
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
self._PATH_LOCAL = os_path.dirname(sys.executable) self._PATH_LOCAL = os_path.dirname(sys.executable)
else: else:

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "VRCT", "productName": "VRCT",
"version": "3.3.1", "version": "0.0.0",
"identifier": "com.vrct.app", "identifier": "com.vrct.app",
"build": { "build": {
"beforeDevCommand": "", "beforeDevCommand": "",
@@ -11,20 +11,25 @@
}, },
"app": { "app": {
"enableGTKAppId": false, "enableGTKAppId": false,
"windows": [{ "windows": [
"title": "VRCT", {
"center": true, "title": "VRCT",
"width": 450, "center": true,
"height": 220, "width": 450,
"minWidth": 400, "height": 220,
"minHeight": 200, "minWidth": 400,
"transparent": true, "minHeight": 200,
"decorations": false, "transparent": true,
"shadow": false "decorations": false,
}], "shadow": false
}
],
"security": { "security": {
"csp": null, "csp": null,
"capabilities": ["default", "vrct-capability"] "capabilities": [
"default",
"vrct-capability"
]
} }
}, },
"bundle": { "bundle": {

39
update_version.py Normal file
View File

@@ -0,0 +1,39 @@
import json
from pathlib import Path
def update_versions():
root = Path(__file__).parent
# package.jsonからバージョンを読み取る
with open(root / "package.json", "r", encoding="utf-8") as f:
package_json = json.load(f)
version = package_json["version"]
# tauri.conf.jsonを更新
tauri_conf_path = root / "src-tauri" / "tauri.conf.json"
with open(tauri_conf_path, "r", encoding="utf-8") as f:
tauri_conf = json.load(f)
tauri_conf["version"] = version
with open(tauri_conf_path, "w", encoding="utf-8") as f:
json.dump(tauri_conf, f, indent=4, ensure_ascii=False)
# config.pyを更新
config_path = root / "src-python" / "config.py"
with open(config_path, "r", encoding="utf-8") as f:
content = f.read()
# VERSION行を置換
import re
pattern = r'(self\._VERSION = ")[^"]+(")'
replacement = rf'\g<1>{version}\g<2>'
new_content = re.sub(pattern, replacement, content)
with open(config_path, "w", encoding="utf-8") as f:
f.write(new_content)
print(f"✓ バージョン {version} に更新しました")
if __name__ == "__main__":
update_versions()