Files
yuzhiran 369da9704e H5构建部署 + 小程序上传 v1.0.3
- 构建 H5 并部署至 zhiyin.yzrcloud.cn(含 nginx /api/ 代理)
- 构建并上传微信小程序至微信侧(版本 1.0.3,包体 495KB)
- 启动生产后端(端口 3006,zhiyinwx.yzrcloud.cn 代理)
- 修复 tsconfig.build.json 缺失导致 dist 输出路径错误
2026-06-11 16:39:12 +08:00

56 lines
1.5 KiB
JavaScript

const ci = require('miniprogram-ci')
const path = require('path')
const { execSync } = require('child_process')
const projectPath = path.resolve(__dirname, '../dist/build/mp-weixin')
const privateKeyPath = path.resolve('/root/opencode-workspace/微信小程序参数/宇之然AI磁场appid/private.wxf466b3c3bc411ffc.key')
const appid = 'wxf466b3c3bc411ffc'
async function main() {
const project = new ci.Project({
appid,
type: 'miniProgram',
projectPath,
privateKeyPath,
ignores: ['node_modules/**/*'],
})
// Get version from git tag or use timestamp
let version = '1.0.3'
try {
const gitTag = execSync('git describe --tags --abbrev=0 2>/dev/null || echo ""', { encoding: 'utf8' }).trim()
if (gitTag) version = gitTag.replace(/^v/, '')
} catch {}
const now = new Date()
const desc = `v${version} ${now.toISOString().slice(0, 10)} ${now.toTimeString().slice(0, 5)}`
console.log(`Uploading: ${projectPath}`)
console.log(`Version: ${version}`)
console.log(`Desc: ${desc}`)
const result = await ci.upload({
project,
version,
desc,
setting: {
es6: true,
minify: true,
autoPrefixWXSS: true,
},
onProgressUpdate: (task) => {
if (task.status === 'uploading') {
console.log(`Uploading... ${task.current}/${task.total}`)
}
},
})
console.log('Upload success!')
console.log('Result:', JSON.stringify(result, null, 2))
}
main().catch(err => {
console.error('Upload failed:', err.message)
process.exit(1)
})