refactor: 将版本号注入移至构建配置
This commit is contained in:
BIN
lightening.ico
BIN
lightening.ico
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,4 +0,0 @@
|
|||||||
version: 1.0.18
|
|
||||||
company_name: EGM
|
|
||||||
file_description: EGM Lightning Protection Calculator
|
|
||||||
product_name: Lightening
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""更新版本号脚本"""
|
"""更新版本号脚本"""
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -20,22 +19,6 @@ def increment_version(version: str) -> str:
|
|||||||
return version
|
return version
|
||||||
|
|
||||||
|
|
||||||
def update_index_html(version: str):
|
|
||||||
"""更新 webui/index.html 中的标题版本号"""
|
|
||||||
index_file = Path(__file__).parent / "webui" / "index.html"
|
|
||||||
content = index_file.read_text(encoding="utf-8")
|
|
||||||
|
|
||||||
# 替换标题中的版本号
|
|
||||||
new_content = re.sub(
|
|
||||||
r"<title>EGM 输电线路绕击跳闸率计算( v[\d.]+)?</title>",
|
|
||||||
f"<title>EGM 输电线路绕击跳闸率计算 v{version}</title>",
|
|
||||||
content
|
|
||||||
)
|
|
||||||
|
|
||||||
index_file.write_text(new_content, encoding="utf-8")
|
|
||||||
print(f"Updated version in {index_file} to v{version}")
|
|
||||||
|
|
||||||
|
|
||||||
def update_version_file(version: str):
|
def update_version_file(version: str):
|
||||||
"""更新 VERSION 文件"""
|
"""更新 VERSION 文件"""
|
||||||
version_file = Path(__file__).parent / "VERSION"
|
version_file = Path(__file__).parent / "VERSION"
|
||||||
@@ -66,7 +49,6 @@ def main():
|
|||||||
|
|
||||||
# 更新所有文件
|
# 更新所有文件
|
||||||
update_version_file(new_version)
|
update_version_file(new_version)
|
||||||
update_index_html(new_version)
|
|
||||||
create_metadata(new_version)
|
create_metadata(new_version)
|
||||||
|
|
||||||
print(f"Version updated: {current_version} -> {new_version}")
|
print(f"Version updated: {current_version} -> {new_version}")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>EGM 输电线路绕击跳闸率计算 v1.0.22</title>
|
<title>EGM 输电线路绕击跳闸率计算</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
@@ -15,7 +15,16 @@ export default defineConfig({
|
|||||||
vue({
|
vue({
|
||||||
template: { transformAssetUrls }
|
template: { transformAssetUrls }
|
||||||
}),
|
}),
|
||||||
quasar()
|
quasar(),
|
||||||
|
{
|
||||||
|
name: 'html-version',
|
||||||
|
transformIndexHtml(html) {
|
||||||
|
return html.replace(
|
||||||
|
/<title>EGM 输电线路绕击跳闸率计算( v[\d.]+)?<\/title>/,
|
||||||
|
`<title>EGM 输电线路绕击跳闸率计算 v${version}</title>`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|||||||
Reference in New Issue
Block a user