build: update

pull/192/head
xiaojunnuo 2021-12-06 00:26:34 +08:00
parent 30ecf21cb0
commit 27b97a4db9
5 changed files with 21 additions and 4 deletions

View File

@ -78,5 +78,5 @@
"last 2 versions",
"not dead"
],
"gitHead": "9b027af3ee7e88975a54692ed83096802764a8dc"
"gitHead": "30ecf21cb001fb8d821e575d476ca0ffb4ff086e"
}

View File

@ -84,5 +84,5 @@
"not dead"
],
"__npminstall_done": false,
"gitHead": "9b027af3ee7e88975a54692ed83096802764a8dc"
"gitHead": "30ecf21cb001fb8d821e575d476ca0ffb4ff086e"
}

View File

@ -76,14 +76,28 @@ function install (app, api) {
}
})
}
/**
* 是否小版本升级
* @param version1
* @param version2
* @returns {Promise<void>}
*/
async function isMiniUpdate (version1, version2) {
const version1Prefix = version1.substring(0, version1.lastIndexOf('.'))
const version2Prefix = version2.substring(0, version1.lastIndexOf('.'))
return version1Prefix === version2Prefix
}
async function downloadNewVersion (value) {
const platform = await api.shell.getSystemPlatform()
const info = await this.$api.info.get()
console.log('download new version platform', platform)
if (platform === 'linux') {
goManualUpdate(app, value)
return
}
if (value.partPackage) {
const usePartPackage = value.partPackage && isMiniUpdate(value.version, info.version)
if (usePartPackage) {
// 有增量更新
api.update.downloadPart(value)
} else {

View File

@ -66,5 +66,5 @@
"last 2 versions",
"not dead"
],
"gitHead": "9b027af3ee7e88975a54692ed83096802764a8dc"
"gitHead": "30ecf21cb001fb8d821e575d476ca0ffb4ff086e"
}

View File

@ -2,3 +2,6 @@ const CryptoJs = require('crypto-js')
const ret = CryptoJs.SHA256('111111111111')
console.log(ret.toString(CryptoJs.enc.Base64))
console.log(1 / 2)
const version1 = '1.7.0'
console.log(version1.substring(0, version1.lastIndexOf('.')))