zen-gitsync 2.10.13 → 2.10.15

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-8pSgJUjx.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-DYs3JGnY.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="app"></div>
@@ -41,6 +41,7 @@ export function registerNpmRoutes({
41
41
  success: true,
42
42
  dependencies: pkg.dependencies || {},
43
43
  devDependencies: pkg.devDependencies || {},
44
+ peerDependencies: pkg.peerDependencies || {},
44
45
  version: pkg.version
45
46
  })
46
47
  } catch (error) {
@@ -51,7 +52,7 @@ export function registerNpmRoutes({
51
52
  // 版本号递增或依赖版本修改
52
53
  app.post('/api/version-bump', express.json(), async (req, res) => {
53
54
  try {
54
- const { bumpType, packageJsonPath, versionTarget, dependencyName, dependencyVersion, dependencyVersionBump, dependencyType } = req.body
55
+ const { bumpType, packageJsonPath, versionTarget, dependencyName, dependencyVersion, dependencyVersionBump, dependencyType, versionValue } = req.body
55
56
 
56
57
  // 确定 package.json 的路径
57
58
  let pkgPath
@@ -155,7 +156,7 @@ export function registerNpmRoutes({
155
156
  dependencyType: depType
156
157
  })
157
158
  } else {
158
- // 修改 version 字段(原有逻辑)
159
+ // 修改 version 字段
159
160
  if (!pkg.version) {
160
161
  return res.status(400).json({
161
162
  success: false,
@@ -164,6 +165,28 @@ export function registerNpmRoutes({
164
165
  }
165
166
 
166
167
  const oldVersion = pkg.version
168
+
169
+ // 直接设置版本号(来自版本节点输入配置)
170
+ const direct = typeof versionValue === 'string' ? versionValue.trim() : ''
171
+ if (direct) {
172
+ const versionParts = direct.split('.').map(Number)
173
+ if (versionParts.length !== 3 || versionParts.some(isNaN)) {
174
+ return res.status(400).json({
175
+ success: false,
176
+ error: `无效的版本号格式: ${direct},应为 x.y.z 格式`
177
+ })
178
+ }
179
+
180
+ pkg.version = direct
181
+ await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8')
182
+
183
+ return res.json({
184
+ success: true,
185
+ oldVersion,
186
+ newVersion: direct,
187
+ filePath: pkgPath
188
+ })
189
+ }
167
190
 
168
191
  // 解析版本号
169
192
  const versionParts = oldVersion.split('.').map(Number)