mirror of
https://github.com/zadam/trilium.git
synced 2025-12-17 13:49:58 +01:00
fix(server/scripts): generate-document failing (closes #5422)
This commit is contained in:
@@ -6,10 +6,11 @@
|
|||||||
import sqlInit from "../src/services/sql_init.js";
|
import sqlInit from "../src/services/sql_init.js";
|
||||||
import noteService from "../src/services/notes.js";
|
import noteService from "../src/services/notes.js";
|
||||||
import attributeService from "../src/services/attributes.js";
|
import attributeService from "../src/services/attributes.js";
|
||||||
import cls from "../src/services/cls.js";
|
|
||||||
import cloningService from "../src/services/cloning.js";
|
import cloningService from "../src/services/cloning.js";
|
||||||
import loremIpsum from "lorem-ipsum";
|
import * as loremIpsum from "lorem-ipsum";
|
||||||
import "../src/becca/entity_constructor.js";
|
import "../src/becca/entity_constructor.js";
|
||||||
|
import { initializeTranslations } from "../src/services/i18n.js";
|
||||||
|
import cls from "../src/services/cls.js";
|
||||||
|
|
||||||
const noteCount = parseInt(process.argv[2]);
|
const noteCount = parseInt(process.argv[2]);
|
||||||
|
|
||||||
@@ -27,6 +28,16 @@ function getRandomNoteId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function start() {
|
async function start() {
|
||||||
|
if (!sqlInit.isDbInitialized()) {
|
||||||
|
console.error("Database not initialized.");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
await initializeTranslations();
|
||||||
|
|
||||||
|
sqlInit.initializeDb();
|
||||||
|
await sqlInit.dbReady;
|
||||||
|
|
||||||
for (let i = 0; i < noteCount; i++) {
|
for (let i = 0; i < noteCount; i++) {
|
||||||
const title = loremIpsum.loremIpsum({
|
const title = loremIpsum.loremIpsum({
|
||||||
count: 1,
|
count: 1,
|
||||||
@@ -90,6 +101,4 @@ async function start() {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TriliumNextTODO sqlInit.dbReady never seems to resolve so program hangs
|
cls.init(() => start());
|
||||||
// see https://github.com/TriliumNext/Trilium/issues/1020
|
|
||||||
sqlInit.dbReady.then(cls.wrap(start)).catch((err) => console.error(err));
|
|
||||||
|
|||||||
Reference in New Issue
Block a user