mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
fix: handle older generated docs better
This commit is contained in:
16
.github/workflows/deploy-website.yml
vendored
16
.github/workflows/deploy-website.yml
vendored
@@ -1,10 +1,5 @@
|
|||||||
name: Deploy website
|
name: Deploy website
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'main'
|
|
||||||
paths:
|
|
||||||
- 'apps/website/**'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||||
@@ -27,10 +22,19 @@ jobs:
|
|||||||
- name: Build dependencies
|
- name: Build dependencies
|
||||||
run: pnpm run build
|
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
|
- name: Pull vercel production environment
|
||||||
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
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 }}
|
run: pnpm exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
|
||||||
- name: Build & deploy website
|
- name: Build & deploy website
|
||||||
|
|||||||
13
.github/workflows/documentation.yml
vendored
13
.github/workflows/documentation.yml
vendored
@@ -99,7 +99,7 @@ jobs:
|
|||||||
- name: Move docs to correct directory
|
- name: Move docs to correct directory
|
||||||
if: ${{ github.ref_type == 'branch' }}
|
if: ${{ github.ref_type == 'branch' }}
|
||||||
run: |
|
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
|
for PACKAGE in "${PACKAGES[@]}"; do
|
||||||
if [[ "${PACKAGE}" == "discord.js" ]]; then
|
if [[ "${PACKAGE}" == "discord.js" ]]; then
|
||||||
mkdir -p "out/${PACKAGE}"
|
mkdir -p "out/${PACKAGE}"
|
||||||
@@ -171,10 +171,19 @@ jobs:
|
|||||||
- name: Build dependencies
|
- name: Build dependencies
|
||||||
run: pnpm run build
|
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
|
- name: Pull vercel production environment
|
||||||
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
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 }}
|
run: pnpm exec vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
|
||||||
- name: Build & deploy website
|
- name: Build & deploy website
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ export const PACKAGES = [
|
|||||||
'collection',
|
'collection',
|
||||||
'core',
|
'core',
|
||||||
'formatters',
|
'formatters',
|
||||||
|
'next',
|
||||||
'proxy',
|
'proxy',
|
||||||
'rest',
|
'rest',
|
||||||
'next',
|
|
||||||
'util',
|
'util',
|
||||||
'voice',
|
'voice',
|
||||||
'ws',
|
'ws',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { readFile } from 'node:fs/promises';
|
import { readFile } from 'node:fs/promises';
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { connect } from '@planetscale/database';
|
import { connect } from '@planetscale/database';
|
||||||
|
import { N_RECENT_VERSIONS } from '~/util/constants';
|
||||||
|
|
||||||
const sql = connect({
|
const sql = connect({
|
||||||
url: process.env.DATABASE_URL!,
|
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
|
// @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> {
|
export async function fetchModelJSON(packageName: string, version: string): Promise<unknown | null> {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Nav } from '~/components/Nav';
|
|||||||
import type { SidebarSectionItemData } from '~/components/Sidebar';
|
import type { SidebarSectionItemData } from '~/components/Sidebar';
|
||||||
import { resolveItemURI } from '~/components/documentation/util';
|
import { resolveItemURI } from '~/components/documentation/util';
|
||||||
import { addPackageToModel } from '~/util/addPackageToModel';
|
import { addPackageToModel } from '~/util/addPackageToModel';
|
||||||
import { N_RECENT_VERSIONS, PACKAGES } from '~/util/constants';
|
import { PACKAGES } from '~/util/constants';
|
||||||
import { Providers } from './providers';
|
import { Providers } from './providers';
|
||||||
|
|
||||||
const Header = dynamic(async () => import('~/components/Header'));
|
const Header = dynamic(async () => import('~/components/Header'));
|
||||||
@@ -26,7 +26,7 @@ export async function generateStaticParams() {
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
PACKAGES.map(async (packageName) => {
|
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 })));
|
params.push(...versions.map((version) => ({ package: packageName, version })));
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -481,7 +481,8 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
|
|||||||
const mappedTypeParameters: Map<string, string> = new Map();
|
const mappedTypeParameters: Map<string, string> = new Map();
|
||||||
if (
|
if (
|
||||||
(apiItem.kind === ApiItemKind.Class || apiItem.kind === ApiItemKind.Interface) &&
|
(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()) {
|
for (const [index, typeParameter] of extendsType.typeParameters.entries()) {
|
||||||
const key = (apiItem as ApiClass | ApiInterface).typeParameters[index]?.name ?? '';
|
const key = (apiItem as ApiClass | ApiInterface).typeParameters[index]?.name ?? '';
|
||||||
|
|||||||
Reference in New Issue
Block a user