diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index e88d02a93..e2464a73e 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -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 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 7bcbf3a43..f717a2d60 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -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 diff --git a/apps/guide/src/util/constants.ts b/apps/guide/src/util/constants.ts index ee870b2b9..2deec17d1 100644 --- a/apps/guide/src/util/constants.ts +++ b/apps/guide/src/util/constants.ts @@ -15,9 +15,9 @@ export const PACKAGES = [ 'collection', 'core', 'formatters', + 'next', 'proxy', 'rest', - 'next', 'util', 'voice', 'ws', diff --git a/apps/website/src/app/docAPI.ts b/apps/website/src/app/docAPI.ts index 0b5becb0c..c3d9049da 100644 --- a/apps/website/src/app/docAPI.ts +++ b/apps/website/src/app/docAPI.ts @@ -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 { ]); // @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 { diff --git a/apps/website/src/app/docs/packages/[package]/[version]/layout.tsx b/apps/website/src/app/docs/packages/[package]/[version]/layout.tsx index a6b440e44..0d9f842f3 100644 --- a/apps/website/src/app/docs/packages/[package]/[version]/layout.tsx +++ b/apps/website/src/app/docs/packages/[package]/[version]/layout.tsx @@ -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 }))); }), diff --git a/packages/api-extractor-model/src/mixins/ApiItemContainerMixin.ts b/packages/api-extractor-model/src/mixins/ApiItemContainerMixin.ts index 1788dfed4..7fd302db4 100644 --- a/packages/api-extractor-model/src/mixins/ApiItemContainerMixin.ts +++ b/packages/api-extractor-model/src/mixins/ApiItemContainerMixin.ts @@ -481,7 +481,8 @@ export function ApiItemContainerMixin( const mappedTypeParameters: Map = 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 ?? '';