mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 03:53:37 -06:00
fix(server/scripts): generate-document failing (closes #5422)
This commit is contained in:
parent
ebb1a3feb2
commit
ff08eadb23
@ -6,10 +6,11 @@
|
||||
import sqlInit from "../src/services/sql_init.js";
|
||||
import noteService from "../src/services/notes.js";
|
||||
import attributeService from "../src/services/attributes.js";
|
||||
import cls from "../src/services/cls.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 { initializeTranslations } from "../src/services/i18n.js";
|
||||
import cls from "../src/services/cls.js";
|
||||
|
||||
const noteCount = parseInt(process.argv[2]);
|
||||
|
||||
@ -27,6 +28,16 @@ function getRandomNoteId() {
|
||||
}
|
||||
|
||||
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++) {
|
||||
const title = loremIpsum.loremIpsum({
|
||||
count: 1,
|
||||
@ -90,6 +101,4 @@ async function start() {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// @TriliumNextTODO sqlInit.dbReady never seems to resolve so program hangs
|
||||
// see https://github.com/TriliumNext/Trilium/issues/1020
|
||||
sqlInit.dbReady.then(cls.wrap(start)).catch((err) => console.error(err));
|
||||
cls.init(() => start());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user