mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(electron): electron updater issues (#6005)
- generate-yml.js does not filter files correctly - add version to generated bundles - change `.AppImage` to `.appimage`. See https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/providers/Provider.ts#L88
This commit is contained in:
@@ -2,11 +2,6 @@ import crypto from 'node:crypto';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const yml = {
|
||||
version: process.env.RELEASE_VERSION ?? '0.0.0',
|
||||
files: [],
|
||||
};
|
||||
|
||||
const filenamesMapping = {
|
||||
windows: 'latest.yml',
|
||||
macos: 'latest-mac.yml',
|
||||
@@ -14,7 +9,11 @@ const filenamesMapping = {
|
||||
};
|
||||
|
||||
const generateYml = platform => {
|
||||
const regex = new RegExp(`^affine-.*-${platform}-.*.(exe|zip|dmg|AppImage)$`);
|
||||
const yml = {
|
||||
version: process.env.RELEASE_VERSION ?? '0.0.0',
|
||||
files: [],
|
||||
};
|
||||
const regex = new RegExp(`^affine-.*-${platform}-.*.(exe|zip|dmg|appimage)$`);
|
||||
const files = fs.readdirSync(process.cwd()).filter(file => regex.test(file));
|
||||
const outputFileName = filenamesMapping[platform];
|
||||
|
||||
@@ -35,6 +34,7 @@ const generateYml = platform => {
|
||||
});
|
||||
} catch (e) {}
|
||||
});
|
||||
// path & sha512 are deprecated
|
||||
yml.path = yml.files[0].url;
|
||||
yml.sha512 = yml.files[0].sha512;
|
||||
yml.releaseDate = new Date().toISOString();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { app } from 'electron';
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
|
||||
import { isMacOS, isWindows } from '../../shared/utils';
|
||||
import { buildType } from '../config';
|
||||
import { logger } from '../logger';
|
||||
import { CustomGitHubProvider } from './custom-github-provider';
|
||||
@@ -82,8 +81,7 @@ export const registerUpdater = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: support auto update on linux
|
||||
const allowAutoUpdate = isMacOS() || isWindows();
|
||||
const allowAutoUpdate = true;
|
||||
|
||||
autoUpdater.logger = logger;
|
||||
autoUpdater.autoDownload = false;
|
||||
|
||||
Reference in New Issue
Block a user