Skip to content

Commit 5477b83

Browse files
Merge remote-tracking branch 'origin/master' into kw/react-native-v6-migration-guide
2 parents e847bc0 + ad48f6b commit 5477b83

File tree

543 files changed

+7260
-3032
lines changed

Some content is hidden

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

543 files changed

+7260
-3032
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "📝 Documentation on develop.sentry.dev"
2+
labels: ["Type: Content", "Develop"]
3+
description: Missing, incorrect, or unclear developer documentation.
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |-
8+
Is the documentation issue something you know how to fix? Consider contributing to Open Source by opening a PR to fix it instead!
9+
- type: input
10+
id: area-specific
11+
attributes:
12+
label: Which section?
13+
description: Which section of the developer documentation needs to be updated?
14+
validations:
15+
required: true
16+
- type: input
17+
id: page-url
18+
attributes:
19+
label: Page URL
20+
description: Please provide the URL of the page which should be changed (if applicable).
21+
- type: textarea
22+
id: description
23+
attributes:
24+
label: Description
25+
description: What were you looking for/trying to do/expecting?
26+
validations:
27+
required: true
28+
- type: textarea
29+
id: solution
30+
attributes:
31+
label: Suggested Solution
32+
description: If you have an idea on how we can solve this, please share.
33+
- type: markdown
34+
attributes:
35+
value: |-
36+
## Thanks 🙏
37+
Check our [triage docs](https://open.sentry.io/triage/) for what to expect next.
38+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Enforce Version Conventions
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
check-version-convention:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Install bun
17+
uses: oven-sh/setup-bun@v2
18+
with:
19+
bun-version: latest
20+
21+
- name: Run script for checking conventions
22+
run: bun scripts/check-version-conventions.ts

.github/workflows/prepare-release.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
force:
99
description: Force a release even when there are release-blockers (optional)
1010
required: false
11-
schedule:
12-
# This is when we release the self-hosted repo
13-
- cron: "1 18 15 * *"
1411
jobs:
1512
release:
1613
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
with:
5858
github-token: ${{ steps.token.outputs.token }}
5959

60-
# TODO(mjq): Bring this back once tests are working.
6160
job_test:
6261
name: Test
6362
runs-on: ubuntu-latest
@@ -72,5 +71,4 @@ jobs:
7271
- run: yarn install --frozen-lockfile
7372
if: steps.cache.outputs.cache-hit != 'true'
7473
- name: Run Tests
75-
# run: yarn test
76-
run: true
74+
run: yarn test

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ import {
1616
nodeForPath,
1717
} from 'sentry-docs/docTree';
1818
import {isDeveloperDocs} from 'sentry-docs/isDeveloperDocs';
19-
import {getDevDocsFrontMatter, getDocsFrontMatter, getFileBySlug} from 'sentry-docs/mdx';
19+
import {
20+
getDevDocsFrontMatter,
21+
getDocsFrontMatter,
22+
getFileBySlug,
23+
getVersionsFromDoc,
24+
} from 'sentry-docs/mdx';
2025
import {mdxComponents} from 'sentry-docs/mdxComponents';
2126
import {setServerContext} from 'sentry-docs/serverContext';
27+
import {stripVersion} from 'sentry-docs/versioning';
2228

2329
export async function generateStaticParams() {
2430
const docs = await (isDeveloperDocs ? getDevDocsFrontMatter() : getDocsFrontMatter());
@@ -47,6 +53,7 @@ function MDXLayoutRenderer({mdxSource, ...rest}) {
4753
export default async function Page({params}: {params: {path?: string[]}}) {
4854
// get frontmatter of all docs in tree
4955
const rootNode = await getDocsRootNode();
56+
5057
setServerContext({
5158
rootNode,
5259
path: params.path ?? [],
@@ -88,6 +95,7 @@ export default async function Page({params}: {params: {path?: string[]}}) {
8895
}
8996

9097
const pageNode = nodeForPath(rootNode, params.path);
98+
9199
if (!pageNode) {
92100
// eslint-disable-next-line no-console
93101
console.warn('no page node', params.path);
@@ -108,8 +116,14 @@ export default async function Page({params}: {params: {path?: string[]}}) {
108116
}
109117
const {mdxSource, frontMatter} = doc;
110118

119+
// collect versioned files
120+
const allFm = await getDocsFrontMatter();
121+
const versions = getVersionsFromDoc(allFm, pageNode.path);
122+
111123
// pass frontmatter tree into sidebar, rendered page + fm into middle, headers into toc.
112-
return <MDXLayoutRenderer mdxSource={mdxSource} frontMatter={frontMatter} />;
124+
return (
125+
<MDXLayoutRenderer mdxSource={mdxSource} frontMatter={{...frontMatter, versions}} />
126+
);
113127
}
114128

115129
type MetadataProps = {
@@ -135,9 +149,13 @@ export async function generateMetadata({params}: MetadataProps): Promise<Metadat
135149
const rootNode = await getDocsRootNode();
136150

137151
if (params.path) {
138-
const pageNode = nodeForPath(rootNode, params.path);
152+
const pageNode = nodeForPath(
153+
rootNode,
154+
stripVersion(params.path.join('/')).split('/')
155+
);
139156
if (pageNode) {
140157
const guideOrPlatform = getCurrentPlatformOrGuide(rootNode, params.path);
158+
141159
title =
142160
pageNode.frontmatter.title +
143161
(guideOrPlatform ? ` | Sentry for ${guideOrPlatform.title}` : '');
Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import {Fragment, Suspense} from 'react';
1+
import {Fragment, Suspense, useActionState} from 'react';
22
import Link from 'next/link';
33

44
import {prismaClient} from '@/server/prisma-client';
5-
import {editChangelog} from '@/server/actions/changelog';
6-
import {TitleSlug} from '@/client/components/titleSlug';
7-
import {FileUpload} from '@/client/components/fileUpload';
8-
import {Select} from '@/client/components/ui/Select';
9-
import {ForwardRefEditor} from '@/client/components/forwardRefEditor';
10-
import {Button} from '@/client/components/ui/Button';
5+
import {EditChangelogForm} from '@/client/components/forms/editChangelogForm';
116

127
export default async function ChangelogCreatePage({params}: {params: {id: string}}) {
138
const categories = await prismaClient.category.findMany({
@@ -38,59 +33,7 @@ export default async function ChangelogCreatePage({params}: {params: {id: string
3833

3934
return (
4035
<section className="overflow-x-auto col-start-3 col-span-8">
41-
<form action={editChangelog} className="px-2 w-full">
42-
<input type="hidden" name="id" value={changelog.id} />
43-
<TitleSlug defaultSlug={changelog.slug} defaultTitle={changelog.title} />
44-
<FileUpload defaultFile={changelog.image || ''} />
45-
<div className="my-6">
46-
<label htmlFor="summary" className="block text-xs font-medium text-gray-700">
47-
Summary
48-
<Fragment>
49-
&nbsp;<span className="font-bold text-secondary">*</span>
50-
</Fragment>
51-
</label>
52-
<textarea name="summary" className="w-full" required>
53-
{changelog.summary}
54-
</textarea>
55-
<span className="text-xs text-gray-500 italic">
56-
This will be shown in the list
57-
</span>
58-
</div>
59-
<div>
60-
<Select
61-
name="categories"
62-
className="mt-1 mb-6"
63-
label="Category"
64-
placeholder="Select Category"
65-
defaultValue={changelog.categories.map(category => ({
66-
label: category.name,
67-
value: category.name,
68-
}))}
69-
options={categories.map(category => ({
70-
label: category.name,
71-
value: category.name,
72-
}))}
73-
isMulti
74-
/>
75-
</div>
76-
77-
<Suspense fallback={null}>
78-
<ForwardRefEditor
79-
name="content"
80-
defaultValue={changelog.content || ''}
81-
className="w-full"
82-
/>
83-
</Suspense>
84-
85-
<footer className="flex items-center justify-between mt-2 mb-8">
86-
<Link href="/changelog/_admin" className="underline text-gray-500">
87-
Return to Changelogs list
88-
</Link>
89-
<div>
90-
<Button type="submit">Update</Button>
91-
</div>
92-
</footer>
93-
</form>
36+
<EditChangelogForm changelog={changelog} categories={categories} />
9437
</section>
9538
);
9639
}

apps/changelog/src/app/changelog/%5Fadmin/confirm.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
'use client';
22

3-
import type {PropsWithChildren} from 'react';
3+
import {ServerActionPayloadInterface} from '@/server/actions/serverActionPayload.interface';
4+
import {useActionState, type PropsWithChildren} from 'react';
45

56
export default function Confirm({
67
action,
78
changelog,
89
children,
910
}: PropsWithChildren<{
10-
action: (formData: FormData) => Promise<void | {
11-
message: string;
12-
}>;
11+
action: (
12+
currentFormState: ServerActionPayloadInterface,
13+
formData: FormData
14+
) => Promise<ServerActionPayloadInterface>;
1315
changelog: {id: string};
1416
}>) {
17+
const [_state, formAction] = useActionState(action, {});
1518
return (
1619
<form
17-
action={action}
20+
action={formAction}
1821
className="inline-block"
1922
onSubmit={e => {
2023
e.preventDefault();
2124
// eslint-disable-next-line no-alert
2225
if (confirm('Are you sure?')) {
23-
action(new FormData(e.currentTarget));
26+
formAction(new FormData(e.currentTarget));
2427
}
2528
}}
2629
>
Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
import {Fragment} from 'react';
2-
import Link from 'next/link';
31
import {prismaClient} from '@/server/prisma-client';
4-
import {createChangelog} from '@/server/actions/changelog';
5-
import {TitleSlug} from '@/client/components/titleSlug';
6-
import {FileUpload} from '@/client/components/fileUpload';
7-
import {Select} from '@/client/components/ui/Select';
8-
import {ForwardRefEditor} from '@/client/components/forwardRefEditor';
9-
import {Button} from '@/client/components/ui/Button';
2+
103
import {getServerSession} from 'next-auth/next';
114
import {notFound} from 'next/navigation';
125
import {authOptions} from '@/server/authOptions';
6+
import {CreateChangelogForm} from '@/client/components/forms/createChangelogForm';
137

148
export default async function ChangelogCreatePage() {
159
const session = await getServerSession(authOptions);
@@ -26,48 +20,7 @@ export default async function ChangelogCreatePage() {
2620

2721
return (
2822
<section className="overflow-x-auto col-start-3 col-span-8">
29-
<form action={createChangelog} className="px-2 w-full">
30-
<TitleSlug />
31-
<FileUpload />
32-
<div className="my-6">
33-
<label htmlFor="summary" className="block text-xs font-medium text-gray-700">
34-
Summary
35-
<Fragment>
36-
&nbsp;<span className="font-bold text-secondary">*</span>
37-
</Fragment>
38-
</label>
39-
<textarea name="summary" className="w-full" required />
40-
<span className="text-xs text-gray-500 italic">
41-
This will be shown in the list
42-
</span>
43-
</div>
44-
<div>
45-
<Select
46-
name="categories"
47-
className="mt-1 mb-6"
48-
label="Category"
49-
placeholder="Select Category"
50-
options={categories.map(category => ({
51-
label: category.name,
52-
value: category.name,
53-
}))}
54-
isMulti
55-
/>
56-
</div>
57-
58-
<ForwardRefEditor name="content" className="w-full" />
59-
60-
<footer className="flex items-center justify-between mt-2">
61-
<Link href="/changelog/_admin" className="underline text-gray-500">
62-
Return to Changelogs list
63-
</Link>
64-
<div>
65-
<Button type="submit">Create (not published yet)</Button>
66-
<br />
67-
<span className="text-xs text-gray-500 italic">You can publish it later</span>
68-
</div>
69-
</footer>
70-
</form>
23+
<CreateChangelogForm categories={categories} />
7124
</section>
7225
);
7326
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
'use client';
2+
3+
import {createChangelog} from '@/server/actions/changelog';
4+
import {TitleSlug} from '@/client/components/titleSlug';
5+
import {FileUpload} from '@/client/components/fileUpload';
6+
import {Select} from '@/client/components/ui/Select';
7+
import {ForwardRefEditor} from '@/client/components/forwardRefEditor';
8+
import {Button} from '@/client/components/ui/Button';
9+
import {Fragment, useActionState} from 'react';
10+
import Link from 'next/link';
11+
import {Category} from '@prisma/client';
12+
13+
export const CreateChangelogForm = ({categories}: {categories: Category[]}) => {
14+
const [_state, formAction] = useActionState(createChangelog, {});
15+
return (
16+
<form action={formAction} className="px-2 w-full">
17+
<TitleSlug />
18+
<FileUpload />
19+
<div className="my-6">
20+
<label htmlFor="summary" className="block text-xs font-medium text-gray-700">
21+
Summary
22+
<Fragment>
23+
&nbsp;<span className="font-bold text-secondary">*</span>
24+
</Fragment>
25+
</label>
26+
<textarea name="summary" className="w-full" required />
27+
<span className="text-xs text-gray-500 italic">
28+
This will be shown in the list
29+
</span>
30+
</div>
31+
<div>
32+
<Select
33+
name="categories"
34+
className="mt-1 mb-6"
35+
label="Category"
36+
placeholder="Select Category"
37+
options={categories.map(category => ({
38+
label: category.name,
39+
value: category.name,
40+
}))}
41+
isMulti
42+
/>
43+
</div>
44+
45+
<ForwardRefEditor name="content" className="w-full" />
46+
47+
<footer className="flex items-center justify-between mt-2">
48+
<Link href="/changelog/_admin" className="underline text-gray-500">
49+
Return to Changelogs list
50+
</Link>
51+
<div>
52+
<Button type="submit">Create (not published yet)</Button>
53+
<br />
54+
<span className="text-xs text-gray-500 italic">You can publish it later</span>
55+
</div>
56+
</footer>
57+
</form>
58+
);
59+
};

0 commit comments

Comments
 (0)