Re-organized project

This commit is contained in:
thepaperpilot 2022-03-10 21:10:53 -06:00
parent 63ac3c83e5
commit a6a74726aa
37 changed files with 14 additions and 30 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
node_modules node_modules
.vitepress/dist .vitepress/dist
api docs/api
components components

View file

@ -29,4 +29,4 @@ function walk(dir, dest) {
}); });
}); });
} }
walk("./components", "./api"); walk("./components", "./docs/api");

View file

@ -71,30 +71,23 @@ module.exports = {
} }
function generateAPISidebar() { function generateAPISidebar() {
const modules = fs.readdirSync("./api/modules").map(file => file.substr(0, file.length - 3)); const sidebar = [];
const moduleFolders = {};
const modules = fs.readdirSync("./docs/api/modules");
modules.forEach(file => { modules.forEach(file => {
// Split by _, but not break_eternity const moduleSidebar = { text: camelToTitle(file), children: [] };
const pieces = file.replace("break_eternity", "break~eternity").split(/_/).map(piece => piece === "break~eternity" ? "break_eternity" : piece); sidebar.push(moduleSidebar)
const lineItem = { text: camelToTitle(pieces[pieces.length - 1]), link: `/api/modules/${file}` }; walk(path.join("./docs/api/modules", file), moduleSidebar.children);
pieces.slice(0, pieces.length - 1).reduce((acc, curr) => {
// console.log(acc, curr);
if (!acc[curr]) {
acc[curr] = { text: camelToTitle(curr), children: [] };
}
return acc[curr].children;
}, moduleFolders).push(lineItem);
}); });
const sidebar = processFolders(moduleFolders);
const componentFolders = []; const componentFolders = [];
walk("./api/components", componentFolders); walk("./docs/api/components", componentFolders);
sidebar.unshift({ sidebar.unshift({
text: "Components", text: "Components",
children: componentFolders children: componentFolders
}); });
walk("./api/features", sidebar.find(item => item.text === "Features").children); walk("./docs/api/features", sidebar.find(item => item.text === "Features").children);
sort(sidebar); sort(sidebar);
@ -134,7 +127,7 @@ function walk(dir, sidebar) {
} }
walk(resolvedFile, folder.children); walk(resolvedFile, folder.children);
} else { } else {
sidebar.push({ text: camelToTitle(file.substr(0, file.length - 3)), link: resolvedFile.substr(0, resolvedFile.length - 3) + ".html" }); sidebar.push({ text: camelToTitle(file.substr(0, file.length - 3)), link: "/" + resolvedFile.substr(5, resolvedFile.length - 8).replace(/\\/g, "/") + ".html" });
} }
}); });
} }
@ -147,12 +140,3 @@ function camelToTitle(camel) {
title = title.charAt(0).toUpperCase() + title.slice(1); title = title.charAt(0).toUpperCase() + title.slice(1);
return title; return title;
} }
function processFolders(folders) {
return Object.values(folders).map(folder => {
if (folder.children) {
folder.children = processFolders(folder.children);
}
return folder;
})
}

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

View file

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -4,9 +4,9 @@
"description": "Documentation for the Profectus Engine", "description": "Documentation for the Profectus Engine",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"serve": "vitepress serve", "serve": "vitepress serve docs",
"dev": "vitepress dev", "dev": "vitepress dev docs",
"build": "vitepress build", "build": "vitepress build docs",
"typedoc": "cd profectus && vue-typedoc --logLevel Verbose --plugin typedoc-plugin-markdown --hideBreadcrumbs --hideInPageTOC --entryDocument index.md --plugin typedoc-plugin-rename-defaults --plugin typedoc-plugin-mdn-links", "typedoc": "cd profectus && vue-typedoc --logLevel Verbose --plugin typedoc-plugin-markdown --hideBreadcrumbs --hideInPageTOC --entryDocument index.md --plugin typedoc-plugin-rename-defaults --plugin typedoc-plugin-mdn-links",
"docgen": "vue-docgen -c docgen.config.js && node copyComponents.js" "docgen": "vue-docgen -c docgen.config.js && node copyComponents.js"
}, },