|
11 | 11 |
|
12 | 12 | __version__ = "0.5.0rc2" |
13 | 13 |
|
| 14 | + |
14 | 15 | # 创建rich console实例 |
15 | 16 | console = Console() |
16 | 17 |
|
@@ -159,18 +160,19 @@ def _create(name, path): |
159 | 160 | dst=os.path.join(path, name), |
160 | 161 | ) |
161 | 162 |
|
162 | | - # 替换版本号 |
163 | | - base_config_path = os.path.join(path, name, "configs", "base_config.py") |
164 | | - if os.path.exists(base_config_path): |
165 | | - with open(base_config_path, "r", encoding="utf-8") as f: |
166 | | - content = f.read() |
167 | | - content = re.sub( |
168 | | - r'app_version: str = "[^"]*"', |
169 | | - f'app_version: str = "{__version__}"', |
170 | | - content, |
171 | | - ) |
172 | | - with open(base_config_path, "w", encoding="utf-8") as f: |
173 | | - f.write(content) |
| 163 | + # 替换版本号 (仅 magic-dash 系列模板) |
| 164 | + if name in ("magic-dash", "magic-dash-pro"): |
| 165 | + base_config_path = os.path.join(path, name, "configs", "base_config.py") |
| 166 | + if os.path.exists(base_config_path): |
| 167 | + with open(base_config_path, "r", encoding="utf-8") as f: |
| 168 | + content = f.read() |
| 169 | + content = re.sub( |
| 170 | + r'app_version: str = "[^"]*"', |
| 171 | + f'app_version: str = "{__version__}"', |
| 172 | + content, |
| 173 | + ) |
| 174 | + with open(base_config_path, "w", encoding="utf-8") as f: |
| 175 | + f.write(content) |
174 | 176 |
|
175 | 177 | # 重命名项目 |
176 | 178 | os.rename( |
|
0 commit comments