aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/devTools.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-30 00:26:01 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-30 02:24:28 +0100
commit61fd13c55f5e69a9d8b32dd0d74b08870783bcce (patch)
tree4f3f97b1629f3c262bea076b596bc7245ccbc0bd /packages/main/src/devTools.ts
parentRevert "refactor: Switch back to consola for prettyness" (diff)
downloadsophie-61fd13c55f5e69a9d8b32dd0d74b08870783bcce.tar.gz
sophie-61fd13c55f5e69a9d8b32dd0d74b08870783bcce.tar.zst
sophie-61fd13c55f5e69a9d8b32dd0d74b08870783bcce.zip
build: Switch to esbuild
We will build all packages except the frontend (where vite remains in use) with esbuild. For some reason, the @yarnpkg/esbuild-plugin-pnp doesn't allow esbuild to load esm modules and we fall back to commonjs for dependencies. Hence we had to switch back to node_modules (but still rely on yarn hardlinking for a more efficient install).
Diffstat (limited to 'packages/main/src/devTools.ts')
-rw-r--r--packages/main/src/devTools.ts41
1 files changed, 19 insertions, 22 deletions
diff --git a/packages/main/src/devTools.ts b/packages/main/src/devTools.ts
index b98974a..6c25b3e 100644
--- a/packages/main/src/devTools.ts
+++ b/packages/main/src/devTools.ts
@@ -18,38 +18,35 @@
18 * SPDX-License-Identifier: AGPL-3.0-only 18 * SPDX-License-Identifier: AGPL-3.0-only
19 */ 19 */
20 20
21import type { App, BrowserWindow } from 'electron'; 21import type { BrowserWindow } from 'electron';
22 22
23/** 23/**
24 * Installs the react and redux developer tools extensions. 24 * Installs the react and redux developer tools extensions.
25 * 25 *
26 * We use the redux devtools and connect the mobx store to it with `mst-middlewares`, 26 * We use the redux devtools and connect the mobx store to it with `mst-middlewares`,
27 * because the mobx-state-tree devtools are currently unmaintained. 27 * because the mobx-state-tree devtools are currently unmaintained.
28 *
29 * @param app The electron application instance.
30 */ 28 */
31export function installDevToolsExtensions(app: App): void { 29export async function installDevToolsExtensions(): Promise<void> {
32 app.whenReady().then(async () => { 30 const installerPackage = await import('electron-devtools-installer');
33 const { 31 const {
34 default: installExtension, 32 default: installExtension,
33 REACT_DEVELOPER_TOOLS,
34 REDUX_DEVTOOLS,
35 } = installerPackage.default instanceof Function
36 ? installerPackage
37 : installerPackage.default as unknown as typeof import('electron-devtools-installer');
38 await installExtension(
39 [
35 REACT_DEVELOPER_TOOLS, 40 REACT_DEVELOPER_TOOLS,
36 REDUX_DEVTOOLS, 41 REDUX_DEVTOOLS,
37 } = await import('electron-devtools-installer'); 42 ],
38 installExtension( 43 {
39 [ 44 forceDownload: false,
40 REACT_DEVELOPER_TOOLS, 45 loadExtensionOptions: {
41 REDUX_DEVTOOLS, 46 allowFileAccess: true,
42 ],
43 {
44 forceDownload: false,
45 loadExtensionOptions: {
46 allowFileAccess: true,
47 },
48 }, 47 },
49 ); 48 },
50 }).catch((err) => { 49 );
51 console.error('Failed to install devtools extension', err);
52 });
53} 50}
54 51
55/** 52/**