feat(edit-docs): clean up meta

This commit is contained in:
Elian Doran 2025-03-10 16:37:39 +02:00
parent bffb0963df
commit 6a549af34a
No known key found for this signature in database
2 changed files with 7832 additions and 7807 deletions

View File

@ -1,8 +1,11 @@
import fs from "fs/promises"; import fs from "fs/promises";
import fsExtra from "fs-extra"; 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 { NoteMetaFile } from "./src/services/meta/note_meta.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");
async function startElectron() { async function startElectron() {
await import("./electron-main.js"); await import("./electron-main.js");
@ -15,7 +18,6 @@ async function main() {
async function exportData() { async function exportData() {
const zipFilePath = "output.zip"; const zipFilePath = "output.zip";
const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide");
const deferred = (await import("./src/services/utils.js")).deferred; const deferred = (await import("./src/services/utils.js")).deferred;
@ -51,6 +53,26 @@ async function exportData() {
await fsExtra.rm(zipFilePath); await fsExtra.rm(zipFilePath);
} }
} }
await cleanUpMeta();
}
async function cleanUpMeta() {
const metaPath = path.join(destRootPath, "!!!meta.json");
const meta = JSON.parse(await fs.readFile(metaPath, "utf-8")) as NoteMetaFile;
for (const file of meta.files) {
traverse(file);
}
function traverse(el: NoteMeta) {
for (const child of el.children || []) {
traverse(child);
}
el.isExpanded = false;
}
await fs.writeFile(metaPath, JSON.stringify(meta, null, 4));
} }
await main(); await main();

View File

@ -173,7 +173,7 @@
"title": "Basic Concepts", "title": "Basic Concepts",
"notePosition": 60, "notePosition": 60,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -200,7 +200,7 @@
"title": "UI Elements", "title": "UI Elements",
"notePosition": 10, "notePosition": 10,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -275,7 +275,7 @@
"title": "Note", "title": "Note",
"notePosition": 20, "notePosition": 20,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -968,7 +968,7 @@
"title": "Navigation", "title": "Navigation",
"notePosition": 30, "notePosition": 30,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -1407,7 +1407,7 @@
"title": "Themes", "title": "Themes",
"notePosition": 60, "notePosition": 60,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -1518,7 +1518,7 @@
"title": "Import & Export", "title": "Import & Export",
"notePosition": 70, "notePosition": 70,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -1594,7 +1594,7 @@
"title": "Evernote", "title": "Evernote",
"notePosition": 20, "notePosition": 20,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -1744,7 +1744,7 @@
"title": "Note Types", "title": "Note Types",
"notePosition": 70, "notePosition": 70,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -1771,7 +1771,7 @@
"title": "Text", "title": "Text",
"notePosition": 10, "notePosition": 10,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -2742,7 +2742,7 @@
"title": "Advanced Usage", "title": "Advanced Usage",
"notePosition": 90, "notePosition": 90,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -2769,7 +2769,7 @@
"title": "Attributes", "title": "Attributes",
"notePosition": 10, "notePosition": 10,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -3218,7 +3218,7 @@
"title": "Sharing", "title": "Sharing",
"notePosition": 50, "notePosition": 50,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -3348,7 +3348,7 @@
"title": "Code Notes", "title": "Code Notes",
"notePosition": 60, "notePosition": 60,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -3591,7 +3591,7 @@
"title": "Advanced Showcases", "title": "Advanced Showcases",
"notePosition": 70, "notePosition": 70,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -4104,7 +4104,7 @@
"title": "Database", "title": "Database",
"notePosition": 130, "notePosition": 130,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -4196,7 +4196,7 @@
"title": "Manually altering the database", "title": "Manually altering the database",
"notePosition": 10, "notePosition": 10,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -4415,7 +4415,7 @@
"title": "Theme development", "title": "Theme development",
"notePosition": 100, "notePosition": 100,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -4618,7 +4618,7 @@
"title": "Developer Guides", "title": "Developer Guides",
"notePosition": 120, "notePosition": 120,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -4741,7 +4741,7 @@
"title": "Examples", "title": "Examples",
"notePosition": 30, "notePosition": 30,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -4811,7 +4811,7 @@
"title": "REST API", "title": "REST API",
"notePosition": 40, "notePosition": 40,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -4831,7 +4831,7 @@
"title": "ETAPI", "title": "ETAPI",
"notePosition": 10, "notePosition": 10,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -4881,7 +4881,7 @@
"title": "Internal API", "title": "Internal API",
"notePosition": 20, "notePosition": 20,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -4933,7 +4933,7 @@
"title": "Installation & Setup", "title": "Installation & Setup",
"notePosition": 160, "notePosition": 160,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -5008,7 +5008,7 @@
"title": "Server Installation", "title": "Server Installation",
"notePosition": 20, "notePosition": 20,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -5121,7 +5121,7 @@
"title": "1. Installing the server", "title": "1. Installing the server",
"notePosition": 10, "notePosition": 10,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -5323,7 +5323,7 @@
"title": "2. Reverse proxy", "title": "2. Reverse proxy",
"notePosition": 20, "notePosition": 20,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -5948,7 +5948,7 @@
"title": "Troubleshooting", "title": "Troubleshooting",
"notePosition": 180, "notePosition": 180,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/markdown", "mime": "text/markdown",
"attributes": [ "attributes": [
@ -6238,7 +6238,7 @@
"title": "Attachments", "title": "Attachments",
"notePosition": 190, "notePosition": 190,
"prefix": null, "prefix": null,
"isExpanded": true, "isExpanded": false,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -7794,15 +7794,18 @@
}, },
{ {
"noImport": true, "noImport": true,
"dataFileName": "navigation.html" "dataFileName": "navigation.html",
"isExpanded": false
}, },
{ {
"noImport": true, "noImport": true,
"dataFileName": "index.html" "dataFileName": "index.html",
"isExpanded": false
}, },
{ {
"noImport": true, "noImport": true,
"dataFileName": "style.css" "dataFileName": "style.css",
"isExpanded": false
} }
] ]
} }