Skip to content

Commit

Permalink
Merge branch 'master' into log4j2-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adinauer committed Nov 6, 2024
2 parents b6521e2 + c917e2b commit e17118d
Show file tree
Hide file tree
Showing 746 changed files with 16,607 additions and 5,031 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-content-03-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "📝 Documentation on develop.sentry.dev"
labels: ["Type: Content", "Develop"]
description: Missing, incorrect, or unclear developer documentation.
body:
- type: markdown
attributes:
value: |-
Is the documentation issue something you know how to fix? Consider contributing to Open Source by opening a PR to fix it instead!
- type: input
id: area-specific
attributes:
label: Which section?
description: Which section of the developer documentation needs to be updated?
validations:
required: true
- type: input
id: page-url
attributes:
label: Page URL
description: Please provide the URL of the page which should be changed (if applicable).
- type: textarea
id: description
attributes:
label: Description
description: What were you looking for/trying to do/expecting?
validations:
required: true
- type: textarea
id: solution
attributes:
label: Suggested Solution
description: If you have an idea on how we can solve this, please share.
- type: markdown
attributes:
value: |-
## Thanks 🙏
Check our [triage docs](https://open.sentry.io/triage/) for what to expect next.
49 changes: 48 additions & 1 deletion .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
color: F6F6F8
description: Pull requests that update a dependency file

# Issue types
- name: 'Type: Content'
color: FBCA04
- name: 'Type: Platform'
color: 1D76DB

#
- name: 'Develop'
color: F6F6F8

# Impacts
- name: 'Impact: Large'
color: C83852
Expand All @@ -32,6 +42,8 @@
color: '584774'
- name: 'Platform: Capacitor'
color: '584774'
- name: 'Platform: CLI'
color: '584774'
- name: 'Platform: Cocoa'
color: '584774'
- name: 'Platform: Cordova'
Expand All @@ -40,14 +52,20 @@
color: '584774'
- name: 'Platform: Elixir'
color: '584774'
- name: 'Platform: Flutter'
color: '584774'
- name: 'Platform: Go'
color: '584774'
- name: 'Platform: iOS'
color: '584774'
- name: 'Platform: Java'
color: '584774'
- name: 'Platform: JavaScript'
color: '584774'
- name: 'Platform: KMP'
color: '584774'
- name: 'Platform: Native'
color: '584774'
- name: 'Platform: PHP'
color: '584774'
- name: 'Platform: Python'
Expand All @@ -67,6 +85,7 @@
- name: 'Platform: Xamarin'
color: '584774'


# Waiting for Labels
- name: 'Waiting for: Support'
color: '8D5494'
Expand Down Expand Up @@ -217,16 +236,36 @@
- name: 'Team: Web Frontend'
color: 8D5494
description: team-web-sdk-frontend
- name: 'Team: Web Frontend SDKs'
color: 8D5494
description: team-web-sdk-frontend
- name: 'Team: Web SDK Backend'
color: 8D5494
description: team-web-sdk-backend
- name: 'Team: Web Backend SDKs'
color: 8D5494
description: team-web-sdk-backend
- name: 'Team: Workflow'
color: 8D5494
- name: 'All SDKs'
color: 1D76DB
- name: 'SDKs'
color: 1D76DB
- name: 'Develop'
color: 8D5494
- name: 'Do not merge'
color: 8D5494
- name: 'Improvement'
color: 8D5494
- name: 'Launch 🚀'
color: 8D5494
- name: 'Product'
color: 8D5494

# Miscellaneous
- name: API Docs
color: 649B42
- name: bug
- name: Bug
color: F6F6F8
- name: Common content
color: B0E299
Expand Down Expand Up @@ -279,3 +318,11 @@
color: F6F6F8
- name: release health
color: F6F6F8
- name: submodules
color: F6F6F8
- name: '404'
color: F6F6F8
- name: darkmode
color: F6F6F8
- name: github_actions
color: F6F6F8
22 changes: 22 additions & 0 deletions .github/workflows/enforce-version-convention.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Enforce Version Conventions

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
check-version-convention:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Run script for checking conventions
run: bun scripts/check-version-conventions.ts
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ jobs:
with:
github-token: ${{ steps.token.outputs.token }}

# TODO(mjq): Bring this back once tests are working.
job_test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -72,5 +71,4 @@ jobs:
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'
- name: Run Tests
# run: yarn test
run: true
run: yarn test
120 changes: 100 additions & 20 deletions app/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,24 @@ import {Home} from 'sentry-docs/components/home';
import {Include} from 'sentry-docs/components/include';
import {PlatformContent} from 'sentry-docs/components/platformContent';
import {
DocNode,
getCurrentPlatformOrGuide,
getDocsRootNode,
getNextNode,
getPreviousNode,
nodeForPath,
} from 'sentry-docs/docTree';
import {isDeveloperDocs} from 'sentry-docs/isDeveloperDocs';
import {getDevDocsFrontMatter, getDocsFrontMatter, getFileBySlug} from 'sentry-docs/mdx';
import {
getDevDocsFrontMatter,
getDocsFrontMatter,
getFileBySlug,
getVersionsFromDoc,
} from 'sentry-docs/mdx';
import {mdxComponents} from 'sentry-docs/mdxComponents';
import {setServerContext} from 'sentry-docs/serverContext';
import {PaginationNavNode} from 'sentry-docs/types/paginationNavNode';
import {stripVersion} from 'sentry-docs/versioning';

export async function generateStaticParams() {
const docs = await (isDeveloperDocs ? getDevDocsFrontMatter() : getDocsFrontMatter());
Expand All @@ -36,7 +46,11 @@ export const dynamic = 'force-static';

const mdxComponentsWithWrapper = mdxComponents(
{Include, PlatformContent},
({children, frontMatter}) => <DocPage frontMatter={frontMatter}>{children}</DocPage>
({children, frontMatter, nextPage, previousPage}) => (
<DocPage frontMatter={frontMatter} nextPage={nextPage} previousPage={previousPage}>
{children}
</DocPage>
)
);

function MDXLayoutRenderer({mdxSource, ...rest}) {
Expand All @@ -47,11 +61,48 @@ function MDXLayoutRenderer({mdxSource, ...rest}) {
export default async function Page({params}: {params: {path?: string[]}}) {
// get frontmatter of all docs in tree
const rootNode = await getDocsRootNode();

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

if (!params.path && !isDeveloperDocs) {
return <Home />;
}

const pageNode = nodeForPath(rootNode, params.path ?? '');

if (!pageNode) {
// eslint-disable-next-line no-console
console.warn('no page node', params.path);
return notFound();
}

// gather previous and next page that will be displayed in the bottom pagination
const getPaginationDetails = (
getNode: (node: DocNode) => DocNode | undefined | 'root',
page: PaginationNavNode | undefined
) => {
if (page && 'path' in page && 'title' in page) {
return page;
}

const node = getNode(pageNode);

if (node === 'root') {
return {path: '', title: 'Welcome to Sentry'};
}

return node ? {path: node.path, title: node.frontmatter.title} : undefined;
};

const previousPage = getPaginationDetails(
getPreviousNode,
pageNode?.frontmatter?.previousPage
);
const nextPage = getPaginationDetails(getNextNode, pageNode?.frontmatter?.nextPage);

if (isDeveloperDocs) {
// get the MDX for the current doc and render it
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
Expand All @@ -67,13 +118,17 @@ export default async function Page({params}: {params: {path?: string[]}}) {
}
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 />;
return (
<MDXLayoutRenderer
mdxSource={mdxSource}
frontMatter={frontMatter}
nextPage={nextPage}
previousPage={previousPage}
/>
);
}

if (params.path[0] === 'api' && params.path.length > 1) {
if (params.path?.[0] === 'api' && params.path.length > 1) {
const categories = await apiCategories();
const category = categories.find(c => c.slug === params?.path?.[1]);
if (category) {
Expand All @@ -87,13 +142,6 @@ export default async function Page({params}: {params: {path?: string[]}}) {
}
}

const pageNode = nodeForPath(rootNode, params.path);
if (!pageNode) {
// eslint-disable-next-line no-console
console.warn('no page node', params.path);
return notFound();
}

// get the MDX for the current doc and render it
let doc: Awaited<ReturnType<typeof getFileBySlug>> | null = null;
try {
Expand All @@ -108,8 +156,19 @@ export default async function Page({params}: {params: {path?: string[]}}) {
}
const {mdxSource, frontMatter} = doc;

// collect versioned files
const allFm = await getDocsFrontMatter();
const versions = getVersionsFromDoc(allFm, pageNode.path);

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

type MetadataProps = {
Expand All @@ -118,6 +177,17 @@ type MetadataProps = {
};
};

// Helper function to clean up canonical tags missing leading or trailing slash
function formatCanonicalTag(tag: string) {
if (tag.charAt(0) !== '/') {
tag = '/' + tag;
}
if (tag.charAt(tag.length - 1) !== '/') {
tag = tag + '/';
}
return tag;
}

export async function generateMetadata({params}: MetadataProps): Promise<Metadata> {
const domain = isDeveloperDocs
? 'https://develop.sentry.dev'
Expand All @@ -128,27 +198,37 @@ export async function generateMetadata({params}: MetadataProps): Promise<Metadat
: domain;
let title =
'Sentry Docs | Application Performance Monitoring &amp; Error Tracking Software';
let customCanonicalTag;
let description =
'Self-hosted and cloud-based application performance monitoring &amp; error tracking that helps software teams see clearer, solve quicker, &amp; learn continuously.';
const images = [{url: `${previewDomain ?? domain}/meta.jpg`, width: 1200, height: 822}];

const rootNode = await getDocsRootNode();

if (params.path) {
const pageNode = nodeForPath(rootNode, params.path);
const pageNode = nodeForPath(
rootNode,
stripVersion(params.path.join('/')).split('/')
);
if (pageNode) {
const guideOrPlatform = getCurrentPlatformOrGuide(rootNode, params.path);

title =
pageNode.frontmatter.title +
(guideOrPlatform ? ` | Sentry for ${guideOrPlatform.title}` : '');
description = pageNode.frontmatter.description ?? '';

if (pageNode.frontmatter.customCanonicalTag) {
customCanonicalTag = formatCanonicalTag(pageNode.frontmatter.customCanonicalTag);
}
}
}

let canonical = domain;
if (params.path) {
canonical = `${domain}/${params.path.join('/')}/`;
}
const canonical = customCanonicalTag
? domain + customCanonicalTag
: params.path
? `${domain}/${params.path.join('/')}/`
: domain;

return {
title,
Expand Down
Loading

0 comments on commit e17118d

Please sign in to comment.