Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into kw/add-react-featur…
Browse files Browse the repository at this point in the history
…es-to-rn
  • Loading branch information
krystofwoldrich committed Jul 15, 2024
2 parents 55dd6b5 + c9a0666 commit f2d8f2c
Show file tree
Hide file tree
Showing 424 changed files with 4,799 additions and 2,597 deletions.
13 changes: 7 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Requiring review from security team for Content-Security-Policy changes
/vercel.json @getsentry/security

# owners-api is tagged here but anyone can just approve the SHA Bump PRs
/src/build/resolveOpenAPI.ts @getsentry/owners-api

# Codeowners listed below are used as a reference for the Sentry team to know who to contact for a given area of the codebase.

Expand Down Expand Up @@ -43,11 +45,10 @@

# ###### Replays #######

# /src/docs/product/session-replay/ @getsentry/replay
# /src/includes/feature-stage-beta-session-replay.mdx @getsentry/replay
# /src/platform-includes/session-replay/ @getsentry/replay @getsentry/replay-sdk-web
# /src/platforms/javascript/common/session-replay/ @getsentry/replay @getsentry/replay-sdk-web
# /src/wizard/javascript/replay-onboarding/ @getsentry/replay @getsentry/replay-sdk-web
# /src/docs/product/session-replay/ @getsentry/replay
# /src/includes/session-replay-web-report-bug.mdx @getsentry/replay
# /src/platform-includes/session-replay/ @getsentry/replay @getsentry/replay-sdk-web
# /src/platforms/javascript/common/session-replay/ @getsentry/replay @getsentry/replay-sdk-web
# /src/wizard/javascript/replay-onboarding/ @getsentry/replay @getsentry/replay-sdk-web

# ###### End Replays #######

8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ updates:
schedule:
# Check for updates to GitHub Actions every week
interval: 'daily'

- package-ecosystem: gitsubmodule
directory: '/'
schedule:
interval: daily
open-pull-requests-limit: 10
reviewers:
- AbhiPrasad
31 changes: 31 additions & 0 deletions .github/workflows/algolia-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: getsentry/action-setup-volta@c52be2ea13cfdc084edb806e81958c13e445941e # v1.2.0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- 'docs/**'
- 'includes/**'
- 'platform-includes/**'
dev-docs:
- 'develop-docs/**'
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
Expand All @@ -22,16 +32,37 @@ jobs:

- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'

# Remove the changelog directory to avoid a build error due to missing `DATABASE_URL`
# and save some build time.
- run: rm -r app/changelog

- run: yarn build
if: steps.filter.outputs.docs == 'true'

- run: yarn build:developer-docs
if: steps.filter.outputs.dev-docs == 'true'

# bun seems to be the most straightforward way to run a TypeScript script
# without introducing another dependency like ts-node or tsx for everyone else

# build docs index
- run: bun ./scripts/algolia.ts
if: steps.filter.outputs.docs == 'true'
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
DOCS_INDEX_NAME: ${{ secrets.DOCS_INDEX_NAME }}
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }}
NEXT_PUBLIC_ALGOLIA_SEARCH_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_SEARCH_KEY }}

# build dev docs index
- run: bun ./scripts/algolia.ts
if: steps.filter.outputs.dev-docs == 'true'
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
DOCS_INDEX_NAME: ${{ secrets.DEVELOP_DOCS_INDEX_NAME }}
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }}
NEXT_PUBLIC_ALGOLIA_SEARCH_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_SEARCH_KEY }}
NEXT_PUBLIC_DEVELOPER_DOCS: 1
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ public/page-data
tsconfig.tsbuildinfo

public/mdx-images/*

# the vercel.json should be generated by the ./scripts/make-vercel-json.mjs script
# to differentiate between SDK docs and developer docs redirects
vercel.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "data-schemas"]
path = data-schemas
url = https://github.com/getsentry/sentry-data-schemas.git
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ repos:
- id: check-xml
- id: check-yaml
- id: detect-private-key
exclude: |
(?x)^(
develop-docs/application/config.mdx|
develop-docs/integrations/github.mdx|
develop-docs/self-hosted/sso.mdx
)$
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
Expand Down
55 changes: 33 additions & 22 deletions app/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import {
getDocsRootNode,
nodeForPath,
} from 'sentry-docs/docTree';
import {getDocsFrontMatter, getFileBySlug} from 'sentry-docs/mdx';
import {isDeveloperDocs} from 'sentry-docs/isDeveloperDocs';
import {getDevDocsFrontMatter, getDocsFrontMatter, getFileBySlug} from 'sentry-docs/mdx';
import {mdxComponents} from 'sentry-docs/mdxComponents';
import {setServerContext} from 'sentry-docs/serverContext';
import {capitilize} from 'sentry-docs/utils';

export async function generateStaticParams() {
const docs = await getDocsFrontMatter();
const docs = await (isDeveloperDocs ? getDevDocsFrontMatter() : getDocsFrontMatter());
const paths: {path: string[] | undefined}[] = docs.map(doc => {
const path = doc.slug.split('/');
return {path};
Expand All @@ -44,33 +45,43 @@ function MDXLayoutRenderer({mdxSource, ...rest}) {
return <MDXLayout components={mdxComponentsWithWrapper} {...rest} />;
}

export default async function Page({params}) {
if (!params.path) {
return <Home />;
}

export default async function Page({params}: {params: {path?: string[]}}) {
// get frontmatter of all docs in tree
const docs = await getDocsFrontMatter();
const rootNode = await getDocsRootNode();
if (!rootNode) {
// eslint-disable-next-line no-console
console.warn('no root node');
return notFound();
}

setServerContext({
rootNode,
path: params.path,
path: params.path ?? [],
});

if (isDeveloperDocs) {
// get the MDX for the current doc and render it
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
try {
doc = await getFileBySlug(`develop-docs/${params.path?.join('/') ?? ''}`);
} catch (e) {
if (e.code === 'ENOENT') {
// eslint-disable-next-line no-console
console.error('ENOENT', params.path);
return notFound();
}
throw e;
}
const {mdxSource, frontMatter} = doc;
// pass frontmatter tree into sidebar, rendered page + fm into middle, headers into toc
return <MDXLayoutRenderer mdxSource={mdxSource} frontMatter={frontMatter} />;
}
if (!params.path) {
return <Home />;
}

if (params.path[0] === 'api' && params.path.length > 1) {
const categories = await apiCategories();
const category = categories.find(c => c.slug === params.path[1]);
const category = categories.find(c => c.slug === params?.path?.[1]);
if (category) {
if (params.path.length === 2) {
return <ApiCategoryPage category={category} />;
}
const api = category.apis.find(a => a.slug === params.path[2]);
const api = category.apis.find(a => a.slug === params.path?.[2]);
if (api) {
return <ApiPage api={api} />;
}
Expand Down Expand Up @@ -98,10 +109,8 @@ export default async function Page({params}) {
}
const {mdxSource, frontMatter} = doc;

// pass frontmatter tree into sidebar, rendered page + fm into middle, headers into toc
return (
<MDXLayoutRenderer docs={docs} mdxSource={mdxSource} frontMatter={frontMatter} />
);
// pass frontmatter tree into sidebar, rendered page + fm into middle, headers into toc.
return <MDXLayoutRenderer mdxSource={mdxSource} frontMatter={frontMatter} />;
}

type MetadataProps = {
Expand All @@ -111,7 +120,9 @@ type MetadataProps = {
};

export async function generateMetadata({params}: MetadataProps): Promise<Metadata> {
const domain = 'https://docs.sentry.io';
const domain = isDeveloperDocs
? 'https://develop.sentry.dev'
: 'https://docs.sentry.io';
// enable og iamge preview on preview deployments
const previewDomain = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
Expand Down
14 changes: 14 additions & 0 deletions app/changelog/%5Fadmin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ export default async function ChangelogsListPage() {
<PlusIcon />
<Link href="/changelog/_admin/create">New Changelog</Link>
</Button>
<p>Post Guidelines</p>
<p>
<ul>
<li>
Be very matter of fact, direct, and simple. Avoid using words like "excited
to announce".
</li>
<li>Spell out the what, the why, and how to use it.</li>
<li>
Avoid exclamation points, adjectives, refernvces to competition, and
personal opinions.
</li>
</ul>
</p>
</header>

<table className="table-fixed w-11/12 mx-auto text-sm text-left text-gray-500">
Expand Down
13 changes: 12 additions & 1 deletion app/changelog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Fragment} from 'react';
import type {Metadata} from 'next';
import {serialize} from 'next-mdx-remote/serialize';

import List from 'sentry-docs/components/changelog/list';

Expand All @@ -11,10 +12,20 @@ export const dynamic = 'force-dynamic';
export default async function ChangelogList() {
const changelogs = await getChangelogs();

const changelogsWithMdxSummaries = await Promise.all(
changelogs.map(async changelog => {
const mdxSummary = await serialize(changelog.summary || '');
return {
...changelog,
mdxSummary,
};
})
);

return (
<Fragment>
<Header loading={false} />
<List changelogs={changelogs} />
<List changelogs={changelogsWithMdxSummaries} />
</Fragment>
);
}
Expand Down
31 changes: 20 additions & 11 deletions app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import type {MetadataRoute} from 'next';

import {getDocsFrontMatter} from 'sentry-docs/mdx';
import {isDeveloperDocs} from 'sentry-docs/isDeveloperDocs';
import {getDevDocsFrontMatter, getDocsFrontMatter} from 'sentry-docs/mdx';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
if (isDeveloperDocs) {
const docs = getDevDocsFrontMatter();
const baseUrl = 'https://develop.sentry.dev';
return docsToSitemap(docs, baseUrl);
}
const docs = await getDocsFrontMatter();
const baseUrl = 'https://docs.sentry.io';
return docsToSitemap(docs, baseUrl);
}

const sitemapEntries = docs.map(doc => {
let slug = doc.slug;
if (!slug.endsWith('/')) {
slug += '/';
function docsToSitemap(docs: {slug: string}[], baseUrl: string): MetadataRoute.Sitemap {
const paths = docs.map(({slug}) => slug);
const appendSlash = (path: string) => {
if (path === '' || path.endsWith('/')) {
return path;
}
return {url: `https://docs.sentry.io/${slug}`};
});
sitemapEntries.unshift({
url: 'https://docs.sentry.io/',
});
return sitemapEntries;
return path + '/';
};
const toFullUrl = (path: string) => `${appendSlash(baseUrl)}${appendSlash(path)}`;
const toSitemapEntry = (path: string) => ({url: toFullUrl(path)});
return ['', ...paths].map(toSitemapEntry);
}
34 changes: 34 additions & 0 deletions base-vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "sameorigin"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Content-Security-Policy",
"value": "upgrade-insecure-requests; default-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.sentry-cdn.com www.googletagmanager.com plausible.io vercel.live; connect-src 'self' *.sentry.io sentry.io *.algolia.net *.algolianet.com *.algolia.io plausible.io reload.getsentry.net storage.googleapis.com; img-src * 'self' data: www.google.com www.googletagmanager.com; style-src 'self' 'unsafe-inline'; font-src 'self' fonts.gstatic.com; frame-src demo.arcade.software player.vimeo.com; worker-src blob:; report-uri https://o1.ingest.sentry.io/api/1267915/security/?sentry_key=ad63ba38287245f2803dc220be959636; report-to csp"
},
{
"key": "NEL",
"value": "{\"report_to\":\"nel\",\"max_age\":3600,\"success_fraction\":0.0,\"failure_fraction\":1.0}"
},
{
"key": "Report-To",
"value": "{\"group\":\"nel\",\"max_age\":3600,\"endpoints\":[{\"url\":\"https://o1.ingest.sentry.io/api/1267915/nel/?sentry_key=ad63ba38287245f2803dc220be959636\"}]},{\"group\":\"csp\",\"max_age\":3600,\"endpoints\":[{\"url\":\"https://o1.ingest.sentry.io/api/1267915/security/?sentry_key=ad63ba38287245f2803dc220be959636\"}]}"
}
]
}
],
"trailingSlash": true
}
1 change: 1 addition & 0 deletions data-schemas
Submodule data-schemas added at 8c1345
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# A/B Tests with Amplitude
---
title: A/B Tests with Amplitude
---

## Why AB testing?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: "REST API Basics"
title: REST API Basics
sidebar_order: 1
---
This section includes common terms and resources to learn more about API design. If you're new to API design, this is a good place to start.

## Common Terms
- **Resource** is the object you’re performing the action on with your endpoint. For example, in ProjectEndpoint the resource is Project.
- **Resource Identifier** can be an ID, like an event ID, or slug, like an organization slug. Note that it must be unique. For example, Sentry's project resource identifier is {org_slug}/{project_slug}, because projects are only unique within their organization. You can find more information about this in the slug vs. ID section.
- **Resource Identifier** can be an ID, like an event ID, or slug, like an organization slug. Note that it must be unique. For example, Sentry's project resource identifier is \{org_slug}/\{project_slug}, because projects are only unique within their organization. You can find more information about this in the slug vs. ID section.
- **Method** is what you do with the resource. Each endpoint can have multiple methods. For example in ProjectEndpoint, you can have a GET method that returns details of a specific project.
- **Collection** is basically an object type. You can map them to a Django object type like an Organization or a text object like an error.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Public API Checklist"
title: Public API Checklist
sidebar_order: 5
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "API Concepts"
title: API Concepts
sidebar_order: 3
---
In this document, we will be looking at API concepts that exist and should be followed by endpoints. We also describe why these concepts exist so that developers can use them at their own discretion.
Expand Down
Loading

0 comments on commit f2d8f2c

Please sign in to comment.