aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/infrastructure/electron/impl/devTools.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main/src/infrastructure/electron/impl/devTools.ts')
-rw-r--r--packages/main/src/infrastructure/electron/impl/devTools.ts43
1 files changed, 17 insertions, 26 deletions
diff --git a/packages/main/src/infrastructure/electron/impl/devTools.ts b/packages/main/src/infrastructure/electron/impl/devTools.ts
index 10f4545..6db88d1 100644
--- a/packages/main/src/infrastructure/electron/impl/devTools.ts
+++ b/packages/main/src/infrastructure/electron/impl/devTools.ts
@@ -18,34 +18,32 @@
18 * SPDX-License-Identifier: AGPL-3.0-only 18 * SPDX-License-Identifier: AGPL-3.0-only
19 */ 19 */
20 20
21import type { BrowserWindow } from 'electron'; 21import { app, type BrowserWindow } from 'electron';
22
23/* eslint-disable
24 import/no-extraneous-dependencies,
25 global-require,
26 @typescript-eslint/no-var-requires,
27 unicorn/prefer-module --
28 Hack to lazily require a CJS module from an ES module transpiled into a CJS module.
29*/
22 30
23/** 31/**
24 * URL prefixes Sophie is allowed load in dev mode. 32 * Makes sure we use a separate data dir for development.
25 *
26 * In dev mode, in addition to the application itself,
27 * Sophie must be able do download and load the devtools and related extensions,
28 * so we have to make exceptions in the UI process request filter.
29 */ 33 */
30export const DEVMODE_ALLOWED_URL_PREFIXES = [ 34export function ensureDevDataDir(): void {
31 'chrome-extension:', 35 // Use alternative directory when debugging to avoid clobbering the main installation.
32 'devtools:', 36 app.setPath('userData', `${app.getPath('userData')}-dev`);
33 'https://clients2.google.com/service/update2/crx', 37 const userData = app.getPath('userData');
34 'https://clients2.googleusercontent.com/crx', 38 const mkdirp = require('mkdirp') as typeof import('mkdirp');
35]; 39 mkdirp.sync(userData);
40}
36 41
37/** 42/**
38 * Enables using source maps for node stack traces. 43 * Enables using source maps for node stack traces.
39 */ 44 */
40export function enableStacktraceSourceMaps(): void { 45export function enableStacktraceSourceMaps(): void {
41 const sourceMapSupport = 46 const sourceMapSupport =
42 /* eslint-disable-next-line
43 import/no-extraneous-dependencies,
44 global-require,
45 @typescript-eslint/no-var-requires,
46 unicorn/prefer-module --
47 Hack to lazily require a CJS module from an ES module transpiled into a CJS module.
48 */
49 require('source-map-support') as typeof import('source-map-support'); 47 require('source-map-support') as typeof import('source-map-support');
50 sourceMapSupport.install(); 48 sourceMapSupport.install();
51} 49}
@@ -61,13 +59,6 @@ export async function installDevToolsExtensions(): Promise<void> {
61 default: installExtension, 59 default: installExtension,
62 REACT_DEVELOPER_TOOLS, 60 REACT_DEVELOPER_TOOLS,
63 REDUX_DEVTOOLS, 61 REDUX_DEVTOOLS,
64 /* eslint-disable-next-line
65 import/no-extraneous-dependencies,
66 global-require,
67 @typescript-eslint/no-var-requires,
68 unicorn/prefer-module --
69 Hack to lazily require a CJS module from an ES module transpiled into a CJS module.
70 */
71 } = require('electron-devtools-installer') as typeof import('electron-devtools-installer'); 62 } = require('electron-devtools-installer') as typeof import('electron-devtools-installer');
72 await installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS], { 63 await installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS], {
73 forceDownload: false, 64 forceDownload: false,