Skip to content

Commit d42bccf

Browse files
Pigbibiclaude
andcommitted
fix: build_config.py 幂等化,消除每次运行累加空白行
- 添加空白行折叠(≥4空行→2空行),确保多次运行输出一致 - 修复 regex 模式匹配 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3351d9b commit d42bccf

3 files changed

Lines changed: 5 additions & 44 deletions

File tree

scripts/build_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def inject_into_index_html(config: dict) -> None:
179179
# Generate platform JS
180180
js_block = build_platform_meta_js(config)
181181

182-
# Remove ALL old hardcoded platform blocks (count=0 = replace all)
182+
# Remove ALL old hardcoded platform blocks (count=0 = replace all).
183183
for pattern in [
184184
r" const defaultRepositories = \{[\s\S]*?\n \};\n(?:\s*// Alias for backward compatibility\n\s*const defaultRepositories = platformRepositories;\n)?",
185185
r" const platformRepositories = \{[\s\S]*?\n \};\n(?:\s*// Alias for backward compatibility\n\s*const defaultRepositories = platformRepositories;\n)?",
@@ -190,6 +190,9 @@ def inject_into_index_html(config: dict) -> None:
190190
]:
191191
html = re.sub(pattern, "", html, count=0)
192192

193+
# Collapse runs of 3+ blank lines to 2 so builds are idempotent.
194+
html = re.sub(r"\n{4,}", "\n\n\n", html)
195+
193196
# Insert generated JS: right after the <script> tag opening
194197
script_marker = "\n <script>\n"
195198
insert_pos = html.find(script_marker)

web/strategy-switch-console/index.html

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,48 +1612,6 @@ <h2 data-i18n="summary">切换摘要</h2>
16121612
};
16131613

16141614

1615-
1616-
1617-
1618-
1619-
1620-
1621-
1622-
1623-
1624-
1625-
1626-
1627-
1628-
1629-
1630-
1631-
1632-
1633-
1634-
1635-
1636-
1637-
1638-
1639-
1640-
1641-
1642-
1643-
1644-
1645-
1646-
1647-
1648-
1649-
1650-
1651-
1652-
1653-
1654-
1655-
1656-
16571615
const reservePolicyModes = ["current", "none", "ratio", "floor", "max"];
16581616
const incomeLayerModes = ["current", "enabled", "disabled"];
16591617
const optionOverlayModes = ["current", "enabled", "disabled"];

web/strategy-switch-console/page_asset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)