2022-03-08 07:03:11 +00:00
|
|
|
const fs = require("fs");
|
2022-03-11 02:30:55 +00:00
|
|
|
const path = require("path");
|
2022-03-08 07:03:11 +00:00
|
|
|
|
2022-03-01 01:51:29 +00:00
|
|
|
module.exports = {
|
|
|
|
lang: "en-US",
|
|
|
|
title: 'Profectus',
|
|
|
|
description: 'A game engine that grows with you.',
|
2022-03-01 04:08:36 +00:00
|
|
|
head: [
|
2022-03-11 02:30:55 +00:00
|
|
|
['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,400;0,600;1,400' }],
|
2022-03-03 01:35:06 +00:00
|
|
|
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }],
|
|
|
|
['link', { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png' }],
|
|
|
|
['link', { rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-16x16.png' }],
|
2022-03-03 01:40:52 +00:00
|
|
|
['link', { rel: 'manifest', href: '/site.webmanifest' }],
|
2022-03-03 01:55:07 +00:00
|
|
|
['script', { defer: true, 'data-domain': 'moddingtree.com', src: 'https://plausible.io/js/plausible.js' }],
|
|
|
|
['meta', { name: 'og:description', content: 'A game engine that grows with you' }],
|
|
|
|
['meta', { name: 'og:image', content: '/Logo.png' }]
|
2022-03-01 04:08:36 +00:00
|
|
|
],
|
2022-03-01 01:51:29 +00:00
|
|
|
themeConfig: {
|
2022-03-01 04:08:36 +00:00
|
|
|
repo: 'profectus-engine/profectus-docs',
|
2022-03-11 07:01:48 +00:00
|
|
|
docsDir: 'docs',
|
2022-03-01 04:08:36 +00:00
|
|
|
docsBranch: 'main',
|
|
|
|
editLinks: true,
|
|
|
|
editLinkText: 'Edit this page on GitHub',
|
|
|
|
lastUpdated: 'Last Updated',
|
2022-03-01 01:51:29 +00:00
|
|
|
nav: [
|
2022-03-01 04:08:36 +00:00
|
|
|
{ text: "Guide", link: "/guide/", activeMatch: "^/guide/" },
|
2022-03-01 05:50:38 +00:00
|
|
|
{ text: "API", link: "/api/", activeMatch: "^/api/" },
|
2022-03-01 01:51:29 +00:00
|
|
|
{ text: "Forums", link: "https://forums.moddingtree.com" },
|
|
|
|
{ text: "Discord", link: "https://discord.gg/F3xveHV" },
|
|
|
|
{ text: "Github", link: "https://github.com/profectus-engine/Profectus" }
|
|
|
|
],
|
2022-03-01 05:50:38 +00:00
|
|
|
sidebar: {
|
|
|
|
"/guide/": [
|
2022-03-01 04:08:36 +00:00
|
|
|
{
|
2022-03-03 01:28:57 +00:00
|
|
|
text: "Getting Started",
|
2022-03-01 04:08:36 +00:00
|
|
|
children: [
|
|
|
|
{ text: "Introduction", link: "/guide/" },
|
2022-03-03 01:28:57 +00:00
|
|
|
{ text: "Setting Up", link: "/guide/setup" },
|
2022-03-11 15:46:51 +00:00
|
|
|
{ text: "Updating Profectus", link: "/guide/updating" },
|
|
|
|
{ text: "Example Projects", link: "/guide/examples" }
|
2022-03-03 01:28:57 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Creating Your Project",
|
|
|
|
children: [
|
|
|
|
{ text: "Project Info", link: "/guide/project-info" },
|
|
|
|
{ text: "Project Entry", link: "/guide/project-entry" },
|
|
|
|
{ text: "Changelog", link: "/guide/changelog" },
|
2022-03-06 04:34:42 +00:00
|
|
|
{ text: "Themes", link: "/guide/themes" },
|
|
|
|
{ text: "Utilities", link: "/guide/utils" }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Important Concepts",
|
|
|
|
children: [
|
|
|
|
{ text: "Layers", link: "/guide/layers" },
|
|
|
|
{ text: "Features", link: "/guide/features" },
|
|
|
|
{ text: "Coercable Components", link: "/guide/coercable" },
|
2022-03-19 03:47:55 +00:00
|
|
|
{ text: "Reactivity", link: "/guide/reactivity" },
|
|
|
|
{ text: "Persistence", link: "/guide/persistence" }
|
2022-03-01 04:08:36 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2022-03-06 04:34:42 +00:00
|
|
|
text: "Advanced Concepts",
|
|
|
|
children: [
|
2022-03-11 15:46:59 +00:00
|
|
|
{ text: "Creating Features", link: "/guide/creating-features" },
|
|
|
|
{ text: "Dynamic Layers", link: "/guide/dynamic-layers" }
|
2022-03-06 04:34:42 +00:00
|
|
|
]
|
2022-03-01 04:08:36 +00:00
|
|
|
}
|
2022-03-01 05:50:38 +00:00
|
|
|
],
|
2022-03-08 07:03:11 +00:00
|
|
|
"/api/": generateAPISidebar()
|
2022-03-01 05:50:38 +00:00
|
|
|
}
|
2022-03-01 01:51:29 +00:00
|
|
|
}
|
|
|
|
}
|
2022-03-08 07:03:11 +00:00
|
|
|
|
|
|
|
function generateAPISidebar() {
|
2022-03-11 03:10:53 +00:00
|
|
|
const sidebar = [];
|
|
|
|
|
2022-03-11 06:44:40 +00:00
|
|
|
console.log(path.resolve("./docs/api/modules"))
|
2022-03-11 03:10:53 +00:00
|
|
|
const modules = fs.readdirSync("./docs/api/modules");
|
2022-03-08 07:03:11 +00:00
|
|
|
modules.forEach(file => {
|
2022-03-11 03:10:53 +00:00
|
|
|
const moduleSidebar = { text: camelToTitle(file), children: [] };
|
|
|
|
sidebar.push(moduleSidebar)
|
|
|
|
walk(path.join("./docs/api/modules", file), moduleSidebar.children);
|
2022-03-11 02:30:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const componentFolders = [];
|
2022-03-11 03:10:53 +00:00
|
|
|
walk("./docs/api/components", componentFolders);
|
2022-03-11 02:30:55 +00:00
|
|
|
sidebar.unshift({
|
|
|
|
text: "Components",
|
|
|
|
children: componentFolders
|
|
|
|
});
|
|
|
|
|
2022-03-11 03:10:53 +00:00
|
|
|
walk("./docs/api/features", sidebar.find(item => item.text === "Features").children);
|
2022-03-11 02:30:55 +00:00
|
|
|
|
|
|
|
sort(sidebar);
|
|
|
|
|
|
|
|
return sidebar;
|
|
|
|
}
|
|
|
|
|
|
|
|
function sort(sidebar) {
|
|
|
|
sidebar.filter(sidebar => !!sidebar.children).forEach(item => sort(item.children));
|
|
|
|
sidebar.sort((a, b) => {
|
|
|
|
if (a.children && !b.children) {
|
|
|
|
return -1;
|
|
|
|
} else if (!a.children && b.children) {
|
|
|
|
return 1;
|
|
|
|
} else if (a.text > b.text) {
|
|
|
|
return 1;
|
|
|
|
} else if (a.text < b.text) {
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function walk(dir, sidebar) {
|
|
|
|
const files = fs.readdirSync(dir);
|
|
|
|
files.forEach(file => {
|
|
|
|
const resolvedFile = path.join(dir, file);
|
|
|
|
const stat = fs.statSync(resolvedFile);
|
|
|
|
if (stat.isDirectory()) {
|
|
|
|
let folder = sidebar.find(item => item.text === camelToTitle(file));
|
|
|
|
if (!folder) {
|
|
|
|
folder = {
|
|
|
|
text: camelToTitle(file),
|
|
|
|
children: []
|
|
|
|
};
|
|
|
|
sidebar.push(folder);
|
|
|
|
}
|
|
|
|
walk(resolvedFile, folder.children);
|
|
|
|
} else {
|
2022-03-11 03:10:53 +00:00
|
|
|
sidebar.push({ text: camelToTitle(file.substr(0, file.length - 3)), link: "/" + resolvedFile.substr(5, resolvedFile.length - 8).replace(/\\/g, "/") + ".html" });
|
2022-03-11 02:30:55 +00:00
|
|
|
}
|
2022-03-08 07:03:11 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function camelToTitle(camel) {
|
|
|
|
if (camel === "break_eternity") {
|
|
|
|
return "Break Eternity";
|
|
|
|
}
|
|
|
|
let title = camel.replace(/([A-Z])/g, " $1");
|
|
|
|
title = title.charAt(0).toUpperCase() + title.slice(1);
|
|
|
|
return title;
|
|
|
|
}
|