mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 13:56:11 +01:00
fix(build-docs): error due to becca not loading
This commit is contained in:
@@ -16,7 +16,7 @@ const OUTPUT_DIR = "../../site";
|
|||||||
|
|
||||||
async function importAndExportDocs(sourcePath: string, outputSubDir: string) {
|
async function importAndExportDocs(sourcePath: string, outputSubDir: string) {
|
||||||
const note = await importData(sourcePath);
|
const note = await importData(sourcePath);
|
||||||
|
|
||||||
// Use a meaningful name for the temporary zip file
|
// Use a meaningful name for the temporary zip file
|
||||||
const zipName = outputSubDir || "user-guide";
|
const zipName = outputSubDir || "user-guide";
|
||||||
const zipFilePath = `output-${zipName}.zip`;
|
const zipFilePath = `output-${zipName}.zip`;
|
||||||
@@ -31,7 +31,7 @@ async function importAndExportDocs(sourcePath: string, outputSubDir: string) {
|
|||||||
const fileOutputStream = fsExtra.createWriteStream(zipFilePath);
|
const fileOutputStream = fsExtra.createWriteStream(zipFilePath);
|
||||||
await exportToZip(taskContext, branch, "share", fileOutputStream);
|
await exportToZip(taskContext, branch, "share", fileOutputStream);
|
||||||
await waitForStreamToFinish(fileOutputStream);
|
await waitForStreamToFinish(fileOutputStream);
|
||||||
|
|
||||||
// Output to root directory if outputSubDir is empty, otherwise to subdirectory
|
// Output to root directory if outputSubDir is empty, otherwise to subdirectory
|
||||||
const outputPath = outputSubDir ? join(OUTPUT_DIR, outputSubDir) : OUTPUT_DIR;
|
const outputPath = outputSubDir ? join(OUTPUT_DIR, outputSubDir) : OUTPUT_DIR;
|
||||||
await extractZip(zipFilePath, outputPath);
|
await extractZip(zipFilePath, outputPath);
|
||||||
@@ -48,7 +48,7 @@ async function buildDocsInner() {
|
|||||||
|
|
||||||
const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
|
const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
|
||||||
await sqlInit.createInitialDatabase(true);
|
await sqlInit.createInitialDatabase(true);
|
||||||
|
|
||||||
// Wait for becca to be loaded before importing data
|
// Wait for becca to be loaded before importing data
|
||||||
const beccaLoader = await import("../../server/src/becca/becca_loader.js");
|
const beccaLoader = await import("../../server/src/becca/becca_loader.js");
|
||||||
await beccaLoader.beccaLoaded;
|
await beccaLoader.beccaLoaded;
|
||||||
@@ -72,9 +72,8 @@ export async function importData(path: string) {
|
|||||||
const importService = (await import("../../server/src/services/import/zip.js")).default;
|
const importService = (await import("../../server/src/services/import/zip.js")).default;
|
||||||
const TaskContext = (await import("../../server/src/services/task_context.js")).default;
|
const TaskContext = (await import("../../server/src/services/task_context.js")).default;
|
||||||
const context = new TaskContext("no-progress-reporting", "importNotes", null);
|
const context = new TaskContext("no-progress-reporting", "importNotes", null);
|
||||||
const beccaLoader = (await import("../../server/src/becca/becca_loader.js")).default;
|
const becca = (await import("../../server/src/becca/becca.js")).default;
|
||||||
const becca = beccaLoader.becca;
|
|
||||||
|
|
||||||
const rootNote = becca.getRoot();
|
const rootNote = becca.getRoot();
|
||||||
if (!rootNote) {
|
if (!rootNote) {
|
||||||
throw new Error("Missing root note for import.");
|
throw new Error("Missing root note for import.");
|
||||||
|
|||||||
@@ -293,6 +293,5 @@ eventService.subscribeBeccaLoader(eventService.LEAVE_PROTECTED_SESSION, load);
|
|||||||
export default {
|
export default {
|
||||||
load,
|
load,
|
||||||
reload,
|
reload,
|
||||||
beccaLoaded,
|
beccaLoaded
|
||||||
becca
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user