diff options
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r-- | packages/main/src/index.ts | 28 |
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 | ||
22 | import { arch } from 'node:os'; | 22 | import os from 'node:os'; |
23 | 23 | ||
24 | import { app } from 'electron'; | 24 | import { app } from 'electron'; |
25 | import { ensureDirSync } from 'fs-extra'; | ||
26 | import osName from 'os-name'; | ||
27 | 25 | ||
28 | import { enableStacktraceSourceMaps } from './infrastructure/electron/impl/devTools'; | 26 | import { enableStacktraceSourceMaps } from './infrastructure/electron/impl/devTools.js'; |
29 | import initReactions from './initReactions'; | 27 | import electronShell from './infrastructure/electron/impl/electronShell.js'; |
30 | import { createMainStore } from './stores/MainStore'; | 28 | import initReactions from './initReactions.js'; |
31 | import { getLogger } from './utils/log'; | 29 | import MainStore from './stores/MainStore.js'; |
30 | import getLogger from './utils/getLogger.js'; | ||
32 | 31 | ||
33 | const isDevelopment = import.meta.env.MODE === 'development'; | 32 | const isDevelopment = import.meta.env.MODE === 'development'; |
34 | 33 | ||
@@ -38,11 +37,6 @@ const log = getLogger('index'); | |||
38 | app.enableSandbox(); | 37 | app.enableSandbox(); |
39 | 38 | ||
40 | if (isDevelopment) { | 39 | if (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 | ||
80 | const store = createMainStore(); | 74 | const store = MainStore.create({}, electronShell); |
81 | 75 | ||
82 | app.on('second-instance', () => { | 76 | app.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 | ||
92 | initReactions(store, isDevelopment) | 86 | const isMac = os.platform() === 'darwin'; |
87 | |||
88 | initReactions(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); |