build(electron-forge): execute electron-forge commands in our "build" output context

since we build TS and webpack ourselves and are not using any electron-forge plugins (at least at the moment) -> we should use the "build" folder as build context for electron-forge:

in comparison to running electron-forge in the root folder of the project, this avoids electron-forge from packing the source code multiple times (e.g. once as uncompiled TS, then as compiled JS, and then (partially) a third time as webpack bundled JS files), same as some of the assets.

to achieve this, we run our usual TS/Webpack build process, but then install the npm dependencies *inside* the build folder (as otherwise electron-forge would choke on the missing node_modules it and abort building).

In theory we could avoid cd-ing into the build folder, by providing the "dir" as argument to electron-forge's CLI -- BUT that wouldn't play well with our CI, where we are passing --arch and --platform options to it, which need to come *before* the dir argument.

since we now cd into the "build" folder, we also need to adjust the path in package.json "main" again
This commit is contained in:
Panagiotis Papadopoulos
2025-03-11 22:12:37 +01:00
parent 10de4e798b
commit 6b9d8f0d67
2 changed files with 6 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ try {
"./package.json",
"./LICENSE",
"./README.md",
"./forge.config.cjs",
"./src/views/",
"./src/etapi/etapi.openapi.yaml",
"./src/routes/api/openapi.json",