build: 增量更新版本判断
							parent
							
								
									27b97a4db9
								
							
						
					
					
						commit
						4345c23d96
					
				| 
						 | 
				
			
			@ -10,6 +10,7 @@ function appendIntro (context, systemType, latest) {
 | 
			
		|||
 | 
			
		||||
  const latestFilePath = path.join(context.outDir, latest)
 | 
			
		||||
  fs.appendFile(latestFilePath, `partPackage: ${partUpdateUrl}
 | 
			
		||||
partMiniVersion: 1.7.0
 | 
			
		||||
releaseNotes:
 | 
			
		||||
  - 升级日志
 | 
			
		||||
  - https://download.fastgit.org/docmirror/dev-sidecar/releases/download/v${version}/DevSidecar-${version}.exe
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,23 +81,27 @@ 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 isSupportPartUpdate (value) {
 | 
			
		||||
    if (!value.partPackage) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
    const info = await this.$api.info.get()
 | 
			
		||||
    if (value.partMiniVersion && value.partMiniVersion < info.version) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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
 | 
			
		||||
    }
 | 
			
		||||
    const usePartPackage = value.partPackage && isMiniUpdate(value.version, info.version)
 | 
			
		||||
    if (usePartPackage) {
 | 
			
		||||
    const partUpdate = await isSupportPartUpdate(value)
 | 
			
		||||
    if (partUpdate) {
 | 
			
		||||
      // 有增量更新
 | 
			
		||||
      api.update.downloadPart(value)
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue