Pārlūkot izejas kodu

feat: 更新release.js

liujia 2 mēneši atpakaļ
vecāks
revīzija
3d2b216139
2 mainītis faili ar 42 papildinājumiem un 25 dzēšanām
  1. 11 0
      CHANGELOG.md
  2. 31 25
      scripts/release.js

+ 11 - 0
CHANGELOG.md

@@ -1,3 +1,14 @@
+## [0.1.16](http://43.137.10.199:3000/liujia/ln-web/compare/v0.1.15...v0.1.16) (2025-08-13)
+
+
+### Features
+
+* 更新发布脚本 ([704acd3](http://43.137.10.199:3000/liujia/ln-web/commits/704acd3b2124096bb28fa6bf4c9674686ca85966))
+* 更新发布脚本 ([bd26b27](http://43.137.10.199:3000/liujia/ln-web/commits/bd26b270ac2ccc626de9c18b5364ae5dde1e5696))
+* **scripts:** 测试日志生成 ([375e86d](http://43.137.10.199:3000/liujia/ln-web/commits/375e86d8da97e19e740c876e8421f584f381540f))
+
+
+
 ## [0.1.15](http://43.137.10.199:3000/liujia/ln-web/compare/v0.1.14...v0.1.15) (2025-08-13)
 
 

+ 31 - 25
scripts/release.js

@@ -36,27 +36,13 @@ if (!isGitClean()) {
   process.exit(1)
 }
 
-// 3. 询问发布模式
-const { publishMode } = await inquirer.prompt([
-  {
-    type: 'list',
-    name: 'publishMode',
-    message: '请选择发布模式:',
-    choices: [
-      { name: '正常发版(更新版本号并推送)', value: 'normal' },
-      { name: '自测模式(仅生成 changelog,不推送)', value: 'test' },
-    ],
-    default: 'normal',
-  },
-])
-
-// 4. 检查是否有符合规范的提交
+// 3. 检查是否有符合规范的提交
 if (!hasConventionalCommits()) {
   console.error('⚠️ 没有检测到符合 Angular 提交规范的提交,跳过 changelog 生成!')
   process.exit(1)
 }
 
-// 5. 询问生成 changelog 的方式
+// 4. 询问生成 changelog 的方式
 const { mode } = await inquirer.prompt([
   {
     type: 'list',
@@ -70,23 +56,43 @@ const { mode } = await inquirer.prompt([
   },
 ])
 
-// 6. 生成 changelog
+// 5. 生成 changelog
 if (mode === 'all') {
   run('npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0')
 } else {
   run('npx conventional-changelog -p angular -i CHANGELOG.md -s')
 }
 
-// 7. 如果是自测模式,提前结束
-if (publishMode === 'test') {
-  console.log('✅ 自测模式完成(未生成 tag / 未推送)')
-  process.exit(0)
-}
+// 6. 选择版本号类型
+const { versionType } = await inquirer.prompt([
+  {
+    type: 'list',
+    name: 'versionType',
+    message: '请选择版本号更新类型:',
+    choices: [
+      { name: '补丁版本 (patch)', value: 'patch' },
+      { name: '小版本 (minor)', value: 'minor' },
+      { name: '大版本 (major)', value: 'major' },
+      { name: '自定义版本', value: 'custom' },
+    ],
+  },
+])
 
-// 8. 更新版本号(补丁版本)
-run('npm version patch -m "new version published: v%s"')
+if (versionType === 'custom') {
+  const { customVersion } = await inquirer.prompt([
+    {
+      type: 'input',
+      name: 'customVersion',
+      message: '请输入自定义版本号(例如 1.2.3):',
+      validate: (input) => /^\d+\.\d+\.\d+$/.test(input) || '版本号格式不正确,请输入 x.y.z',
+    },
+  ])
+  run(`npm version ${customVersion} -m "new version published: v%s"`)
+} else {
+  run(`npm version ${versionType} -m "new version published: v%s"`)
+}
 
-// 9. 推送代码和 tag
+// 7. 推送代码和 tag
 run('git push && git push --tags')
 
 console.log('✅ 发布完成!')