d2736d1ef6
- AI routing rules now stored in system_configs DB table instead of hardcoded config - Multi-model support via name|model composite key for same-provider routing - UnifiedPayService with HMAC-SHA256 gateway integration (alipay/wechat) - Admin payment panel: list, stats, search, filter, refund - WeChat mini-program CI/CD via miniprogram-ci (v1.0.9) - Translation quota extended to LLM provider tier - SearchService with DB-driven provider config (bing/google_cse/searxng) - Footer cleanup across admin/workspace/uni-app - Private key excluded from git tracking
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
const ci = require('miniprogram-ci')
|
|
const path = require('path')
|
|
|
|
const APPID = process.env.WX_APPID || 'wxdad62baf4ccd09e3'
|
|
const KEY_PATH = process.env.WX_PRIVATE_KEY_PATH || path.resolve(__dirname, '../private.key')
|
|
const VERSION = process.env.WX_VERSION || '1.0.6'
|
|
|
|
// miniprogram-ci 2.x 已知 bug:上传完成后进程残留 setTimeout 无法自动退出
|
|
// 设置强制退出计时器,防止进程卡死
|
|
const FORCE_EXIT_MS = 600_000
|
|
let forceExitTimer = setTimeout(() => {
|
|
console.error('Upload timed out, forcing exit')
|
|
process.exit(1)
|
|
}, FORCE_EXIT_MS)
|
|
|
|
async function main() {
|
|
const project = new ci.Project({
|
|
appid: APPID,
|
|
type: 'miniProgram',
|
|
projectPath: path.resolve(__dirname, '../dist/build/mp-weixin/'),
|
|
privateKeyPath: KEY_PATH,
|
|
ignores: ['node_modules/**/*'],
|
|
})
|
|
|
|
const action = process.argv[2] || 'upload'
|
|
|
|
if (action === 'preview') {
|
|
const qrcodeDest = path.resolve(__dirname, '../dist/qrcode.jpg')
|
|
await ci.preview({
|
|
project,
|
|
version: VERSION,
|
|
desc: process.env.WX_DESC || '自动预览',
|
|
setting: { minify: true, es6: true, autoPrefixWXSS: true },
|
|
qrcodeFormat: 'image',
|
|
qrcodeOutputDest: qrcodeDest,
|
|
onProgressUpdate: console.log,
|
|
})
|
|
console.log('Preview QR:', qrcodeDest)
|
|
} else {
|
|
console.log(`Uploading v${VERSION} ...`)
|
|
const result = await ci.upload({
|
|
project,
|
|
version: VERSION,
|
|
desc: process.env.WX_DESC || '自动构建上传',
|
|
setting: { minify: true, es6: true, autoPrefixWXSS: true },
|
|
onProgressUpdate: console.log,
|
|
})
|
|
console.log('Upload done:', JSON.stringify(result))
|
|
}
|
|
}
|
|
|
|
main().then(() => {
|
|
clearTimeout(forceExitTimer)
|
|
process.exit(0)
|
|
}).catch(e => {
|
|
console.error('Upload failed:', e.message)
|
|
clearTimeout(forceExitTimer)
|
|
process.exit(1)
|
|
})
|