Skip to content

Commit 97e493e

Browse files
committed
feat(mdx): use @next/mdx
1 parent bf048fd commit 97e493e

File tree

47 files changed

+696
-1388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+696
-1388
lines changed

.github/CODEOWNERS

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,17 @@ docs @nodejs/nodejs-website @nodejs/web-infra
3838
SECURITY.md @nodejs/security-wg
3939

4040
# Node.js Release Blog Posts
41-
apps/site/pages/en/blog/release @nodejs/releasers
42-
apps/site/pages/en/blog/announcements @nodejs/releasers
41+
apps/site/app/en/blog/release @nodejs/releasers
42+
apps/site/app/en/blog/announcements @nodejs/releasers
4343

4444
# The following users DO NOT have write access, and their review is requested
4545
# via a GitHub action.
46-
apps/site/pages/en/learn/diagnostics @nodejs/diagnostics
47-
48-
apps/site/pages/en/learn/getting-started/security-best-practices.md @nodejs/security-wg
49-
50-
apps/site/pages/en/learn/manipulating-files @nodejs/fs
51-
52-
apps/site/pages/en/learn/test-runner @nodejs/test_runner
53-
54-
apps/site/pages/en/learn/typescript @nodejs/typescript
55-
56-
apps/site/pages/en/about/partners.mdx @nodejs/marketing
57-
apps/site/pages/en/about/branding.mdx @nodejs/marketing
58-
59-
apps/site/pages/en/learn/getting-started/userland-migrations.md @nodejs/userland-migrations
60-
apps/site/pages/en/blog/migrations @nodejs/userland-migrations
46+
apps/site/app/en/learn/diagnostics @nodejs/diagnostics
47+
apps/site/app/en/learn/getting-started/security-best-practices/page.md @nodejs/security-wg
48+
apps/site/app/en/learn/manipulating-files @nodejs/fs
49+
apps/site/app/en/learn/test-runner @nodejs/test_runner
50+
apps/site/app/en/learn/typescript @nodejs/typescript
51+
apps/site/app/en/about/partners/page.mdx @nodejs/marketing
52+
apps/site/app/en/about/branding/page.mdx @nodejs/marketing
53+
apps/site/app/en/learn/getting-started/userland-migrations/page.md @nodejs/userland-migrations
54+
apps/site/app/en/blog/migrations @nodejs/userland-migrations

.github/dependabot.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ updates:
4747
- '@shikijs/*'
4848
- '@mdx-js/*'
4949
- hast-util-*
50+
- estree-util-*
5051
- rehype-*
5152
- remark-*
5253
- shiki
5354
- sval
5455
- unist-util-*
55-
- vfile
56-
- vfile-*
5756
- reading-time
5857
- twoslash
5958
orama:

.github/workflows/translations-pr-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ on:
99
branches:
1010
- main
1111
paths:
12-
- 'apps/site/pages/**/*.md'
13-
- 'apps/site/pages/**/*.mdx'
14-
- '!apps/site/pages/en/**/*.md'
15-
- '!apps/site/pages/en/**/*.mdx'
12+
- 'apps/site/app/**/*.md'
13+
- 'apps/site/app/**/*.mdx'
14+
- "!apps/site/app/\\[en\\]/**/*.md"
15+
- "!apps/site/app/\\[en\\]/**/*.mdx"
1616
- 'packages/i18n/src/locales/*.json'
1717
- '!packages/i18n/src/locales/en.json'
1818
- 'apps/site/snippets/**/*.bash'
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { notFound } from 'next/navigation';
2+
3+
import { ENABLE_STATIC_EXPORT } from '#site/next.constants.mjs';
4+
import { blogData } from '#site/next.json.mjs';
5+
6+
import type { DynamicParams } from '#site/types/page';
7+
import type { FC } from 'react';
8+
9+
import BasicCategory from '../page.md';
10+
11+
// Generates all possible static paths based on the locales and environment configuration
12+
// - Returns an empty array if static export is disabled (`ENABLE_STATIC_EXPORT` is false)
13+
// - If `ENABLE_STATIC_EXPORT_LOCALE` is true, generates paths for all available locales
14+
// - Otherwise, generates paths only for the default locale
15+
// @see https://nextjs.org/docs/app/api-reference/functions/generate-static-params
16+
export const generateStaticParams = async () => {
17+
// Return an empty array if static export is disabled
18+
if (!ENABLE_STATIC_EXPORT) {
19+
return [];
20+
}
21+
22+
return blogData.categories.map(category => ({ en: 'en', category }));
23+
};
24+
25+
type PageParams = DynamicParams<{ category: string }>;
26+
27+
// This method parses the current pathname and does any sort of modifications needed on the route
28+
// then it proceeds to retrieve the Markdown file and parse the MDX Content into a React Component
29+
// finally it returns (if the locale and route are valid) the React Component with the relevant context
30+
// and attached context providers for rendering the current page
31+
const getPage: FC<PageParams> = async props => {
32+
const { category } = await props.params;
33+
34+
if (category in blogData.categories || category === 'all') {
35+
return <BasicCategory {...props} />;
36+
}
37+
38+
return notFound();
39+
};
40+
41+
// Enforces that this route is used as static rendering
42+
// Except whenever on the Development mode as we want instant-refresh when making changes
43+
// @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic
44+
export const dynamic = 'force-static';
45+
46+
// Ensures that this endpoint is invalidated and re-executed every X minutes
47+
// so that when new deployments happen, the data is refreshed
48+
// @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate
49+
export const revalidate = 300;
50+
51+
export default getPage;

apps/site/app/[locale]/[...path]/page.tsx

Lines changed: 0 additions & 97 deletions
This file was deleted.

apps/site/app/[locale]/blog/[...path]/page.tsx

Lines changed: 0 additions & 82 deletions
This file was deleted.

apps/site/app/[locale]/download/archive/[version]/page.tsx

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)