diff --git a/.gitignore b/.gitignore index ee01f9a5..178e383f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules .vitepress/dist -api +docs/api components diff --git a/copyComponents.js b/copyComponents.js index 11dade5b..8ccc66fc 100644 --- a/copyComponents.js +++ b/copyComponents.js @@ -29,4 +29,4 @@ function walk(dir, dest) { }); }); } -walk("./components", "./api"); +walk("./components", "./docs/api"); diff --git a/.vitepress/config.js b/docs/.vitepress/config.js similarity index 78% rename from .vitepress/config.js rename to docs/.vitepress/config.js index 4ecc1bfb..c57e42c1 100644 --- a/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -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; - }) -} diff --git a/.vitepress/theme/Layout.vue b/docs/.vitepress/theme/Layout.vue similarity index 100% rename from .vitepress/theme/Layout.vue rename to docs/.vitepress/theme/Layout.vue diff --git a/.vitepress/theme/Profectus.vue b/docs/.vitepress/theme/Profectus.vue similarity index 100% rename from .vitepress/theme/Profectus.vue rename to docs/.vitepress/theme/Profectus.vue diff --git a/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css similarity index 100% rename from .vitepress/theme/custom.css rename to docs/.vitepress/theme/custom.css diff --git a/.vitepress/theme/home/HomeFeatures.vue b/docs/.vitepress/theme/home/HomeFeatures.vue similarity index 100% rename from .vitepress/theme/home/HomeFeatures.vue rename to docs/.vitepress/theme/home/HomeFeatures.vue diff --git a/.vitepress/theme/home/HomeFooter.vue b/docs/.vitepress/theme/home/HomeFooter.vue similarity index 100% rename from .vitepress/theme/home/HomeFooter.vue rename to docs/.vitepress/theme/home/HomeFooter.vue diff --git a/.vitepress/theme/home/HomeHero.vue b/docs/.vitepress/theme/home/HomeHero.vue similarity index 100% rename from .vitepress/theme/home/HomeHero.vue rename to docs/.vitepress/theme/home/HomeHero.vue diff --git a/.vitepress/theme/home/NavLink.vue b/docs/.vitepress/theme/home/NavLink.vue similarity index 100% rename from .vitepress/theme/home/NavLink.vue rename to docs/.vitepress/theme/home/NavLink.vue diff --git a/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js similarity index 100% rename from .vitepress/theme/index.js rename to docs/.vitepress/theme/index.js diff --git a/.vitepress/theme/vars.css b/docs/.vitepress/theme/vars.css similarity index 100% rename from .vitepress/theme/vars.css rename to docs/.vitepress/theme/vars.css diff --git a/guide/actionsbutton.png b/docs/guide/actionsbutton.png similarity index 100% rename from guide/actionsbutton.png rename to docs/guide/actionsbutton.png diff --git a/guide/changelog.md b/docs/guide/changelog.md similarity index 100% rename from guide/changelog.md rename to docs/guide/changelog.md diff --git a/guide/coercable.md b/docs/guide/coercable.md similarity index 100% rename from guide/coercable.md rename to docs/guide/coercable.md diff --git a/guide/creating-features.md b/docs/guide/creating-features.md similarity index 100% rename from guide/creating-features.md rename to docs/guide/creating-features.md diff --git a/guide/features.md b/docs/guide/features.md similarity index 100% rename from guide/features.md rename to docs/guide/features.md diff --git a/guide/gh-pages.png b/docs/guide/gh-pages.png similarity index 100% rename from guide/gh-pages.png rename to docs/guide/gh-pages.png diff --git a/guide/index.md b/docs/guide/index.md similarity index 100% rename from guide/index.md rename to docs/guide/index.md diff --git a/guide/layers.md b/docs/guide/layers.md similarity index 100% rename from guide/layers.md rename to docs/guide/layers.md diff --git a/guide/project-entry.md b/docs/guide/project-entry.md similarity index 100% rename from guide/project-entry.md rename to docs/guide/project-entry.md diff --git a/guide/project-info.md b/docs/guide/project-info.md similarity index 100% rename from guide/project-info.md rename to docs/guide/project-info.md diff --git a/guide/reactivity.md b/docs/guide/reactivity.md similarity index 100% rename from guide/reactivity.md rename to docs/guide/reactivity.md diff --git a/guide/setup.md b/docs/guide/setup.md similarity index 100% rename from guide/setup.md rename to docs/guide/setup.md diff --git a/guide/themes.md b/docs/guide/themes.md similarity index 100% rename from guide/themes.md rename to docs/guide/themes.md diff --git a/guide/updating.md b/docs/guide/updating.md similarity index 100% rename from guide/updating.md rename to docs/guide/updating.md diff --git a/guide/utils.md b/docs/guide/utils.md similarity index 100% rename from guide/utils.md rename to docs/guide/utils.md diff --git a/index.md b/docs/index.md similarity index 100% rename from index.md rename to docs/index.md diff --git a/public/Logo.png b/docs/public/Logo.png similarity index 100% rename from public/Logo.png rename to docs/public/Logo.png diff --git a/public/android-chrome-192x192.png b/docs/public/android-chrome-192x192.png similarity index 100% rename from public/android-chrome-192x192.png rename to docs/public/android-chrome-192x192.png diff --git a/public/android-chrome-512x512.png b/docs/public/android-chrome-512x512.png similarity index 100% rename from public/android-chrome-512x512.png rename to docs/public/android-chrome-512x512.png diff --git a/public/apple-touch-icon.png b/docs/public/apple-touch-icon.png similarity index 100% rename from public/apple-touch-icon.png rename to docs/public/apple-touch-icon.png diff --git a/public/favicon-16x16.png b/docs/public/favicon-16x16.png similarity index 100% rename from public/favicon-16x16.png rename to docs/public/favicon-16x16.png diff --git a/public/favicon-32x32.png b/docs/public/favicon-32x32.png similarity index 100% rename from public/favicon-32x32.png rename to docs/public/favicon-32x32.png diff --git a/public/favicon.ico b/docs/public/favicon.ico similarity index 100% rename from public/favicon.ico rename to docs/public/favicon.ico diff --git a/public/site.webmanifest b/docs/public/site.webmanifest similarity index 100% rename from public/site.webmanifest rename to docs/public/site.webmanifest diff --git a/package.json b/package.json index 44619e25..3713a7a2 100644 --- a/package.json +++ b/package.json @@ -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" },