mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 22:37:04 +08:00
fix(electron): dev reload (#4911)
This commit is contained in:
@@ -51,7 +51,7 @@
|
|||||||
"builder-util-runtime": "^9.2.1",
|
"builder-util-runtime": "^9.2.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"electron": "^27.0.0",
|
"electron": "^27.0.0",
|
||||||
"electron-log": "^5.0.0-rc.1",
|
"electron-log": "^5.0.0",
|
||||||
"electron-squirrel-startup": "1.0.0",
|
"electron-squirrel-startup": "1.0.0",
|
||||||
"electron-window-state": "^5.0.3",
|
"electron-window-state": "^5.0.3",
|
||||||
"esbuild": "^0.19.4",
|
"esbuild": "^0.19.4",
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ function spawnOrReloadElectron() {
|
|||||||
if (code && code !== 0) {
|
if (code && code !== 0) {
|
||||||
console.log(`Electron exited with code ${code}`);
|
console.log(`Electron exited with code ${code}`);
|
||||||
}
|
}
|
||||||
process.exit(code ?? 0);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { shell } from 'electron';
|
import { shell } from 'electron';
|
||||||
|
import { app } from 'electron';
|
||||||
import log from 'electron-log';
|
import log from 'electron-log';
|
||||||
|
|
||||||
export const logger = log.scope('main');
|
export const logger = log.scope('main');
|
||||||
@@ -12,3 +13,7 @@ export async function revealLogFile() {
|
|||||||
const filePath = getLogFilePath();
|
const filePath = getLogFilePath();
|
||||||
return await shell.openPath(filePath);
|
return await shell.openPath(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.on('before-quit', () => {
|
||||||
|
log.transports.console.level = false;
|
||||||
|
});
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import { updaterSubjects } from './event';
|
|||||||
const mode = process.env.NODE_ENV;
|
const mode = process.env.NODE_ENV;
|
||||||
const isDev = mode === 'development';
|
const isDev = mode === 'development';
|
||||||
|
|
||||||
|
// skip auto update in dev mode & internal
|
||||||
|
const disabled = buildType === 'internal' || isDev;
|
||||||
|
|
||||||
export const quitAndInstall = async () => {
|
export const quitAndInstall = async () => {
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
};
|
};
|
||||||
@@ -17,7 +20,7 @@ export const quitAndInstall = async () => {
|
|||||||
let lastCheckTime = 0;
|
let lastCheckTime = 0;
|
||||||
export const checkForUpdates = async (force = true) => {
|
export const checkForUpdates = async (force = true) => {
|
||||||
// check every 30 minutes (1800 seconds) at most
|
// check every 30 minutes (1800 seconds) at most
|
||||||
if (force || lastCheckTime + 1000 * 1800 < Date.now()) {
|
if (!disabled && (force || lastCheckTime + 1000 * 1800 < Date.now())) {
|
||||||
lastCheckTime = Date.now();
|
lastCheckTime = Date.now();
|
||||||
return await autoUpdater.checkForUpdates();
|
return await autoUpdater.checkForUpdates();
|
||||||
}
|
}
|
||||||
@@ -25,8 +28,7 @@ export const checkForUpdates = async (force = true) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const registerUpdater = async () => {
|
export const registerUpdater = async () => {
|
||||||
// skip auto update in dev mode & internal
|
if (disabled) {
|
||||||
if (buildType === 'internal' || isDev) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +45,6 @@ export const registerUpdater = async () => {
|
|||||||
channel: buildType,
|
channel: buildType,
|
||||||
// hack for custom provider
|
// hack for custom provider
|
||||||
provider: 'custom' as 'github',
|
provider: 'custom' as 'github',
|
||||||
// @ts-expect-error - just ignore for now
|
|
||||||
repo: buildType !== 'internal' ? 'AFFiNE' : 'AFFiNE-Releases',
|
repo: buildType !== 'internal' ? 'AFFiNE' : 'AFFiNE-Releases',
|
||||||
owner: 'toeverything',
|
owner: 'toeverything',
|
||||||
releaseType: buildType === 'stable' ? 'release' : 'prerelease',
|
releaseType: buildType === 'stable' ? 'release' : 'prerelease',
|
||||||
|
|||||||
10
yarn.lock
10
yarn.lock
@@ -445,7 +445,7 @@ __metadata:
|
|||||||
builder-util-runtime: "npm:^9.2.1"
|
builder-util-runtime: "npm:^9.2.1"
|
||||||
cross-env: "npm:^7.0.3"
|
cross-env: "npm:^7.0.3"
|
||||||
electron: "npm:^27.0.0"
|
electron: "npm:^27.0.0"
|
||||||
electron-log: "npm:^5.0.0-rc.1"
|
electron-log: "npm:^5.0.0"
|
||||||
electron-squirrel-startup: "npm:1.0.0"
|
electron-squirrel-startup: "npm:1.0.0"
|
||||||
electron-updater: "npm:^6.1.5"
|
electron-updater: "npm:^6.1.5"
|
||||||
electron-window-state: "npm:^5.0.3"
|
electron-window-state: "npm:^5.0.3"
|
||||||
@@ -19164,10 +19164,10 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"electron-log@npm:^5.0.0-rc.1":
|
"electron-log@npm:^5.0.0":
|
||||||
version: 5.0.0-rc.1
|
version: 5.0.0
|
||||||
resolution: "electron-log@npm:5.0.0-rc.1"
|
resolution: "electron-log@npm:5.0.0"
|
||||||
checksum: f4ec437197ec5801a325e062c19f182a14eba960ee683034bfea5854efe452cfa91985b7f7ab159599c8264fde869f7101d4e82303231865a6b7c8e621815f87
|
checksum: 23b14119a5753be24880e7466ee80ae1386f9df4123ed59bc8f4426a814c728875b07de13bf0729cba7202888fcd6230375e2b5302cee0d0c5f25584d9db3334
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user