Преглед изворни кода

refactor: 重命名小程序发布命令使其更清晰

- upload → experience (体验版上传)
- preview → dev (开发版预览)
- 更新脚本函数名和提示信息
- 更新 package.json 中的 npm 命令
- 更新 weapp-publish Skill 文档

新的命令:
- pnpm run publish:enterprise      # 上传企业小程序体验版
- pnpm run publish:enterprise:dev   # 生成企业小程序开发版
- pnpm run publish:talent           # 上传人才小程序体验版
- pnpm run publish:talent:dev       # 生成人才小程序开发版

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname пре 3 дана
родитељ
комит
f6ecee757b
5 измењених фајлова са 171 додато и 167 уклоњено
  1. 27 27
      .claude/skills/weapp-publish/SKILL.md
  2. 5 4
      package.json
  3. 124 121
      pnpm-lock.yaml
  4. BIN
      qrcode-enterprise.jpg
  5. 15 15
      scripts/publish-weapp.js

+ 27 - 27
.claude/skills/weapp-publish/SKILL.md

@@ -49,22 +49,22 @@ pnpm add -g miniprogram-ci
 ### 完整发布步骤
 
 1. **构建项目**: 运行 Taro 构建命令生成小程序代码
-2. **上传代码**: 使用 miniprogram-ci 上传到微信服务器
+2. **上传代码**: 使用 miniprogram-ci 发布到微信服务器
 3. **设置体验版**(可选): 在小程序后台将上传的版本设置为体验版
 
 ### 发布命令
 
 ```bash
-# 企业小程序 - 开发版上传
+# 企业小程序 - 体验版上传
 pnpm run publish:enterprise:dev
 
-# 企业小程序 - 生产版上传
+# 企业小程序 - 开发版生成二维码
 pnpm run publish:enterprise:prod
 
-# 人才小程序 - 开发版上传
+# 人才小程序 - 体验版上传
 pnpm run publish:talent:dev
 
-# 人才小程序 - 生产版上传
+# 人才小程序 - 开发版生成二维码
 pnpm run publish:talent:prod
 ```
 
@@ -118,10 +118,10 @@ function buildMiniProject(config) {
 /**
  * 上传小程序到微信服务器
  */
-async function uploadMiniProject(config, options) {
+async function uploadExperienceProject(config, options) {
   const { version, desc, robot = 1 } = options
 
-  console.log(`\n📤 正在上传 ${config.name}...`)
+  console.log(`\n📤 正在发布体验版 ${config.name}...`)
   console.log(`   版本: ${version}`)
   console.log(`   描述: ${desc}`)
 
@@ -134,7 +134,7 @@ async function uploadMiniProject(config, options) {
   })
 
   try {
-    const result = await ci.upload({
+    const result = await ci.experience({
       project,
       version,
       desc,
@@ -153,12 +153,12 @@ async function uploadMiniProject(config, options) {
       robot,
     })
 
-    console.log(`\n✅ ${config.name} 上传成功!`)
+    console.log(`\n✅ ${config.name} 发布成功!`)
     console.log(`   时间: ${result.time}`)
     console.log(`   版本: ${result.version}`)
     console.log(`   请前往小程序后台查看: https://mp.weixin.qq.com/`)
   } catch (error) {
-    console.error(`\n❌ ${config.name} 上传失败`)
+    console.error(`\n❌ ${config.name} 发布失败`)
     console.error(error.message)
     throw error
   }
@@ -167,7 +167,7 @@ async function uploadMiniProject(config, options) {
 /**
  * 预览小程序(生成二维码)
  */
-async function previewMiniProject(config, options) {
+async function previewDevProject(config, options) {
   const { desc, qrcodePath, robot = 1 } = options
 
   console.log(`\n👀 正在生成 ${config.name} 预览二维码...`)
@@ -181,7 +181,7 @@ async function previewMiniProject(config, options) {
   })
 
   try {
-    const result = await ci.preview({
+    const result = await ci.dev({
       project,
       desc,
       setting: { useProjectConfig: true },
@@ -206,7 +206,7 @@ async function previewMiniProject(config, options) {
  */
 async function main() {
   const args = process.argv.slice(2)
-  const [miniType, action = 'upload'] = args
+  const [miniType, action = 'experience'] = args
 
   // 解析参数
   const options = {
@@ -228,10 +228,10 @@ async function main() {
     buildMiniProject(config)
 
     // 执行操作
-    if (action === 'upload') {
-      await uploadMiniProject(config, options)
-    } else if (action === 'preview') {
-      await previewMiniProject(config, {
+    if (action === 'experience') {
+      await uploadExperienceProject(config, options)
+    } else if (action === 'dev') {
+      await previewDevProject(config, {
         desc: options.desc,
         qrcodePath: path.resolve(__dirname, `../qrcode-${miniType}.jpg`),
         robot: options.robot,
@@ -257,10 +257,10 @@ main()
 ```json
 {
   "scripts": {
-    "publish:enterprise": "node scripts/publish-weapp.js enterprise upload",
-    "publish:enterprise:preview": "node scripts/publish-weapp.js enterprise preview",
-    "publish:talent": "node scripts/publish-weapp.js talent upload",
-    "publish:talent:preview": "node scripts/publish-weapp.js talent preview"
+    "publish:enterprise": "node scripts/publish-weapp.js enterprise experience",
+    "publish:enterprise:dev": "node scripts/publish-weapp.js enterprise dev",
+    "publish:talent": "node scripts/publish-weapp.js talent experience",
+    "publish:talent:dev": "node scripts/publish-weapp.js talent dev"
   }
 }
 ```
@@ -296,7 +296,7 @@ pnpm run publish:enterprise
 VERSION=1.2.0 DESC="新增订单管理功能" pnpm run publish:enterprise
 
 # 生成预览二维码
-pnpm run publish:enterprise:preview
+pnpm run publish:enterprise:dev
 ```
 
 ### 发布人才小程序
@@ -309,7 +309,7 @@ pnpm run publish:talent
 VERSION=2.0.0 DESC="全新改版,优化求职流程" pnpm run publish:talent
 
 # 生成预览二维码
-pnpm run publish:talent:preview
+pnpm run publish:talent:dev
 ```
 
 ---
@@ -322,7 +322,7 @@ pnpm run publish:talent:preview
 |----------|-------------|
 | "发布企业小程序" | 运行 `pnpm run publish:enterprise` |
 | "发布人才小程序" | 运行 `pnpm run publish:talent` |
-| "生成企业小程序预览二维码" | 运行 `pnpm run publish:enterprise:preview` |
+| "生成企业小程序预览二维码" | 运行 `pnpm run publish:enterprise:dev` |
 | "发布两个小程序" | 依次运行企业小程序和人才小程序的发布命令 |
 
 ---
@@ -339,14 +339,14 @@ pnpm run publish:talent:preview
 
 ## 常见问题
 
-### Q: 上传失败提示 IP 不在白名单
+### Q: 发布失败提示 IP 不在白名单
 **A**: 请在微信公众平台"开发 > 开发设置"中添加服务器 IP 到白名单。
 
-### Q: 构建成功但上传失败
+### Q: 构建成功但发布失败
 **A**: 检查密钥文件路径是否正确,密钥是否匹配对应的 AppID。
 
 ### Q: 如何设置体验版
-**A**: 上传成功后,登录小程序后台"版本管理",将指定版本设置为体验版。
+**A**: 发布成功后,登录小程序后台"版本管理",将指定版本设置为体验版。
 
 ---
 

+ 5 - 4
package.json

@@ -64,10 +64,10 @@
     "test:e2e:debug": "cd web && pnpm test:e2e:debug",
     "test:e2e:report": "cd web && pnpm exec playwright show-report",
     "prepare": "husky",
-    "publish:enterprise": "node scripts/publish-weapp.js enterprise upload",
-    "publish:enterprise:preview": "node scripts/publish-weapp.js enterprise preview",
-    "publish:talent": "node scripts/publish-weapp.js talent upload",
-    "publish:talent:preview": "node scripts/publish-weapp.js talent preview"
+    "publish:enterprise": "node scripts/publish-weapp.js enterprise experience",
+    "publish:enterprise:dev": "node scripts/publish-weapp.js enterprise dev",
+    "publish:talent": "node scripts/publish-weapp.js talent experience",
+    "publish:talent:dev": "node scripts/publish-weapp.js talent dev"
   },
   "keywords": [],
   "author": "",
@@ -85,6 +85,7 @@
     "globals": "^17.0.0",
     "husky": "^9.1.7",
     "lint-staged": "^16.2.5",
+    "miniprogram-ci": "^2.1.26",
     "ts-node": "^10.9.2",
     "tsx": "^4.20.6"
   },

Разлика између датотеке није приказан због своје велике величине
+ 124 - 121
pnpm-lock.yaml


BIN
qrcode-enterprise.jpg


+ 15 - 15
scripts/publish-weapp.js

@@ -37,12 +37,12 @@ function buildMiniProject(config) {
 }
 
 /**
- * 上传小程序到微信服务器
+ * 发布小程序体验版到微信服务器
  */
-async function uploadMiniProject(config, options) {
+async function uploadExperienceProject(config, options) {
   const { version, desc, robot = 1 } = options
 
-  console.log(`\n📤 正在上传 ${config.name}...`)
+  console.log(`\n📤 正在发布体验版 ${config.name}...`)
   console.log(`   版本: ${version}`)
   console.log(`   描述: ${desc}`)
 
@@ -74,12 +74,12 @@ async function uploadMiniProject(config, options) {
       robot,
     })
 
-    console.log(`\n✅ ${config.name} 上传成功!`)
+    console.log(`\n✅ ${config.name}体验版上传成功!`)
     console.log(`   时间: ${result.time}`)
     console.log(`   版本: ${result.version}`)
     console.log(`   请前往小程序后台查看: https://mp.weixin.qq.com/`)
   } catch (error) {
-    console.error(`\n❌ ${config.name} 上传失败`)
+    console.error(`\n❌ ${config.name}体验版上传失败`)
     console.error(error.message)
     throw error
   }
@@ -88,7 +88,7 @@ async function uploadMiniProject(config, options) {
 /**
  * 预览小程序(生成二维码)
  */
-async function previewMiniProject(config, options) {
+async function previewDevProject(config, options) {
   const { desc, qrcodePath, robot = 1 } = options
 
   console.log(`\n👀 正在生成 ${config.name} 预览二维码...`)
@@ -114,9 +114,9 @@ async function previewMiniProject(config, options) {
       robot,
     })
 
-    console.log(`\n✅ 预览二维码已生成: ${qrcodePath}`)
+    console.log(`\n✅ 开发版预览二维码已生成: ${qrcodePath}`)
   } catch (error) {
-    console.error(`\n❌ 预览二维码生成失败`)
+    console.error(`\n❌ 开发版预览二维码生成失败`)
     console.error(error.message)
     throw error
   }
@@ -127,7 +127,7 @@ async function previewMiniProject(config, options) {
  */
 async function main() {
   const args = process.argv.slice(2)
-  const [miniType, action = 'upload'] = args
+  const [miniType, action = 'experience'] = args
 
   // 解析参数
   const options = {
@@ -149,16 +149,16 @@ async function main() {
     buildMiniProject(config)
 
     // 执行操作
-    if (action === 'upload') {
-      await uploadMiniProject(config, options)
-    } else if (action === 'preview') {
-      await previewMiniProject(config, {
+    if (action === 'experience') {
+      await uploadExperienceProject(config, options)
+    } else if (action === 'dev') {
+      await previewDevProject(config, {
         desc: options.desc,
-        qrcodePath: path.resolve(__dirname, `../qrcode-${miniType}.jpg`),
+        qrcodePath: path.resolve(__dirname, `../qrcode-${miniType}-dev.jpg`),
         robot: options.robot,
       })
     } else {
-      console.error(`❌ 未知操作: ${action}`)
+      console.error(`❌ 操作无效: ${action}`)
       process.exit(1)
     }
   } catch (error) {

Неке датотеке нису приказане због велике количине промена