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
.vitepress/dist
api
docs/api
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() {
const modules = fs.readdirSync("./api/modules").map(file => file.substr(0, file.length - 3));
const moduleFolders = {};
const sidebar = [];
const modules = fs.readdirSync("./docs/api/modules");
modules.forEach(file => {
// Split by _, but not break_eternity
const pieces = file.replace("break_eternity", "break~eternity").split(/_/).map(piece => piece === "break~eternity" ? "break_eternity" : piece);
const lineItem = { text: camelToTitle(pieces[pieces.length - 1]), link: `/api/modules/${file}` };
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 moduleSidebar = { text: camelToTitle(file), children: [] };
sidebar.push(moduleSidebar)
walk(path.join("./docs/api/modules", file), moduleSidebar.children);
});
const sidebar = processFolders(moduleFolders);
const componentFolders = [];
walk("./api/components", componentFolders);
walk("./docs/api/components", componentFolders);
sidebar.unshift({
text: "Components",
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);
@ -134,7 +127,7 @@ function walk(dir, sidebar) {
}
walk(resolvedFile, folder.children);
} 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);
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",
"main": "index.js",
"scripts": {
"serve": "vitepress serve",
"dev": "vitepress dev",
"build": "vitepress build",
"serve": "vitepress serve docs",
"dev": "vitepress dev docs",
"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",
"docgen": "vue-docgen -c docgen.config.js && node copyComponents.js"
},