Skip to content

Commit

Permalink
chore(platform): Migrate docs to next 15 (#11889)
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Nov 20, 2024
1 parent 66af8c8 commit a024bb3
Show file tree
Hide file tree
Showing 9 changed files with 891 additions and 408 deletions.
14 changes: 0 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
/* eslint-env node */
/* eslint import/no-nodejs-modules:0 */

module.exports = {
extends: ['sentry-docs', 'plugin:@next/next/recommended'],
globals: {
jest: true,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
rules: {
'import/no-nodejs-modules': 'off',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
// Reach is vendored into gatsby. They have their own webpack
// resolution for it which this eslint plugin can't seem to detect
'import/no-unresolved': ['error', {ignore: ['@reach']}],
},
},
],
};
10 changes: 6 additions & 4 deletions app/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function MDXLayoutRenderer({mdxSource, ...rest}) {
return <MDXLayout components={mdxComponentsWithWrapper} {...rest} />;
}

export default async function Page({params}: {params: {path?: string[]}}) {
export default async function Page(props: {params: Promise<{path?: string[]}>}) {
const params = await props.params;
// get frontmatter of all docs in tree
const rootNode = await getDocsRootNode();

Expand Down Expand Up @@ -172,9 +173,9 @@ export default async function Page({params}: {params: {path?: string[]}}) {
}

type MetadataProps = {
params: {
params: Promise<{
path?: string[];
};
}>;
};

// Helper function to clean up canonical tags missing leading or trailing slash
Expand All @@ -188,7 +189,8 @@ function formatCanonicalTag(tag: string) {
return tag;
}

export async function generateMetadata({params}: MetadataProps): Promise<Metadata> {
export async function generateMetadata(props: MetadataProps): Promise<Metadata> {
const params = await props.params;
const domain = isDeveloperDocs
? 'https://develop.sentry.dev'
: 'https://docs.sentry.io';
Expand Down
11 changes: 7 additions & 4 deletions app/platform-redirect/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ export const metadata: Metadata = {
'The page you are looking for is customized for each platform. Select your platform below and we’ll direct you to the most specific documentation on it.',
};

export default async function Page({
searchParams: {next = '', platform},
}: {
searchParams: {[key: string]: string | string[] | undefined};
export default async function Page(props: {
searchParams: Promise<{[key: string]: string | string[] | undefined}>;
}) {
const searchParams = await props.searchParams;

let next = searchParams.next || '';
const platform = searchParams.platform;

if (Array.isArray(next)) {
next = next[0];
}
Expand Down
8 changes: 0 additions & 8 deletions jest-preprocess.js

This file was deleted.

25 changes: 0 additions & 25 deletions jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
13 changes: 5 additions & 8 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const {codecovNextJSWebpackPlugin} = require('@codecov/nextjs-webpack-plugin');
const {withSentryConfig} = require('@sentry/nextjs');

const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
? {}
? {
'/**/*': ['./.git/**/*', './apps/**/*', 'docs/**/*'],
}
: {
'/**/*': [
'./.git/**/*',
Expand All @@ -24,14 +26,9 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],

trailingSlash: true,

experimental: {
serverComponentsExternalPackages: ['rehype-preset-minify'],
outputFileTracingExcludes,
},

serverExternalPackages: ['rehype-preset-minify'],
outputFileTracingExcludes,
webpack: (config, options) => {
config.plugins.push(
codecovNextJSWebpackPlugin({
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@google-cloud/storage": "^7.7.0",
"@mdx-js/loader": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@next/mdx": "^14.2.4",
"@popperjs/core": "^2.11.8",
"@prettier/plugin-xml": "^3.3.1",
"@radix-ui/colors": "^3.0.0",
Expand All @@ -68,16 +67,16 @@
"mdx-bundler": "^10.0.1",
"mermaid": "^11.4.0",
"micromark": "^4.0.0",
"next": "14.2.4",
"next": "15.0.3",
"next-mdx-remote": "^4.4.1",
"next-themes": "^0.3.0",
"nextjs-toploader": "^1.6.6",
"parse-numeric-range": "^1.3.0",
"platformicons": "^6.0.3",
"prism-sentry": "^1.0.2",
"query-string": "^6.13.1",
"react": "^18",
"react-dom": "^18",
"react": "rc",
"react-dom": "rc",
"react-feather": "^2.0.8",
"react-popper": "^2.3.0",
"react-select": "^5.7.3",
Expand Down Expand Up @@ -106,14 +105,14 @@
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/ws": "^8.5.10",
"autoprefixer": "^10.4.17",
"concurrently": "^8.2.2",
"dotenv-cli": "^7.4.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"eslint-config-next": "15.0.3",
"eslint-config-sentry-docs": "^1.118.0",
"jest": "^29.5.0",
"jest-dom": "^4.0.0",
Expand All @@ -131,4 +130,4 @@
"node": "20.11.0",
"yarn": "1.22.21"
}
}
}
Loading

0 comments on commit a024bb3

Please sign in to comment.