Skip to content

Commit fbd12a4

Browse files
committed
enable this stuff on dev docs
1 parent 83b2029 commit fbd12a4

File tree

11 files changed

+67
-41
lines changed

11 files changed

+67
-41
lines changed

app/[[...path]]/page.tsx

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -65,42 +65,11 @@ export default async function Page({params}: {params: {path?: string[]}}) {
6565
path: params.path ?? [],
6666
});
6767

68-
if (isDeveloperDocs) {
69-
// get the MDX for the current doc and render it
70-
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
71-
try {
72-
doc = await getFileBySlug(`develop-docs/${params.path?.join('/') ?? ''}`);
73-
} catch (e) {
74-
if (e.code === 'ENOENT') {
75-
// eslint-disable-next-line no-console
76-
console.error('ENOENT', params.path);
77-
return notFound();
78-
}
79-
throw e;
80-
}
81-
const {mdxSource, frontMatter} = doc;
82-
// pass frontmatter tree into sidebar, rendered page + fm into middle, headers into toc
83-
return <MDXLayoutRenderer mdxSource={mdxSource} frontMatter={frontMatter} />;
84-
}
85-
if (!params.path) {
68+
if (!params.path && !isDeveloperDocs) {
8669
return <Home />;
8770
}
8871

89-
if (params.path[0] === 'api' && params.path.length > 1) {
90-
const categories = await apiCategories();
91-
const category = categories.find(c => c.slug === params?.path?.[1]);
92-
if (category) {
93-
if (params.path.length === 2) {
94-
return <ApiCategoryPage category={category} />;
95-
}
96-
const api = category.apis.find(a => a.slug === params.path?.[2]);
97-
if (api) {
98-
return <ApiPage api={api} />;
99-
}
100-
}
101-
}
102-
103-
const pageNode = nodeForPath(rootNode, params.path);
72+
const pageNode = nodeForPath(rootNode, params.path ?? '');
10473

10574
if (!pageNode) {
10675
// eslint-disable-next-line no-console
@@ -129,6 +98,45 @@ export default async function Page({params}: {params: {path?: string[]}}) {
12998
: undefined;
13099
}
131100

101+
if (isDeveloperDocs) {
102+
// get the MDX for the current doc and render it
103+
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
104+
try {
105+
doc = await getFileBySlug(`develop-docs/${params.path?.join('/') ?? ''}`);
106+
} catch (e) {
107+
if (e.code === 'ENOENT') {
108+
// eslint-disable-next-line no-console
109+
console.error('ENOENT', params.path);
110+
return notFound();
111+
}
112+
throw e;
113+
}
114+
const {mdxSource, frontMatter} = doc;
115+
// pass frontmatter tree into sidebar, rendered page + fm into middle, headers into toc
116+
return (
117+
<MDXLayoutRenderer
118+
mdxSource={mdxSource}
119+
frontMatter={frontMatter}
120+
nextPage={nextPage}
121+
previousPage={previousPage}
122+
/>
123+
);
124+
}
125+
126+
if (params.path?.[0] === 'api' && params.path.length > 1) {
127+
const categories = await apiCategories();
128+
const category = categories.find(c => c.slug === params?.path?.[1]);
129+
if (category) {
130+
if (params.path.length === 2) {
131+
return <ApiCategoryPage category={category} />;
132+
}
133+
const api = category.apis.find(a => a.slug === params.path?.[2]);
134+
if (api) {
135+
return <ApiPage api={api} />;
136+
}
137+
}
138+
}
139+
132140
// get the MDX for the current doc and render it
133141
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
134142
try {

develop-docs/application/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Application
3+
sidebar_order: 30
34
---
45

56
<PageGrid />

develop-docs/development/environment/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Environment
33
description: This guide steps you through configuring a local development environment for the Sentry server on macOS and Linux.
4-
sidebar_order: 1
4+
sidebar_order: 2
55
---
66

77
If you're using
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Developing Integrations
3-
sidebar_order: 80
3+
sidebar_order: 90
44
---
55

66
<PageGrid />

develop-docs/relay/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Relay Development
3-
sidebar_order: 60
3+
sidebar_order: 70
44
---
55

66
Relay is a service for event filtering, rate-limiting and processing. It can act as:

develop-docs/sdk/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: SDK Development
3-
sidebar_order: 70
3+
sidebar_order: 60
44
---
55

66
The following is a guide for implementing a Sentry SDK.

develop-docs/self-hosted/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Self-Hosted Sentry
3-
sidebar_order: 30
3+
sidebar_order: 100
44
---
55

66
In addition to making its source code available publicly, Sentry offers and maintains a minimal setup that works out-of-the-box for simple use cases. This version comes with no guarantees or dedicated support. Sentry engineers will do their best to answer questions and are dedicated to making sure self-hosted is running, but that's where our involvement ends. For anything else, we expect users to rely on the [Sentry Self-Hosted community](https://discord.gg/sentry) on Discord. The self-hosted repository should serve as a blueprint for how various Sentry services connect for a complete setup. This will be useful for folks willing to maintain larger installations with custom infrastructure.

develop-docs/self-hosted/releases.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Self-Hosted Releases & Upgrading
33
sidebar_title: Releases & Upgrading
4-
sidebar_order: 10
4+
sidebar_order: 1
55
---
66

77
Sentry cuts regular releases for self-hosting to keep it as close to [sentry.io](https://sentry.io) as possible. We decided to follow a monthly release schedule using the [CalVer](https://calver.org/#scheme) versioning scheme, with a primary release on the [15th of each month](https://github.com/getsentry/self-hosted/blob/704e4c3b5b7360080f79bcfbe26583e5a95ae675/.github/workflows/release.yml#L20-L24). We don't patch old versions, but if a bug is bad enough we may cut an out-of-cycle point release, which, like our regular monthly releases, is a snapshot of the latest versions of all of our components. You can find the [latest release](https://github.com/getsentry/self-hosted/releases/latest) over at the [releases section of our self-hosted repository](https://github.com/getsentry/self-hosted/releases/).

develop-docs/services/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Services
3-
sidebar_order: 60
3+
sidebar_order: 80
44
---
55

66
<PageGrid />

src/docTree.spec.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {describe, expect, test} from 'vitest';
1+
import {describe, expect, test, vi} from 'vitest';
22

33
import {
44
DocNode,
@@ -303,6 +303,19 @@ describe('docTree', () => {
303303

304304
expect(getPreviousNode(accounts)).toBe(undefined);
305305
});
306+
307+
test('should return undefined for getting-started page in developer docs', () => {
308+
vi.mock('./isDeveloperDocs', () => ({
309+
isDeveloperDocs: true,
310+
}));
311+
312+
const home = createNode('', 'Home');
313+
const gettingStarted = createNode('getting-started', 'Getting Started');
314+
home.children = [gettingStarted];
315+
gettingStarted.parent = home;
316+
317+
expect(getPreviousNode(gettingStarted)).toBeUndefined();
318+
});
306319
});
307320

308321
describe('isRootPlatformPath', () => {

0 commit comments

Comments
 (0)