Skip to content

Commit 825d363

Browse files
committed
Merge branch 'master' into next-steps-config
2 parents d80c9d7 + 5ad2fa6 commit 825d363

File tree

2,209 files changed

+17702
-9685
lines changed

Some content is hidden

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

2,209 files changed

+17702
-9685
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ GATSBY_ALGOLIA_INDEX_PREFIX=test-sentry-
99
# ALGOLIA_ADMIN_KEY=
1010
# ALGOLIA_INDEX=0
1111
# SENTRY_AUTH_TOKEN=
12+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/changelog
13+
NEXTAUTH_URL=http://localhost:3000
14+
NEXTAUTH_SECRET=secret

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,5 @@ public/page-data
9393

9494
# tsbuildinfo file generated by CI
9595
tsconfig.tsbuildinfo
96+
97+
public/mdx-images/*

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
## Setting up an Environment
8+
9+
We use Next.js, `yarn` and `volta` to manage the environment.
10+
11+
```
12+
cp .env.example .env.development
13+
yarn
14+
yarn dev
15+
```
16+
17+
With that, the repo is fully set up and you are ready to open local docs under http://localhost:3000
18+
19+
### Database
20+
21+
There is a compose file to start a local postgres db:
22+
23+
```
24+
docker-compose up -d
25+
```
26+
27+
If you already run a local postgres, it will create a `changelog` table.
28+
29+
The inital setup or the clean the database call:
30+
31+
```
32+
yarn migrate:dev
33+
```
34+
35+
To add new entries, visit `/changelog/_admin` you need to have a Google Account in the Sentry org to login.
36+
37+
#### Seeding
38+
39+
Call
40+
41+
```
42+
npx prisma db seed
43+
```

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ import {capitilize} from 'sentry-docs/utils';
2222

2323
export async function generateStaticParams() {
2424
const docs = await getDocsFrontMatter();
25-
const paths = docs.map(doc => {
26-
let path = doc.slug.split('/');
27-
if (path[path.length - 1] === 'index') {
28-
path = path.slice(0, path.length - 1);
29-
}
25+
const paths: {path: string[] | undefined}[] = docs.map(doc => {
26+
const path = doc.slug.split('/');
3027
return {path};
3128
});
3229
paths.push({path: undefined}); // the home page
@@ -86,7 +83,7 @@ export default async function Page({params}) {
8683
}
8784

8885
// get the MDX for the current doc and render it
89-
let doc: any = null;
86+
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
9087
try {
9188
doc = await getFileBySlug(`docs/${pageNode.path}`);
9289
} catch (e) {
@@ -112,9 +109,15 @@ type MetadataProps = {
112109

113110
export async function generateMetadata({params}: MetadataProps): Promise<Metadata> {
114111
const domain = 'https://docs.sentry.io';
115-
let title = 'Home';
116-
let description = '';
117-
const images = [{url: `${domain}/meta.png`, width: 1200, height: 630}];
112+
// enable og iamge preview on preview deployments
113+
const previewDomain = process.env.VERCEL_URL
114+
? `https://${process.env.VERCEL_URL}`
115+
: domain;
116+
let title =
117+
'Sentry Docs | Application Performance Monitoring &amp; Error Tracking Software';
118+
let description =
119+
'Self-hosted and cloud-based application performance monitoring &amp; error tracking that helps software teams see clearer, solve quicker, &amp; learn continuously.';
120+
const images = [{url: `${previewDomain ?? domain}/meta.jpg`, width: 1200, height: 822}];
118121

119122
const rootNode = await getDocsRootNode();
120123

@@ -125,7 +128,7 @@ export async function generateMetadata({params}: MetadataProps): Promise<Metadat
125128
title =
126129
pageNode.frontmatter.title +
127130
(guideOrPlatform ? ` | Sentry for ${capitilize(guideOrPlatform.name)}` : '');
128-
description = pageNode.frontmatter.description;
131+
description = pageNode.frontmatter.description ?? '';
129132
}
130133
}
131134

app/changelog/[slug]/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Fragment, Suspense} from 'react';
22
import {type Category, type Changelog} from '@prisma/client';
3-
import * as Sentry from '@sentry/nextjs';
43
import {GET as sessionHandler} from 'app/api/auth/[...nextauth]/route';
54
import type {Metadata, ResolvingMetadata} from 'next';
65
import {unstable_cache} from 'next/cache';
@@ -37,9 +36,6 @@ export async function generateMetadata(
3736
openGraph: {
3837
images: changelog?.image || (await parent).openGraph?.images,
3938
},
40-
other: {
41-
'sentry-trace': `${Sentry.getActiveSpan()?.toTraceparent()}`,
42-
},
4339
};
4440
}
4541

app/changelog/feed.xml/route.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import {getChangelogs} from 'app/changelog/utils';
2+
import RSS from 'rss';
3+
4+
export async function GET() {
5+
const feed = new RSS({
6+
title: 'Sentry Changelog',
7+
description:
8+
'Stay up to date on everything big and small, from product updates to SDK changes with the Sentry Changelog.',
9+
feed_url: 'https://sentry.io/changelog/feed.xml',
10+
site_url: 'https://sentry.io/changelog',
11+
copyright: `Copyright ${new Date().getFullYear().toString()}, Sentry`,
12+
language: 'en-US',
13+
pubDate: new Date().toUTCString(),
14+
ttl: 60,
15+
});
16+
17+
const allChangelogs = await getChangelogs();
18+
19+
if (allChangelogs) {
20+
allChangelogs.map(changelog => {
21+
return feed.item({
22+
title: changelog.title,
23+
description: changelog.summary,
24+
url: `https://sentry.io/changelog/${changelog.slug}`,
25+
categories:
26+
changelog.categories.map(category => {
27+
return category.name;
28+
}) || [],
29+
date: changelog.publishedAt,
30+
});
31+
});
32+
}
33+
34+
return new Response(feed.xml({indent: true}), {
35+
headers: {
36+
'Content-Type': 'application/xml; charset=utf-8',
37+
},
38+
});
39+
}

app/changelog/layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const rubik = Rubik({
1919
export const metadata: Metadata = {
2020
title: {template: '%s | Sentry Changelog', default: 'Changelog'},
2121
metadataBase: new URL('https://sentry.io/changelog/'),
22+
openGraph: {
23+
images: 'https://docs.sentry.io/changelog/assets/hero.png',
24+
},
2225
};
2326

2427
export default function ChangelogLayout({children}: {children: ReactNode}) {

app/changelog/page.tsx

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,13 @@
11
import {Fragment} from 'react';
2-
import * as Sentry from '@sentry/nextjs';
32
import type {Metadata} from 'next';
4-
import {unstable_cache} from 'next/cache';
53

64
import List from 'sentry-docs/components/changelog/list';
7-
import prisma from 'sentry-docs/prisma';
85

96
import Header from './header';
7+
import {getChangelogs} from './utils';
108

119
export const dynamic = 'force-dynamic';
1210

13-
const getChangelogs = unstable_cache(
14-
async () => {
15-
return await prisma.changelog.findMany({
16-
include: {
17-
categories: true,
18-
},
19-
where: {
20-
published: true,
21-
},
22-
orderBy: {
23-
publishedAt: 'desc',
24-
},
25-
});
26-
},
27-
['changelogs'],
28-
{tags: ['changelogs']}
29-
);
30-
3111
export default async function ChangelogList() {
3212
const changelogs = await getChangelogs();
3313

@@ -46,8 +26,5 @@ export function generateMetadata(): Metadata {
4626
alternates: {
4727
canonical: `https://sentry.io/changelog/`,
4828
},
49-
other: {
50-
'sentry-trace': `${Sentry.getActiveSpan()?.toTraceparent()}`,
51-
},
5229
};
5330
}

app/changelog/utils.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {unstable_cache} from 'next/cache';
2+
3+
import prisma from 'sentry-docs/prisma';
4+
5+
export const getChangelogs = unstable_cache(
6+
async () => {
7+
return await prisma.changelog.findMany({
8+
include: {
9+
categories: true,
10+
},
11+
where: {
12+
published: true,
13+
},
14+
orderBy: {
15+
publishedAt: 'desc',
16+
},
17+
});
18+
},
19+
['changelogs'],
20+
{tags: ['changelogs']}
21+
);

app/layout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import Script from 'next/script';
44
export const metadata: Metadata = {
55
title: 'Home',
66
icons: {
7-
icon: '/favicon.ico',
7+
icon: 'https://docs.sentry.io/favicon.ico',
8+
},
9+
openGraph: {
10+
images: 'https://docs.sentry.io/changelog/assets/og.png',
11+
},
12+
other: {
13+
'zd-site-verification': 'ocu6mswx6pke3c6qvozr2e',
814
},
915
};
1016

0 commit comments

Comments
 (0)