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