mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 02:04:43 +12:00
chore(website): redirect to core instead
This commit is contained in:
parent
c87e826087
commit
bcb48fea3e
1 changed files with 3 additions and 3 deletions
|
@ -14,8 +14,8 @@ export default async function middleware(request: NextRequest) {
|
|||
try {
|
||||
const skip = await get<boolean>('SKIP_PACKAGE_VERSION_SELECTION');
|
||||
if (skip) {
|
||||
const latestVersion = await fetchLatestVersion('builders');
|
||||
return NextResponse.redirect(new URL(`/docs/packages/builders/${latestVersion}`, request.url));
|
||||
const latestVersion = await fetchLatestVersion('core');
|
||||
return NextResponse.redirect(new URL(`/docs/packages/core/${latestVersion}`, request.url));
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ export default async function middleware(request: NextRequest) {
|
|||
|
||||
if (PACKAGES.some((pkg) => request.nextUrl.pathname.includes(pkg))) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
const packageName = /\/docs\/packages\/([^/]+)\/.*/.exec(request.nextUrl.pathname)?.[1] ?? 'builders';
|
||||
const packageName = /\/docs\/packages\/([^/]+)\/.*/.exec(request.nextUrl.pathname)?.[1] ?? 'core';
|
||||
const latestVersion = await fetchLatestVersion(packageName);
|
||||
return NextResponse.redirect(
|
||||
new URL(request.nextUrl.pathname.replace('stable', latestVersion ?? 'main'), request.url),
|
||||
|
|
Loading…
Reference in a new issue