mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-20 02:37:21 +08:00
feat(edit-docs): clean up meta
This commit is contained in:
parent
bffb0963df
commit
6a549af34a
@ -1,8 +1,11 @@
|
||||
import fs from "fs/promises";
|
||||
import fsExtra from "fs-extra";
|
||||
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 destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide");
|
||||
|
||||
async function startElectron() {
|
||||
await import("./electron-main.js");
|
||||
@ -15,7 +18,6 @@ async function main() {
|
||||
|
||||
async function exportData() {
|
||||
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;
|
||||
|
||||
@ -51,6 +53,26 @@ async function exportData() {
|
||||
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();
|
||||
|
@ -173,7 +173,7 @@
|
||||
"title": "Basic Concepts",
|
||||
"notePosition": 60,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -200,7 +200,7 @@
|
||||
"title": "UI Elements",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -275,7 +275,7 @@
|
||||
"title": "Note",
|
||||
"notePosition": 20,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -968,7 +968,7 @@
|
||||
"title": "Navigation",
|
||||
"notePosition": 30,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -1407,7 +1407,7 @@
|
||||
"title": "Themes",
|
||||
"notePosition": 60,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -1518,7 +1518,7 @@
|
||||
"title": "Import & Export",
|
||||
"notePosition": 70,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -1594,7 +1594,7 @@
|
||||
"title": "Evernote",
|
||||
"notePosition": 20,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -1744,7 +1744,7 @@
|
||||
"title": "Note Types",
|
||||
"notePosition": 70,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -1771,7 +1771,7 @@
|
||||
"title": "Text",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -2742,7 +2742,7 @@
|
||||
"title": "Advanced Usage",
|
||||
"notePosition": 90,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -2769,7 +2769,7 @@
|
||||
"title": "Attributes",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -3218,7 +3218,7 @@
|
||||
"title": "Sharing",
|
||||
"notePosition": 50,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -3348,7 +3348,7 @@
|
||||
"title": "Code Notes",
|
||||
"notePosition": 60,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -3591,7 +3591,7 @@
|
||||
"title": "Advanced Showcases",
|
||||
"notePosition": 70,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -4104,7 +4104,7 @@
|
||||
"title": "Database",
|
||||
"notePosition": 130,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -4196,7 +4196,7 @@
|
||||
"title": "Manually altering the database",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -4415,7 +4415,7 @@
|
||||
"title": "Theme development",
|
||||
"notePosition": 100,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -4618,7 +4618,7 @@
|
||||
"title": "Developer Guides",
|
||||
"notePosition": 120,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -4741,7 +4741,7 @@
|
||||
"title": "Examples",
|
||||
"notePosition": 30,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -4811,7 +4811,7 @@
|
||||
"title": "REST API",
|
||||
"notePosition": 40,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -4831,7 +4831,7 @@
|
||||
"title": "ETAPI",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -4881,7 +4881,7 @@
|
||||
"title": "Internal API",
|
||||
"notePosition": 20,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -4933,7 +4933,7 @@
|
||||
"title": "Installation & Setup",
|
||||
"notePosition": 160,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -5008,7 +5008,7 @@
|
||||
"title": "Server Installation",
|
||||
"notePosition": 20,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -5121,7 +5121,7 @@
|
||||
"title": "1. Installing the server",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -5323,7 +5323,7 @@
|
||||
"title": "2. Reverse proxy",
|
||||
"notePosition": 20,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [],
|
||||
@ -5948,7 +5948,7 @@
|
||||
"title": "Troubleshooting",
|
||||
"notePosition": 180,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/markdown",
|
||||
"attributes": [
|
||||
@ -6238,7 +6238,7 @@
|
||||
"title": "Attachments",
|
||||
"notePosition": 190,
|
||||
"prefix": null,
|
||||
"isExpanded": true,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
@ -7794,15 +7794,18 @@
|
||||
},
|
||||
{
|
||||
"noImport": true,
|
||||
"dataFileName": "navigation.html"
|
||||
"dataFileName": "navigation.html",
|
||||
"isExpanded": false
|
||||
},
|
||||
{
|
||||
"noImport": true,
|
||||
"dataFileName": "index.html"
|
||||
"dataFileName": "index.html",
|
||||
"isExpanded": false
|
||||
},
|
||||
{
|
||||
"noImport": true,
|
||||
"dataFileName": "style.css"
|
||||
"dataFileName": "style.css",
|
||||
"isExpanded": false
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user