Closed
Description
Describe Task
We currently have a weird and confusing mixture of ways of how to build our packages.
I can identify
-
Desktop Version
- we have an npm script for building locally, but it also is called in our Github CI actions
npm run make-electron
which callstsc
andwebpack
(so far so good)copy-dist.ts
(build script that creates a "dist" folder, but)electron-forge
(this is supposed to turn the "dist" folder into different packages for different Platforms – it works, but has some issues at the moment as well, see electron-forge's packing includes too many files in its final asar file #5167)
- this build with node v20 as base (if I am not fully mistaken)
- we have an npm script for building locally, but it also is called in our Github CI actions
-
Server Version
- we don't seem to have an npm script for this but the Github CI Action is running
./bin/build-server.sh
, which is running./bin/copy-trilium.sh
which is doing similar things likecopy-dist.ts
above, but some additional cleaning./bin/build-server.sh
then does also some clean up like of unneeded files for the Server version
- we have a Dockerfile
- has its own build instructions directly in the Dockerfile,
- which are doing similar things like
copy-dist.ts
and./bin/build-server.sh
- this builds with node v22 as base
- we have a
./bin/build-docker.sh
script that builds above Dockerfile, but first needs to transpile the code locally via tsc??? - we have a
main-docker.yml
workflow, which seems to be doing what./bin/build-docker.sh
is doing, but it runs the commands explicitly (i.e. not the script itself -> in other words: we have code duplication)
- we don't seem to have an npm script for this but the Github CI Action is running
copy-dists.ts
seems to be less "advanced" than copy-trilium.sh
in regards to "cleanup", i.e. copy-trilium.sh
tries to delete unnecessary test files from npm modules as well.
In ./bin
we also have a build.sh
script, that references some other build-scripts that are not existing anymore (because they were replaced by using electron-forge), which also calls copy-trilium.sh
We should take a look at all of these and try to clean them up and make them a bit less confusing and duplicated :-)