追加跟踪细粒度

This commit is contained in:
aixianling
2023-01-18 14:33:09 +08:00
parent ae8bf19957
commit e8a065beac

View File

@@ -15,12 +15,12 @@ const handleZip = (id, ws) => {
wxwork: 'base-wxcp',
mp: 'dvcp_v2_wxmp'
}[info.type] || {}
let path = `../${buildPath}`, {dist} = info, progress
let path = `../${buildPath}`, {dist} = info, progress = 30
dist = dist || `../zips/${info.name}v${info.version || "1.0.0"}`
Promise.all([
db.query(`update node_custom_config set download=null,error=null,zipTime='${dayjs().format("YYYY-MM-DD HH:mm:ss")}' where ${uniCon}`),
process.new(`./shell/update.sh ${info.name} ${path}`)])
.then(() => progress = 30, sendMessage({code: 0, progress}))
.then(() => sendMessage({code: 0, progress}))
.then(() => pid = new process(`cd ${path}&&npm run apps&&node bin/pages.js ${id}&&npm run build`), () => sendMessage({code: 0, progress: ++progress}))
.then(() => pid.ins())
.then(() => fse.emptyDir(dist))
@@ -53,9 +53,9 @@ module.exports = {
if (res?.data) {
const data = JSON.parse(res.data)
if (data.cid == id) {
pid.kill()
pid.unref()
} else if (id == data.id) {
pid.kill()
pid.unref()
handleZip(id, ws)
}
}