Skip to content

Build your personal knowledge base with Trilium Notes

chore(edidt-docs): fix entrypoint partially

Elian Dorane314372fbdd4
diff --git a/apps/desktop/.env b/apps/desktop/.env
index 788fec23e0..36c5721777 100644
--- a/apps/desktop/.env
+++ b/apps/desktop/.env
@@ -1,2 +1,2 @@
TRILIUM_PORT=37741
-TRILIUM_DATA_DIR=./apps/desktop/data
\ No newline at end of file
+TRILIUM_DATA_DIR=../data
\ No newline at end of file
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 3e59e259e2..40f051ac7b 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -53,10 +53,10 @@
"cache": true,
"configurations": {
"default": {
- "command": "electron-rebuild {projectRoot}/dist/main.js -m {projectRoot}/dist"
+ "command": "electron-rebuild -f {projectRoot}/dist/main.js -m {projectRoot}/dist"
},
"nixos": {
- "command": "electron-rebuild -v $(nix-shell -p electron_35 --run \"electron --version\") ${projectRoot}/dist/main.js -m ${projectRoot}/dist"
+ "command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") ${projectRoot}/dist/main.js -m ${projectRoot}/dist"
}
}
},
diff --git a/apps/edit-docs/.env b/apps/edit-docs/.env
index 9405208def..4ddebe7cb3 100644
--- a/apps/edit-docs/.env
+++ b/apps/edit-docs/.env
@@ -1,4 +1,8 @@
TRILIUM_DATA_DIR=../data
TRILIUM_ENV=dev
TRILIUM_INTEGRATION_TEST=memory-no-store
-TRILIUM_PORT=37741
\ No newline at end of file
+TRILIUM_PORT=37741
+
+# Paths are relative to dist root
+DOCS_ROOT=../../../docs
+USER_GUIDE_ROOT=../../../apps/server/src/public/app/doc_notes
\ No newline at end of file
diff --git a/apps/edit-docs/package.json b/apps/edit-docs/package.json
index f5b99957c3..e23bb59da5 100644
--- a/apps/edit-docs/package.json
+++ b/apps/edit-docs/package.json
@@ -3,10 +3,12 @@
"version": "0.0.1",
"private": true,
"devDependencies": {
+ "@electron/rebuild": "3.7.2",
"@triliumnext/client": "workspace:*",
"@triliumnext/desktop": "workspace:*",
"@types/fs-extra": "11.0.4",
"copy-webpack-plugin": "13.0.0",
+ "electron": "35.1.5",
"fs-extra": "11.3.0"
},
"nx": {
@@ -21,10 +23,12 @@
"cache": true,
"configurations": {
"default": {
- "command": "electron-rebuild -f {projectRoot}/dist/main.js -m {projectRoot}/dist"
+ "command": "electron-rebuild",
+ "cwd": "{projectRoot}/dist"
},
"nixos": {
- "command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") ${projectRoot}/dist/main.js -m ${projectRoot}/dist"
+ "command": "electron-rebuild -v $(nix-shell -p electron_35 --run \"electron --version\")",
+ "cwd": "{projectRoot}/dist"
}
}
},
@@ -37,15 +41,18 @@
"configurations": {
"default": {
"command": "electron .",
- "cwd": "{projectRoot}/dist"
+ "cwd": "./apps/edit-docs/dist"
},
"nixos": {
- "command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.js\"",
- "cwd": ".",
- "forwardAllArgs": false
+ "command": "nix-shell -p electron_35 --run \"electron .\"",
+ "forwardAllArgs": false,
+ "cwd": "./apps/edit-docs/dist"
}
}
}
}
+ },
+ "dependencies": {
+ "archiver": "7.0.1"
}
}
diff --git a/apps/edit-docs/src/electron-docs-main.ts b/apps/edit-docs/src/electron-docs-main.ts
index 0d4407a8a5..ad7610da26 100644
--- a/apps/edit-docs/src/electron-docs-main.ts
+++ b/apps/edit-docs/src/electron-docs-main.ts
@@ -12,6 +12,7 @@ import type { AdvancedExportOptions } from "@triliumnext/server/src/services/exp
import TaskContext from "@triliumnext/server/src/services/task_context.js";
import { deferred } from "@triliumnext/server/src/services/utils.js";
import { parseNoteMetaFile } from "@triliumnext/server/src/services/in_app_help.js";
+import { resolve } from "path";
interface NoteMapping {
rootNoteId: string;
@@ -21,27 +22,32 @@ interface NoteMapping {
exportOnly?: boolean;
}
+const { DOCS_ROOT, USER_GUIDE_ROOT } = process.env;
+if (!DOCS_ROOT || !USER_GUIDE_ROOT) {
+ throw new Error("Missing DOCS_ROOT or USER_GUIDE_ROOT environment variable.");
+}
+
const NOTE_MAPPINGS: NoteMapping[] = [
{
rootNoteId: "pOsGYCXsbNQG",
- path: path.join("docs", "User Guide"),
+ path: path.join(DOCS_ROOT, "User Guide"),
format: "markdown"
},
{
rootNoteId: "pOsGYCXsbNQG",
- path: path.join("src", "public", "app", "doc_notes", "en", "User Guide"),
+ path: USER_GUIDE_ROOT,
format: "html",
ignoredFiles: ["index.html", "navigation.html", "style.css", "User Guide.html"],
exportOnly: true
},
{
rootNoteId: "jdjRLhLV3TtI",
- path: path.join("docs", "Developer Guide"),
+ path: path.join(DOCS_ROOT, "Developer Guide"),
format: "markdown"
},
{
rootNoteId: "hD3V4hiu2VW4",
- path: path.join("docs", "Release Notes"),
+ path: path.join(DOCS_ROOT, "Release Notes"),
format: "markdown"
}
];
@@ -96,6 +102,7 @@ async function createImportZip(path: string) {
zlib: { level: 0 }
});
+ console.log("Archive path is ", resolve(path))
archive.directory(path, "/");
const outputStream = fsExtra.createWriteStream(inputFile);
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8a2c0e695c..a46b0f6d95 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -386,7 +386,14 @@ importers:
version: 17.0.33
apps/edit-docs:
+ dependencies:
+ archiver:
+ specifier: 7.0.1
+ version: 7.0.1
devDependencies:
+ '@electron/rebuild':
+ specifier: 3.7.2
+ version: 3.7.2
'@triliumnext/client':
specifier: workspace:*
version: link:../client
@@ -399,6 +406,9 @@ importers:
copy-webpack-plugin:
specifier: 13.0.0
+ electron:
+ specifier: 35.1.5
+ version: 35.1.5
fs-extra:
specifier: 11.3.0
version: 11.3.0