Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Bun docs #7858

Merged
merged 10 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"js-cookie": "^3.0.5",
"js-yaml": "^3.0.0",
"jsdom": "^22.1.0",
"platformicons": "^5.6.0",
"platformicons": "^5.6.4",
"prism-sentry": "^1.0.2",
"prismjs": "^1.27.0",
"query-string": "^6.13.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/guideGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function GuideGrid({platform, className}: Props) {
<li key={guide.key}>
<SmartLink to={guide.url}>
<PlatformIcon
platform={guide.key}
platform={guide.icon ?? guide.key}
style={{marginRight: '0.5rem', border: 0, boxShadow: 'none'}}
format="sm"
/>
Expand Down
2 changes: 2 additions & 0 deletions src/components/hooks/usePlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const query = graphql`
title
url
sdk
icon
caseStyle
supportLevel
fallbackPlatform
Expand All @@ -26,6 +27,7 @@ const query = graphql`
name
title
url
icon
sdk
caseStyle
supportLevel
Expand Down
4 changes: 2 additions & 2 deletions src/components/navbarPlatformDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function NavbarPlatformDropdown() {
currentPlatform ? (
<Fragment>
<PlatformIcon
platform={currentPlatform.key}
platform={currentPlatform.icon ?? currentPlatform.key}
size={16}
style={{marginRight: '0.5rem'}}
format="sm"
Expand All @@ -36,7 +36,7 @@ export function NavbarPlatformDropdown() {
to={platform.url}
>
<PlatformIcon
platform={platform.key}
platform={platform.icon ?? platform.key}
size={16}
style={{marginRight: '0.5rem'}}
format="sm"
Expand Down
2 changes: 1 addition & 1 deletion src/components/platformGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function PlatformGrid({noGuides = false}: Props) {
<SmartLink to={platform.url}>
<PlatformIcon
size={82}
platform={platform.key}
platform={platform.icon ?? platform.key}
format="lg"
style={{maxWidth: 'none', border: 0, boxShadow: 'none'}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/platformLinkWithLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function PlatformLinkWithLogo({platform, label, url}: Props) {
<SmartLink to={url}>
<PlatformIcon
size={20}
platform={currentPlatform.key}
platform={currentPlatform.icon ?? currentPlatform.key}
style={{
marginRight: '0.5rem',
marginTop: '0.2rem',
Expand Down
3 changes: 3 additions & 0 deletions src/data/platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@
type: language
name: Dart
case_style: camelCase
- slug: bun
type: framework
name: Bun
2 changes: 2 additions & 0 deletions src/gatsby/createSchemaCustomization/platformSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const getPlatformTypeDefs = () => {
categories: [PlatformCategory!]
url: String!
fallbackPlatform: String!
icon: String
}

type Platform implements Node {
Expand All @@ -44,6 +45,7 @@ export const getPlatformTypeDefs = () => {
categories: [PlatformCategory!]
url: String!
fallbackPlatform: String
icon: String
}
`,
];
Expand Down
6 changes: 5 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ function IndexPage() {
{visiblePlatforms.map(platform => (
<SmartLink to={platform.url} className="hover-card-link" key={platform.key}>
<div className="image-frame">
<PlatformIcon size={48} platform={platform.key} format="lg" />
<PlatformIcon
size={48}
platform={platform.icon ?? platform.key}
format="lg"
/>
</div>
{platform.title}
</SmartLink>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/platform-redirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function BasePlatformRedirect({path = '/'}: Props) {
<SmartLink to={`/platforms/${platform.key}${path}`}>
<PlatformIcon
size={16}
platform={platform.key}
platform={platform.icon ?? platform.key}
style={{marginRight: '0.5rem'}}
format="sm"
/>
Expand Down
12 changes: 12 additions & 0 deletions src/platform-includes/getting-started-config/javascript.bun.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Once installed, you can capture exceptions manually for now.

<SignInNote />

```javascript {tabTitle:ESM}
import * as Sentry from "@sentry/bun";

Sentry.init({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash {tabTitle:Bun}
bun add @sentry/bun
```
12 changes: 12 additions & 0 deletions src/platform-includes/getting-started-primer/javascript.bun.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Note>

The Bun SDK is currently in Beta.

</Note>

<Alert level="warning" title="Note">

It's not possible to capture global unhandled exceptions, unhandled promise rejections now - Bun is working on adding support for it.
[Github Issue](https://github.com/oven-sh/bun/issues/5091) follow this issue.

</Alert>
Empty file.
16 changes: 16 additions & 0 deletions src/platform-includes/getting-started-verify/javascript.bun.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const transaction = Sentry.startTransaction({
op: "test",
name: "My First Test Transaction",
});

setTimeout(() => {
try {
foo();
} catch (e) {
Sentry.captureException(e);
} finally {
transaction.finish();
}
}, 99);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Sentry SDK provides a `Tracing` integration to add automatic instrumentation for monitoring the performance of your application.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<SignInNote />

```javascript
import * as Sentry from "@sentry/bun";

Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [new Sentry.Tracing()],

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
To enable tracing, include the `Tracing` integration in your SDK configuration options.

<SignInNote />

```javascript
import * as Sentry from "@sentry/bun";

Sentry.init({
dsn: "___PUBLIC_DSN___",

integrations: [new Sentry.Tracing()],

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tracing is available by default in the Sentry Bun.
2 changes: 1 addition & 1 deletion src/platforms/common/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<PlatformContent includePath="getting-started-primer" />

On this page, we get you up and running with Sentry's SDK, so that it will automatically report errors and exceptions in your application.
On this page, we get you up and running with Sentry's SDK.

<PlatformSection noGuides notSupported={["android", "dart", "elixir", "flutter", "perl", "react-native", "unity", "unreal", "kotlin-multiplatform"]}>

Expand Down
1 change: 1 addition & 0 deletions src/platforms/javascript/common/install/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_order: 1
description: "Review our alternate installation methods."
notSupported:
- javascript.angular
- javascript.bun
- javascript.capacitor
- javascript.cordova
- javascript.electron
Expand Down
2 changes: 2 additions & 0 deletions src/platforms/javascript/common/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Profiling
sidebar_order: 1
supported:
- javascript
notSupported:
- javascript.bun
description: "Learn what transactions are captured after tracing is enabled."
---

Expand Down
9 changes: 9 additions & 0 deletions src/platforms/javascript/guides/bun/config.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these docs make more sense to live here, in the browser JS frameworks, or in the Node frameworks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good point, we discussed this
it's either/or 😅

At one point we might just merge Javascript and Node together.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Bun
sdk: sentry.javascript.bun
fallbackPlatform: javascript
caseStyle: camelCase
supportLevel: production
icon: bun
categories:
- browser
- server
4 changes: 4 additions & 0 deletions src/types/platform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export interface PlatformConfig {
* inherit configuration values from the parent platform.
*/
fallbackPlatform?: string;
/**
* The icon to use for this platform. This is the name of the icon as defined
*/
icon?: string;
/**
* Keywords used for search etc.
*/
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12162,10 +12162,10 @@ platform@^1.3.6:
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==

platformicons@^5.6.0:
version "5.6.2"
resolved "https://registry.yarnpkg.com/platformicons/-/platformicons-5.6.2.tgz#24d109e56c3dcedbac513f5b8fa73335e0eddd1e"
integrity sha512-2X/cWYohEqVAMQiz/MCVjgJaFEX/jiSXncqcgnMztPcsCSL5JpLn4d8CBeSBjpMIDTlCvGF90p0vM0oc7yGTpA==
platformicons@^5.6.4:
version "5.6.4"
resolved "https://registry.yarnpkg.com/platformicons/-/platformicons-5.6.4.tgz#1c5b5aa410ea3f4a5113214863c08b7a5d7e5fc8"
integrity sha512-Mx6EEBC0XuwY7RU8Qa7YCdjhXj0QV7aFx1gYyBH8iEzz7uCLQmP7gj9WLfEu1WGo69AeJlkTjX6ViiEfTbUZOQ==
dependencies:
"@types/node" "*"
"@types/react" "*"
Expand Down
Loading