mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	feat(edit-docs): periodic export
This commit is contained in:
		| @@ -7,6 +7,7 @@ import cls from "./src/services/cls.js"; | |||||||
| import { initializeTranslations } from "./src/services/i18n.js"; | import { initializeTranslations } from "./src/services/i18n.js"; | ||||||
| import archiver, { type Archiver } from "archiver"; | import archiver, { type Archiver } from "archiver"; | ||||||
| import type { WriteStream } from "fs"; | import type { WriteStream } from "fs"; | ||||||
|  | import debounce from "./src/public/app/services/debounce.js"; | ||||||
|  |  | ||||||
| const NOTE_ID_USER_GUIDE = "help_user_guide"; | const NOTE_ID_USER_GUIDE = "help_user_guide"; | ||||||
| const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide"); | const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide"); | ||||||
| @@ -24,7 +25,17 @@ async function main() { | |||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     await startElectron(); |     await startElectron(); | ||||||
|     // await exportData(); |  | ||||||
|  |  | ||||||
|  |     const events = (await import("./src/services/events.js")).default; | ||||||
|  |     const debouncer = debounce(() => { | ||||||
|  |         console.log("Exporting data"); | ||||||
|  |         exportData(); | ||||||
|  |     }, 10_000);; | ||||||
|  |     events.subscribe(events.ENTITY_CHANGED, async () => { | ||||||
|  |         console.log("Got entity changed"); | ||||||
|  |         debouncer(); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| async function initializeDatabase() { | async function initializeDatabase() { | ||||||
|   | |||||||
| @@ -17,7 +17,9 @@ if (isDev) { | |||||||
|     const debounce = (await import("debounce")).default; |     const debounce = (await import("debounce")).default; | ||||||
|     const debouncedReloadFrontend = debounce(() => reloadFrontend("source code change"), 200); |     const debouncedReloadFrontend = debounce(() => reloadFrontend("source code change"), 200); | ||||||
|     chokidar |     chokidar | ||||||
|         .watch("src/public") |         .watch("src/public", { | ||||||
|  |             ignored: "src/public/app/doc_notes/en/User Guide" | ||||||
|  |         }) | ||||||
|         .on("add", debouncedReloadFrontend) |         .on("add", debouncedReloadFrontend) | ||||||
|         .on("change", debouncedReloadFrontend) |         .on("change", debouncedReloadFrontend) | ||||||
|         .on("unlink", debouncedReloadFrontend); |         .on("unlink", debouncedReloadFrontend); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user