Skip to content

Commit

Permalink
docs(vuepress): extract additionalpages to new plugin and adjust chan…
Browse files Browse the repository at this point in the history
…gelog sidebar headers
  • Loading branch information
zikeji committed Oct 20, 2020
1 parent df68bf6 commit 41728e6
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 56 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/components/OpenAPI.vue
Expand Up @@ -78,7 +78,7 @@ export default {
spec,
domNode,
docExpansion: "list",
deepLinking: false,
deepLinking: true,
syntaxHighlight: false,
persistAuthorization: true,
defaultModelsExpandDepth: 3,
Expand Down
52 changes: 6 additions & 46 deletions docs/.vuepress/config.js
Expand Up @@ -29,43 +29,6 @@ module.exports = config({
title: name,
description: description,
cache: process.env.NODE_ENV === "production",
additionalPages: [
{
path: "/",
filePath: resolve(__dirname, "../../README.md"),
frontmatter: {
home: true,
heroText: "@zikeji/hypixel",
heroImage: "/logo.svg",
tagline: "NodeJS API wrapper for Hypixel's Public API",
action: [
{
text: "Get Started →",
link: "/guide/"
},
],
features: [
{
title: "Rate Limiting Queue",
details: "Built in async rate limiting queue prevents prevents requests from failing by queueing and waiting for the queue to clear."
}, {
title: "OpenAPI 3.0 Definition",
details: "I've painstakingly recreated Hypixel's API methods and responses in the OpenAPI 3.0 specification.",
link: "/api/"
},
{
title: "Typescript Support",
details: "Full Typescript definitions for explored API methods provides intellisense in popular IDEs.",
link: "/ts-api/classes/client/#constructor"
},
],
},
},
{
path: "/changelog/",
filePath: resolve(__dirname, "../../CHANGELOG.md"),
},
],
head: [
["link", { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }],
["link", { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" }],
Expand Down Expand Up @@ -107,11 +70,8 @@ module.exports = config({
]
},
],
sidebar: {
"/": [],
"/changelog/": [],
},
pageInfo: ["Category", "Tag"],
sidebar: "auto",
footer: {
display: true,
content: `<div class="addthis_inline_share_toolbox"></div>`,
Expand Down Expand Up @@ -149,11 +109,10 @@ module.exports = config({
out: "ts-api",
readme: "none",
categoryOrder: ["Public", "*", "Custom", "Other"],
// toc: [
// "Classes",
// "Interfaces"
// ],
includeDeclarations: true,
toc: [
"Classes",
"Interfaces"
],
excludeExternals: true,
excludeNotExported: true,
excludePrivate: true,
Expand All @@ -166,5 +125,6 @@ module.exports = config({
plugin: ["typedoc-plugin-no-inherit"],
},
],
require("./plugins/pages"),
],
});
2 changes: 1 addition & 1 deletion docs/.vuepress/enhanceApp.js
@@ -1,4 +1,4 @@
export default ({ router }) => {
export default ({router}) => {
if (typeof window !== 'undefined' && process.env.NODE_ENV === 'production') {
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
Expand Down
57 changes: 57 additions & 0 deletions docs/.vuepress/plugins/pages.js
@@ -0,0 +1,57 @@
const { resolve } = require("path");

/**
* @type {import('@mr-hope/vuepress-types/types/plugin').PluginOptionAPI}
*/
module.exports = {
name: "pages-plugin",
additionalPages: [
{
path: "/",
filePath: resolve(__dirname, "../", "../", "../", "README.md"),
frontmatter: {
home: true,
sidebar: "auto",
heroText: "@zikeji/hypixel",
heroImage: "/logo.svg",
tagline: "NodeJS API wrapper for Hypixel's Public API",
action: [
{
text: "Get Started →",
link: "/guide/"
},
],
features: [
{
title: "Rate Limiting Queue",
details: "Built in async rate limiting queue prevents prevents requests from failing by queueing and waiting for the queue to clear."
}, {
title: "OpenAPI 3.0 Definition",
details: "I've painstakingly recreated Hypixel's API methods and responses in the OpenAPI 3.0 specification.",
link: "/api/"
},
{
title: "Typescript Support",
details: "Full Typescript definitions for explored API methods provides intellisense in popular IDEs.",
link: "/ts-api/classes/client/#constructor"
},
],
},
},
{
path: "/changelog/",
filePath: resolve(__dirname, "../", "../", "../", "CHANGELOG.md"),
frontmatter: {
sidebar: "auto",
// sidebarDepth: 1
}
},
],
extendPageData($page) {
switch ($page.path) {
case "/changelog/":
$page.headers = $page.headers.filter(h => h.level <= 1 || h.title.match(/^\d+\.\d+\.\d+$/));
break;
}
}
}
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -212,6 +212,7 @@
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@mdi/svg": "^5.7.55",
"@mr-hope/vuepress-types": "^1.2.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/chai": "^4.2.14",
Expand Down

0 comments on commit 41728e6

Please sign in to comment.