32 Commits

Author SHA1 Message Date
Wael Nasreddine
0273c64bbf Build edit-docs as standalone package using makeApp
Changed edit-docs from a simple wrapper script to a properly built Nix
package using makeApp, similar to how desktop and server are built.

Changes:
- Added build script to apps/edit-docs/package.json
- Created apps/edit-docs/scripts/build.ts based on desktop's build script
- Added edit-docs:build task to root package.json
- Changed flake.nix to use makeApp which:
  - Builds edit-docs with all dependencies bundled
  - Creates a standalone trilium-edit-docs executable
  - Can be installed with 'nix profile install' and run from any directory

This makes edit-docs truly reusable - it can now be installed and run
from any project without requiring the Trilium source tree.
2026-01-12 22:08:27 -08:00
Wael Nasreddine
fb4d63b049 Add --config, --help, and --version flags to edit-docs
- Implement --config (-c) flag to allow custom configuration file paths.
- Add --help (-h) flag to display tool usage and available options.
- Add --version (-v) flag to display the current Trilium version.
- Update electron-start.mts to correctly pass command-line arguments to Electron.
- Synchronize edit-docs version with the root package.json via update-version.ts.
- Resolve config paths relative to the configuration file's directory.

This makes edit-docs more robust and easier to use from external projects
and immutable environments like Nix.
2026-01-12 22:08:27 -08:00
Wael Nasreddine
015e41e792 fix(edit-docs): Minify meta for format==share 2026-01-12 22:08:27 -08:00
Wael Nasreddine
8e47f33329 Refactor edit-docs to use edit-docs-config.yaml
This removes hardcoded configuration from edit-docs.ts and replaces
it with dynamic loading from edit-docs-config.yaml.

Changes:
- Removed BASE_URL and NOTE_MAPPINGS constants
- Removed DOCS_ROOT and USER_GUIDE_ROOT environment variable dependencies
- Added js-yaml for YAML parsing
- Config paths are resolved relative to repository root

The tool now reads configuration from edit-docs-config.yaml, making it
easier to customize without code changes. The pnpm script is simplified
since it no longer needs to pass complex environment variables.
2026-01-12 22:08:27 -08:00
Wael Nasreddine
5b37140ffa Fix race condition in edit-docs Electron ready event
The edit-docs tool would hang on startup when the Electron 'ready' event
fired before the event listener was registered. This race condition occurred
because:

1. startElectron() creates a deferred promise and registers a 'ready' listener
2. The 'ready' event fires asynchronously at some point during app initialization
3. If async work (like config loading) delays the listener registration,
   Electron may already be ready when app.on('ready', ...) is called
4. Once fired, the 'ready' event doesn't fire again, leaving the listener
   waiting forever

The fix checks electron.app.isReady() before registering the listener:
- If already ready: execute the handler immediately
- If not ready: register the listener as before

This ensures the initialization sequence completes regardless of timing.

The issue became apparent while working on making edit-docs reusable from
other projects (see #8343), where config loading added enough async delay
to consistently trigger the race condition.

Related: https://github.com/TriliumNext/Trilium/issues/8343
2026-01-12 22:08:27 -08:00
Elian Doran
e28794d706
chore(edit-docs): fix typecheck 2025-11-09 19:28:08 +02:00
Elian Doran
5171675dee
chore(build-docs): fix URL 2025-11-02 20:13:10 +02:00
Elian Doran
beb7c66ff5
feat(build-docs): rewrite URLs for in-app help 2025-11-02 19:45:16 +02:00
Elian Doran
6e06d7169f
refactor(build-docs): integrate with original build-docs script 2025-11-01 20:37:03 +02:00
Elian Doran
7ce7c66463
chore(build-docs): address requested changes 2025-10-28 19:31:57 +02:00
Elian Doran
61d26fec60
refactor(build-docs): use proper await when building documentation 2025-10-28 19:30:55 +02:00
Elian Doran
5d82a26c87
fix(build-docs): missing favicon 2025-10-28 17:23:31 +02:00
Elian Doran
bde03e8378
feat(docs/share): integrate in the CI 2025-10-28 16:42:52 +02:00
Elian Doran
7a5c1277f1
feat(docs/share): set up script to build documentation 2025-10-28 16:24:55 +02:00
Elian Doran
ea53665e64
Merge remote-tracking branch 'origin/main' into feature/export_with_share_theme 2025-10-24 14:43:20 +03:00
Elian Doran
970f4b028d
chore(server): fix a few more type errors 2025-09-14 10:58:11 +03:00
Elian Doran
06de06b501
refactor(export/share): share type for format 2025-06-24 19:21:09 +03:00
Elian Doran
9bc966491d
fix(edit-docs): import error 2025-06-23 21:22:45 +03:00
Elian Doran
1818ae1f72
fix(desktop): blank screen when starting (closes #2103) 2025-06-04 19:55:04 +03:00
Elian Doran
ad0c73d210
feat(edit-docs): read from input directory instead of the zip 2025-05-27 19:24:04 +03:00
Elian Doran
6264b9a60a
fix(edit-demo): path to extracted files 2025-05-27 19:24:04 +03:00
Elian Doran
7cb4cc8469
fix(edit-demo): get it to actually start 2025-05-27 19:24:04 +03:00
Elian Doran
76bc3d858c
fix(edit-demo): path to demo database 2025-05-27 19:24:04 +03:00
Elian Doran
6021d33317
chore(edit-docs): split into two entrypoints 2025-05-27 14:03:54 +03:00
Elian Doran
bab679fd2a
fix(edit-docs): not working under NixOS 2025-05-26 08:20:48 +03:00
Elian Doran
b0fe4f67d8
fix(edit-docs): main window not starting properly 2025-05-25 18:29:31 +03:00
Elian Doran
be8749d84e
chore(edit-docs): switch to esbuild 2025-05-25 11:47:03 +03:00
Elian Doran
385182cd97
fix(edit-docs): get Electron to actually start 2025-05-01 17:22:26 +03:00
Elian Doran
e314372fbd
chore(edidt-docs): fix entrypoint partially 2025-04-30 22:17:38 +03:00
Elian Doran
00396614ed
chore(nx): integrate edit-docs 2025-04-29 12:50:05 +03:00
Elian Doran
62dbcc0a2e
chore(nx): move all monorepo-style in subfolder for processing 2025-04-22 10:06:06 +03:00
Elian Doran
b750920832
chore(monorepo/edit-docs): port files 2025-04-21 23:18:45 +03:00