zen-gitsync 2.10.13 → 2.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,10 @@
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Zen GitSync</title>
9
- <script type="module" crossorigin src="/assets/index-CPAAliuZ.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BTDAOFIL.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/vendor-BpNfZzQX.js">
11
11
  <link rel="stylesheet" crossorigin href="/assets/vendor-DpSHka1A.css">
12
- <link rel="stylesheet" crossorigin href="/assets/index-B8PRi6z_.css">
12
+ <link rel="stylesheet" crossorigin href="/assets/index-DqVLW3CD.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="app"></div>
@@ -51,7 +51,7 @@ export function registerNpmRoutes({
51
51
  // 版本号递增或依赖版本修改
52
52
  app.post('/api/version-bump', express.json(), async (req, res) => {
53
53
  try {
54
- const { bumpType, packageJsonPath, versionTarget, dependencyName, dependencyVersion, dependencyVersionBump, dependencyType } = req.body
54
+ const { bumpType, packageJsonPath, versionTarget, dependencyName, dependencyVersion, dependencyVersionBump, dependencyType, versionValue } = req.body
55
55
 
56
56
  // 确定 package.json 的路径
57
57
  let pkgPath
@@ -155,7 +155,7 @@ export function registerNpmRoutes({
155
155
  dependencyType: depType
156
156
  })
157
157
  } else {
158
- // 修改 version 字段(原有逻辑)
158
+ // 修改 version 字段
159
159
  if (!pkg.version) {
160
160
  return res.status(400).json({
161
161
  success: false,
@@ -164,6 +164,28 @@ export function registerNpmRoutes({
164
164
  }
165
165
 
166
166
  const oldVersion = pkg.version
167
+
168
+ // 直接设置版本号(来自版本节点输入配置)
169
+ const direct = typeof versionValue === 'string' ? versionValue.trim() : ''
170
+ if (direct) {
171
+ const versionParts = direct.split('.').map(Number)
172
+ if (versionParts.length !== 3 || versionParts.some(isNaN)) {
173
+ return res.status(400).json({
174
+ success: false,
175
+ error: `无效的版本号格式: ${direct},应为 x.y.z 格式`
176
+ })
177
+ }
178
+
179
+ pkg.version = direct
180
+ await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8')
181
+
182
+ return res.json({
183
+ success: true,
184
+ oldVersion,
185
+ newVersion: direct,
186
+ filePath: pkgPath
187
+ })
188
+ }
167
189
 
168
190
  // 解析版本号
169
191
  const versionParts = oldVersion.split('.').map(Number)