-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remaining deps and lighthouse removal
- Loading branch information
Showing
27 changed files
with
558 additions
and
707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 23 additions & 18 deletions
41
apps/website/src/app/docs/packages/[package]/[version]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
import type { SerializeOptions } from 'next-mdx-remote/dist/types'; | ||
import { MDXRemote } from 'next-mdx-remote/rsc'; | ||
import { compileMDX } from 'next-mdx-remote/rsc'; | ||
import { cache } from 'react'; | ||
import rehypeSlug from 'rehype-slug'; | ||
import remarkGfm from 'remark-gfm'; | ||
import { SyntaxHighlighter } from '~/components/SyntaxHighlighter'; | ||
import type { VersionRouteParams } from './layout'; | ||
|
||
interface VersionRouteParams { | ||
package: string; | ||
version: string; | ||
} | ||
|
||
const loadREADME = cache(async (packageName: string) => { | ||
return readFile(join(process.cwd(), 'src', 'assets', 'readme', packageName, 'home-README.md'), 'utf8'); | ||
}); | ||
|
||
const mdxOptions = { | ||
mdxOptions: { | ||
remarkPlugins: [remarkGfm], | ||
rehypePlugins: [rehypeSlug], | ||
format: 'mdx', | ||
}, | ||
} satisfies SerializeOptions; | ||
export async function generateStaticParams({ params }: { params: VersionRouteParams }) { | ||
return [{ package: params.package, version: params.version }]; | ||
} | ||
|
||
export default async function Page({ params }: { params: VersionRouteParams }) { | ||
const { package: packageName } = params; | ||
const readmeSource = await loadREADME(packageName); | ||
const readmeSource = await loadREADME(params.package); | ||
const { content } = await compileMDX({ | ||
source: readmeSource, | ||
// @ts-expect-error SyntaxHighlighter is assignable | ||
components: { pre: SyntaxHighlighter }, | ||
options: { | ||
mdxOptions: { | ||
remarkPlugins: [remarkGfm], | ||
rehypePlugins: [rehypeSlug], | ||
format: 'mdx', | ||
}, | ||
}, | ||
}); | ||
|
||
return ( | ||
<div className="relative top-4 max-w-none prose"> | ||
{/* @ts-expect-error SyntaxHighlighter is assignable */} | ||
<MDXRemote components={{ pre: SyntaxHighlighter }} options={mdxOptions} source={readmeSource} /> | ||
</div> | ||
); | ||
return <div className="relative top-4 max-w-none prose">{content}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e72b552
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
discord-js-guide – ./apps/guide
discord-js-guide-discordjs.vercel.app
discord-js-guide-git-main-discordjs.vercel.app
discord-js-guide.vercel.app
guide.discordjs.dev
next.discordjs.guide