feat: some static params

This commit is contained in:
TrèsAbhi committed 2024-09-08 20:56:48 -05:00
1 parent 8f44cdedd4
commit d306b51c2c
10 files changed
+61 -8

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@
"dev:website": "bun --filter=@blitzkit/website run dev",
"dev:api": "bun --filter=@blitzkit/api run dev",
"start:bot": "bun dist/bot/index.js",
"start:website": "next start",
"start:website": "bun --filter=@blitzkit/website run start",
"host:docs": "vitepress preview docs",
"lint": "tsc",
"lint:website": "next lint",
+2 -1
View File
@@ -4,7 +4,8 @@
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build"
"build": "next build",
"start": "next start"
},
"dependencies": {
"@radix-ui/themes": "^3.1.3",
@@ -0,0 +1 @@
export const PROVIDERS = ['wargaming', 'patreon'];
@@ -1,5 +1,9 @@
import { PROVIDERS } from './page';
import { PROVIDERS } from './constants';
export async function generateStaticParams() {
return PROVIDERS.map((provider) => ({ provider }));
}
export default function Layout({ children }: { children: React.ReactNode }) {
return children;
}
@@ -6,8 +6,6 @@ import { useEffect } from 'react';
import { PageWrapper } from '../../../components/PageWrapper';
import * as App from '../../../stores/app';
export const PROVIDERS = ['wargaming', 'patreon'];
export interface PatreonAuthResponse {
access_token: string;
expires_in: number;
@@ -0,0 +1,45 @@
import { assertSecret } from '@blitzkit/core';
export async function generateStaticParams() {
return await fetch(
`https://api.github.com/repos/tresabhi/blitzkit/contents/docs?ref=${assertSecret(
process.env.NEXT_PUBLIC_ASSET_BRANCH,
)}`,
)
.then((response) => response.json() as Promise<{ name: string }[]>)
.then((directories) =>
Promise.all(
directories
.filter(
(directory) =>
!['.vitepress', 'public', 'index.md'].includes(directory.name),
)
.map((directory) =>
fetch(
`https://api.github.com/repos/tresabhi/blitzkit/contents/docs/${directory.name}?ref=${assertSecret(
process.env.NEXT_PUBLIC_ASSET_BRANCH,
)}`,
)
.then(
(response) => response.json() as Promise<{ name: string }[]>,
)
.then((docs) =>
docs
.map((document) => {
console.log(`${directory.name}/${document.name}`);
return document;
})
.map((document) => ({
document: document.name.split('.').slice(0, -1).join('.'),
directory: directory.name,
})),
),
),
),
)
.then((docs) => docs.flat());
}
export default function Layout({ children }: { children: React.ReactNode }) {
return children;
}
@@ -3,6 +3,10 @@ import * as EmbedState from '../../../../stores/embedState';
import { configurations } from '../configurations';
import { extractEmbedConfigDefaults } from '../utilities';
export function generateStaticParams() {
return Object.keys(configurations).map((embed) => ({ embed }));
}
export default function Layout({
params,
children,
@@ -1,5 +1,5 @@
import { PageWrapper } from '../../../components/PageWrapper';
export function Page() {
export default function Page() {
return <PageWrapper></PageWrapper>;
}
+1 -1
View File
@@ -10,6 +10,6 @@
"include": [
"src/**/*",
".next/types/**/*.ts",
"dist/website/types/**/*.ts"
"../../dist/website/types/**/*.ts"
]
}
+1 -1
View File
@@ -20,5 +20,5 @@
}
]
},
"exclude": ["node_modules/**/*", "dist"]
"exclude": ["node_modules/**/*", "dist", ".next"]
}