aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r--packages/main/src/index.ts28
1 files changed, 12 insertions, 16 deletions
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts
index 40b15f0..3496212 100644
--- a/packages/main/src/index.ts
+++ b/packages/main/src/index.ts
@@ -19,16 +19,15 @@
19 * SPDX-License-Identifier: AGPL-3.0-only 19 * SPDX-License-Identifier: AGPL-3.0-only
20 */ 20 */
21 21
22import { arch } from 'node:os'; 22import os from 'node:os';
23 23
24import { app } from 'electron'; 24import { app } from 'electron';
25import { ensureDirSync } from 'fs-extra';
26import osName from 'os-name';
27 25
28import { enableStacktraceSourceMaps } from './infrastructure/electron/impl/devTools'; 26import { enableStacktraceSourceMaps } from './infrastructure/electron/impl/devTools.js';
29import initReactions from './initReactions'; 27import electronShell from './infrastructure/electron/impl/electronShell.js';
30import { createMainStore } from './stores/MainStore'; 28import initReactions from './initReactions.js';
31import { getLogger } from './utils/log'; 29import MainStore from './stores/MainStore.js';
30import getLogger from './utils/getLogger.js';
32 31
33const isDevelopment = import.meta.env.MODE === 'development'; 32const isDevelopment = import.meta.env.MODE === 'development';
34 33
@@ -38,11 +37,6 @@ const log = getLogger('index');
38app.enableSandbox(); 37app.enableSandbox();
39 38
40if (isDevelopment) { 39if (isDevelopment) {
41 // Use alternative directory when debugging to avoid clobbering the main installation.
42 app.setPath('userData', `${app.getPath('userData')}-dev`);
43 ensureDirSync(app.getPath('userData'));
44
45 // Use source maps in stack traces.
46 enableStacktraceSourceMaps(); 40 enableStacktraceSourceMaps();
47} 41}
48 42
@@ -66,8 +60,8 @@ app.setAboutPanelOptions({
66 `Electron: ${process.versions.electron}`, 60 `Electron: ${process.versions.electron}`,
67 `Chrome: ${process.versions.chrome}`, 61 `Chrome: ${process.versions.chrome}`,
68 `Node.js: ${process.versions.node}`, 62 `Node.js: ${process.versions.node}`,
69 `Platform: ${osName()}`, 63 `Platform: ${os.platform()} ${os.release()}`,
70 `Arch: ${arch()}`, 64 `Arch: ${os.arch()}`,
71 `Build date: ${new Date( 65 `Build date: ${new Date(
72 Number(import.meta.env.BUILD_DATE), 66 Number(import.meta.env.BUILD_DATE),
73 ).toLocaleString()}`, 67 ).toLocaleString()}`,
@@ -77,7 +71,7 @@ app.setAboutPanelOptions({
77 version: '', 71 version: '',
78}); 72});
79 73
80const store = createMainStore(); 74const store = MainStore.create({}, electronShell);
81 75
82app.on('second-instance', () => { 76app.on('second-instance', () => {
83 store.mainWindow?.bringToForeground(); 77 store.mainWindow?.bringToForeground();
@@ -89,7 +83,9 @@ app.on('window-all-closed', () => {
89 } 83 }
90}); 84});
91 85
92initReactions(store, isDevelopment) 86const isMac = os.platform() === 'darwin';
87
88initReactions(store, isDevelopment, isMac)
93 // eslint-disable-next-line promise/always-return -- `then` instead of top-level await. 89 // eslint-disable-next-line promise/always-return -- `then` instead of top-level await.
94 .then((disposeCompositionRoot) => { 90 .then((disposeCompositionRoot) => {
95 app.on('will-quit', disposeCompositionRoot); 91 app.on('will-quit', disposeCompositionRoot);