H5构建部署 + 小程序上传 v1.0.3
- 构建 H5 并部署至 zhiyin.yzrcloud.cn(含 nginx /api/ 代理) - 构建并上传微信小程序至微信侧(版本 1.0.3,包体 495KB) - 启动生产后端(端口 3006,zhiyinwx.yzrcloud.cn 代理) - 修复 tsconfig.build.json 缺失导致 dist 输出路径错误
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
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')
|
||||
@@ -14,26 +15,41 @@ async function main() {
|
||||
ignores: ['node_modules/**/*'],
|
||||
})
|
||||
|
||||
console.log(`Uploading from: ${projectPath}`)
|
||||
console.log(`AppID: ${appid}`)
|
||||
|
||||
// Dry-run mode for testing — set raw false to actually upload
|
||||
// For testing, we do a preview first
|
||||
// Get version from git tag or use timestamp
|
||||
let version = '1.0.3'
|
||||
try {
|
||||
const previewResult = await ci.preview({
|
||||
project,
|
||||
desc: '预览测试',
|
||||
setting: {
|
||||
es6: true,
|
||||
minify: false,
|
||||
},
|
||||
})
|
||||
console.log('Preview success!')
|
||||
console.log('Preview result:', JSON.stringify(previewResult, null, 2))
|
||||
} catch (err) {
|
||||
console.error('Preview failed:', err.message)
|
||||
process.exit(1)
|
||||
}
|
||||
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()
|
||||
main().catch(err => {
|
||||
console.error('Upload failed:', err.message)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user