trilium/apps/server
Elian Doran fd7ee39963
build: ship only the better-sqlite3 files an artifact actually uses
Since v13 the package bundles a prebuilt binary for all eight platforms
it supports (~17 MB) on top of the SQLite amalgamation needed to compile
from scratch (~10 MB). A packaged artifact loads exactly one binary and
never compiles, so all of that but ~2 MB was dead weight:

  v0.104.1 (v12)   11.93 MB   deps/ + a compiled build/Release binary
  v13, untrimmed   27.0 MB    deps/ + eight prebuilds
  server, trimmed   4.5 MB    lib/ + linux-x64 + linuxmusl-x64
  desktop, trimmed  2.2 MB    lib/ + linux-x64

That is ~6 MB off each compressed Linux artifact, and leaves us below
what v0.104.1 shipped rather than 15 MB above it. lib/ plus one prebuild
is the complete runtime set -- verified by loading a copy pruned to just
those files and running a query against it.

Two things the trim has to get right, both covered:

Linux keeps the musl build alongside the glibc one. The server's dist is
produced once on a glibc runner and then consumed by both the Debian and
the Alpine images, and better-sqlite3 resolves linuxmusl-* at runtime on
the latter, so dropping it would break the amd64 image at startup. The
Electron artifacts opt out, since Electron ships no musl builds.

The platform and architecture are the ones being built *for*, not the
host's: the macOS runners are arm64 and also package darwin-x64, so
trimming by host arch would strip the binary that build needs.
TARGET_ARCH / MATRIX_ARCH already carry the target in CI.

An unsupported platform/arch throws rather than silently producing an
artifact with no native addon.

Also drops the better-sqlite3 cleanup from flake.nix's server install
phase: it removed deps/sqlite3 and the build/ scaffolding that held
build-time store paths, all of which the build now trims itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 18:07:02 +03:00
..
docker fix(deps): update dependency better-sqlite3 to v13 2026-07-25 13:32:56 +00:00
e2e fix(client): don't let Enter select from a closed autocomplete dropdown 2026-07-12 13:24:06 +03:00
scripts build: ship only the better-sqlite3 files an artifact actually uses 2026-07-25 18:07:02 +03:00
spec fix(oauth): only answer the provider round-trip with a redirect 2026-07-20 21:36:34 +03:00
src test(share): loosen the wall-clock budget on the #9717 large-code-note guard 2026-07-25 17:56:41 +03:00
.gitignore chore(server): add opt-in CPU profiling for import analysis 2026-06-28 12:01:30 +03:00
Dockerfile build: adapt the native build pipeline to better-sqlite3 v13 2026-07-25 17:09:31 +03:00
Dockerfile.alpine build: adapt the native build pipeline to better-sqlite3 v13 2026-07-25 17:09:31 +03:00
Dockerfile.alpine.rootless build: adapt the native build pipeline to better-sqlite3 v13 2026-07-25 17:09:31 +03:00
Dockerfile.legacy build: adapt the native build pipeline to better-sqlite3 v13 2026-07-25 17:09:31 +03:00
Dockerfile.rootless build: adapt the native build pipeline to better-sqlite3 v13 2026-07-25 17:09:31 +03:00
internal.openapi.yaml feat(export): remove v1 OPML export, always export OPML 2.0 2026-06-26 17:27:14 +03:00
package.json fix(deps): update dependency better-sqlite3 to v13 2026-07-25 13:32:56 +00:00
playwright.config.ts fix(e2e): run server E2E tests with a single worker 2026-07-12 17:56:43 +03:00
rootless-entrypoint.sh fix(docker/rootless): entrypoint if executable bit is not set 2025-05-27 19:52:44 +03:00
start-docker.sh fix(docker): extension in start-docker.sh 2025-05-23 13:29:51 +03:00
test_search_integration.js feat(quick_search): also allow for the equals operator in note title's quick search 2025-08-24 18:53:05 +00:00
tsconfig.app.json chore(server): set up dependency to trilium-core 2026-01-05 14:42:32 +02:00
tsconfig.json chore(server): set up dependency to trilium-core 2026-01-05 14:42:32 +02:00
tsconfig.spec.json test(server): basic coverage of some core routes 2026-05-29 20:56:53 +03:00
vite.config.mts test(core): not visible in code coverage 2026-05-29 16:56:21 +03:00
vitest.build.config.mts test(server): ensure build artifacts exist 2025-06-15 15:40:54 +03:00