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-07-14 05:25:11 +00:00
|
|
|
lastUpdated: true,
|
|
|
|
appearance: false,
|
2022-11-17 03:38:01 +00:00
|
|
|
cleanUrls: 'with-subfolders',
|
2022-03-01 01:51:29 +00:00
|
|
|
themeConfig: {
|
2022-07-14 05:25:11 +00:00
|
|
|
logo: "/favicon.svg",
|
|
|
|
editLink: {
|
|
|
|
pattern: "https://github.com/profectus-engine/profectus-docs/edit/main/docs/:path",
|
|
|
|
editLinkText: "Edit this page on GitHub"
|
|
|
|
},
|
2022-03-01 01:51:29 +00:00
|
|
|
nav: [
|
2022-03-01 04:08:36 +00:00
|
|
|
{ text: "Guide", link: "/guide/", activeMatch: "^/guide/" },
|
2022-07-15 02:59:46 +00:00
|
|
|
{ text: "API", link: "/api/overview", activeMatch: "^/api/" },
|
2022-07-14 05:25:11 +00:00
|
|
|
{ text: "Forums", link: "https://forums.moddingtree.com" }
|
|
|
|
],
|
|
|
|
socialLinks: [
|
|
|
|
{ icon: "discord", link: "https://discord.gg/F3xveHV" },
|
|
|
|
{ icon: "github", link: "https://github.com/profectus-engine/Profectus" }
|
2022-03-01 01:51:29 +00:00
|
|
|
],
|
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",
|
2023-04-05 12:44:37 +00:00
|
|
|
collapsed: false,
|
2022-07-14 05:25:11 +00:00
|
|
|
items: [
|
2022-03-01 04:08:36 +00:00
|
|
|
{ text: "Introduction", link: "/guide/" },
|
2022-07-17 18:59:52 +00:00
|
|
|
{ text: "Setting Up", link: "/guide/getting-started/setup" },
|
|
|
|
{ text: "Updating Profectus", link: "/guide/getting-started/updating" },
|
2023-04-19 03:58:07 +00:00
|
|
|
{ text: "Your First Layer", link: "/guide/getting-started/first-layer" },
|
2023-04-06 05:15:28 +00:00
|
|
|
{ text: "Example Projects", link: "/guide/getting-started/examples" },
|
|
|
|
{ text: "Profectus Changelog", link: "https://github.com/profectus-engine/Profectus/blob/main/CHANGELOG.md" }
|
2022-03-03 01:28:57 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Creating Your Project",
|
2023-04-05 12:44:37 +00:00
|
|
|
collapsed: false,
|
2022-07-14 05:25:11 +00:00
|
|
|
items: [
|
2022-07-17 18:59:52 +00:00
|
|
|
{ text: "Project Info", link: "/guide/creating-your-project/project-info" },
|
|
|
|
{ text: "Project Entry", link: "/guide/creating-your-project/project-entry" },
|
|
|
|
{ text: "Changelog", link: "/guide/creating-your-project/changelog" },
|
|
|
|
{ text: "Themes", link: "/guide/creating-your-project/themes" },
|
|
|
|
{ text: "Utilities", link: "/guide/creating-your-project/utils" }
|
2022-03-06 04:34:42 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Important Concepts",
|
2023-04-05 12:44:37 +00:00
|
|
|
collapsed: false,
|
2022-07-14 05:25:11 +00:00
|
|
|
items: [
|
2022-07-17 18:59:52 +00:00
|
|
|
{ text: "Layers", link: "/guide/important-concepts/layers" },
|
|
|
|
{ text: "Features", link: "/guide/important-concepts/features" },
|
|
|
|
{ text: "Coercable Components", link: "/guide/important-concepts/coercable" },
|
|
|
|
{ text: "Reactivity", link: "/guide/important-concepts/reactivity" },
|
2023-04-08 01:49:31 +00:00
|
|
|
{ text: "Persistence", link: "/guide/important-concepts/persistence" },
|
2023-04-08 05:06:17 +00:00
|
|
|
{ text: "Requirements", link: "/guide/important-concepts/requirements" },
|
2023-04-08 01:49:31 +00:00
|
|
|
{ text: "Formulas", link: "/guide/important-concepts/formulas" }
|
2022-03-01 04:08:36 +00:00
|
|
|
]
|
|
|
|
},
|
2022-07-17 21:57:57 +00:00
|
|
|
{
|
|
|
|
text: "Recipes",
|
2023-04-05 12:44:37 +00:00
|
|
|
collapsed: false,
|
2022-07-17 21:57:57 +00:00
|
|
|
items: [
|
2023-04-10 02:40:12 +00:00
|
|
|
{ text: "Display Save Progress", link: "/guide/recipes/save-progress" },
|
|
|
|
{ text: "Display Particle Effect", link: "/guide/recipes/particles" }
|
2022-07-17 21:57:57 +00:00
|
|
|
]
|
|
|
|
},
|
2022-03-01 04:08:36 +00:00
|
|
|
{
|
2022-03-06 04:34:42 +00:00
|
|
|
text: "Advanced Concepts",
|
2023-04-05 12:44:37 +00:00
|
|
|
collapsed: false,
|
2022-07-14 05:25:11 +00:00
|
|
|
items: [
|
2022-07-17 18:59:52 +00:00
|
|
|
{ text: "Creating Features", link: "/guide/advanced-concepts/creating-features" },
|
2023-04-08 15:13:21 +00:00
|
|
|
{ text: "Dynamic Layers", link: "/guide/advanced-concepts/dynamic-layers" },
|
|
|
|
{ text: "Nodes", link: "/guide/advanced-concepts/nodes" }
|
2022-03-06 04:34:42 +00:00
|
|
|
]
|
2023-04-18 03:43:07 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Migrations",
|
|
|
|
collapsed: true,
|
|
|
|
items: [
|
|
|
|
{ text: "0.5.X to 0.6.0", link: "/guide/migrations/0-6" }
|
|
|
|
]
|
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 = [];
|
|
|
|
|
|
|
|
const modules = fs.readdirSync("./docs/api/modules");
|
2022-03-08 07:03:11 +00:00
|
|
|
modules.forEach(file => {
|
2023-04-05 12:44:37 +00:00
|
|
|
const moduleSidebar = { text: camelToTitle(file), items: [], collapsed: file === "lib" };
|
2022-03-11 03:10:53 +00:00
|
|
|
sidebar.push(moduleSidebar)
|
2022-07-14 05:25:11 +00:00
|
|
|
walk(path.join("./docs/api/modules", file), moduleSidebar.items);
|
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",
|
2022-07-14 05:25:11 +00:00
|
|
|
collapsed: true,
|
|
|
|
items: componentFolders
|
2022-03-11 02:30:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
sort(sidebar);
|
|
|
|
|
|
|
|
return sidebar;
|
|
|
|
}
|
|
|
|
|
|
|
|
function sort(sidebar) {
|
2022-07-14 05:25:11 +00:00
|
|
|
sidebar.filter(sidebar => !!sidebar.items).forEach(item => sort(item.items));
|
2022-03-11 02:30:55 +00:00
|
|
|
sidebar.sort((a, b) => {
|
2022-07-14 05:25:11 +00:00
|
|
|
if (a.items && !b.items) {
|
2022-03-11 02:30:55 +00:00
|
|
|
return -1;
|
2022-07-14 05:25:11 +00:00
|
|
|
} else if (!a.items && b.items) {
|
2022-03-11 02:30:55 +00:00
|
|
|
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()) {
|
2023-04-12 23:41:44 +00:00
|
|
|
const subSidebar = { text: camelToTitle(file), items: [], collapsed: true };
|
|
|
|
sidebar.push(subSidebar);
|
|
|
|
walk(resolvedFile, subSidebar.items);
|
2022-07-14 05:25:11 +00:00
|
|
|
} else if (!file.includes("Component") || dir.includes("components")) {
|
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;
|
|
|
|
}
|