fix: handle older generated docs better

This commit is contained in:
iCrawl
2023-11-08 12:30:32 +01:00
parent fffe70a039
commit 2bda883a0f
6 changed files with 28 additions and 13 deletions

View File

@@ -1,10 +1,5 @@
name: Deploy website
on:
push:
branches:
- 'main'
paths:
- 'apps/website/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
@@ -27,10 +22,19 @@ jobs:
- name: Build dependencies
run: pnpm run build
- name: Cache .next/cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('apps/website/**/*.ts', 'apps/website/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-
- name: Pull vercel production environment
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build website Artifacts
- name: Build website artifacts
run: pnpm exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Build & deploy website

View File

@@ -99,7 +99,7 @@ jobs:
- name: Move docs to correct directory
if: ${{ github.ref_type == 'branch' }}
run: |
declare -a PACKAGES=("brokers" "builders" "collection" "core" "discord.js" "next" "formatters" "proxy" "rest" "util" "voice" "ws")
declare -a PACKAGES=("brokers" "builders" "collection" "core" "discord.js" "formatters" "next" "proxy" "rest" "util" "voice" "ws")
for PACKAGE in "${PACKAGES[@]}"; do
if [[ "${PACKAGE}" == "discord.js" ]]; then
mkdir -p "out/${PACKAGE}"
@@ -171,10 +171,19 @@ jobs:
- name: Build dependencies
run: pnpm run build
- name: Cache .next/cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('apps/website/**/*.ts', 'apps/website/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-
- name: Pull vercel production environment
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build website Artifacts
- name: Build website artifacts
run: pnpm exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Build & deploy website

View File

@@ -15,9 +15,9 @@ export const PACKAGES = [
'collection',
'core',
'formatters',
'next',
'proxy',
'rest',
'next',
'util',
'voice',
'ws',

View File

@@ -1,6 +1,7 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { connect } from '@planetscale/database';
import { N_RECENT_VERSIONS } from '~/util/constants';
const sql = connect({
url: process.env.DATABASE_URL!,
@@ -20,7 +21,7 @@ export async function fetchVersions(packageName: string): Promise<string[]> {
]);
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
return rows.map((row) => row.version);
return rows.map((row) => row.version).slice(0, N_RECENT_VERSIONS);
}
export async function fetchModelJSON(packageName: string, version: string): Promise<unknown | null> {

View File

@@ -10,7 +10,7 @@ import { Nav } from '~/components/Nav';
import type { SidebarSectionItemData } from '~/components/Sidebar';
import { resolveItemURI } from '~/components/documentation/util';
import { addPackageToModel } from '~/util/addPackageToModel';
import { N_RECENT_VERSIONS, PACKAGES } from '~/util/constants';
import { PACKAGES } from '~/util/constants';
import { Providers } from './providers';
const Header = dynamic(async () => import('~/components/Header'));
@@ -26,7 +26,7 @@ export async function generateStaticParams() {
await Promise.all(
PACKAGES.map(async (packageName) => {
const versions = (await fetchVersions(packageName)).slice(-N_RECENT_VERSIONS);
const versions = await fetchVersions(packageName);
params.push(...versions.map((version) => ({ package: packageName, version })));
}),

View File

@@ -481,7 +481,8 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
const mappedTypeParameters: Map<string, string> = new Map();
if (
(apiItem.kind === ApiItemKind.Class || apiItem.kind === ApiItemKind.Interface) &&
next.item.kind === ApiItemKind.Class
next.item.kind === ApiItemKind.Class &&
extendsType.typeParameters?.length
) {
for (const [index, typeParameter] of extendsType.typeParameters.entries()) {
const key = (apiItem as ApiClass | ApiInterface).typeParameters[index]?.name ?? '';