mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
feat(edit-docs): initialize database automatically
This commit is contained in:
@@ -3,6 +3,8 @@ import fsExtra from "fs-extra";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import type NoteMeta from "./src/services/meta/note_meta.js";
|
import type NoteMeta from "./src/services/meta/note_meta.js";
|
||||||
import type { NoteMetaFile } from "./src/services/meta/note_meta.js";
|
import type { NoteMetaFile } from "./src/services/meta/note_meta.js";
|
||||||
|
import cls from "./src/services/cls.js";
|
||||||
|
import { initializeTranslations } from "./src/services/i18n.js";
|
||||||
|
|
||||||
const NOTE_ID_USER_GUIDE = "pOsGYCXsbNQG";
|
const NOTE_ID_USER_GUIDE = "pOsGYCXsbNQG";
|
||||||
const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide");
|
const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide");
|
||||||
@@ -12,8 +14,20 @@ async function startElectron() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
await initializeTranslations();
|
||||||
|
await importData();
|
||||||
|
|
||||||
await startElectron();
|
await startElectron();
|
||||||
await exportData();
|
// await exportData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function importData() {
|
||||||
|
const sql = (await import("./src/services/sql.js")).default;
|
||||||
|
const sqlInit = (await import("./src/services/sql_init.js")).default;
|
||||||
|
|
||||||
|
cls.init(() => {
|
||||||
|
sqlInit.createInitialDatabase();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportData() {
|
async function exportData() {
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ export function readZipFile(buffer: Buffer, processEntryCallback: (zipfile: yauz
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resolveNoteType(type: string | undefined): NoteType {
|
function resolveNoteType(type: string | undefined): NoteType {
|
||||||
// BC for ZIPs created in Triliun 0.57 and older
|
// BC for ZIPs created in Trilium 0.57 and older
|
||||||
if (type === "relation-map") {
|
if (type === "relation-map") {
|
||||||
return "relationMap";
|
return "relationMap";
|
||||||
} else if (type === "note-map") {
|
} else if (type === "note-map") {
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ function transactional<T>(func: (statement: Statement) => T) {
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.warn("Got error ", e);
|
||||||
const entityChangeIds = cls.getAndClearEntityChangeIds();
|
const entityChangeIds = cls.getAndClearEntityChangeIds();
|
||||||
|
|
||||||
if (entityChangeIds.length > 0) {
|
if (entityChangeIds.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user