|
@@ -1,125 +1,93 @@
|
|
|
-import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
|
|
|
-import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
|
|
|
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
|
|
|
-import {ProductSolution} from 'sentry/components/onboarding/productSelection';
|
|
|
+import type {
|
|
|
+ Docs,
|
|
|
+ DocsParams,
|
|
|
+ OnboardingConfig,
|
|
|
+} from 'sentry/components/onboarding/gettingStartedDoc/types';
|
|
|
import {t} from 'sentry/locale';
|
|
|
-import type {Organization, PlatformKey} from 'sentry/types';
|
|
|
|
|
|
-type StepProps = {
|
|
|
- newOrg: boolean;
|
|
|
- organization: Organization;
|
|
|
- platformKey: PlatformKey;
|
|
|
- projectId: string;
|
|
|
- sentryInitContent: string;
|
|
|
-};
|
|
|
-
|
|
|
-const performanceOtherConfig = `
|
|
|
-// Performance Monitoring
|
|
|
-tracesSampleRate: 1.0, // Capture 100% of the transactions`;
|
|
|
+type Params = DocsParams;
|
|
|
|
|
|
-export const steps = ({
|
|
|
- sentryInitContent,
|
|
|
-}: Partial<StepProps> = {}): LayoutProps['steps'] => [
|
|
|
- {
|
|
|
- type: StepType.INSTALL,
|
|
|
- description: t(
|
|
|
- "Sentry captures data by using an SDK within your application's runtime."
|
|
|
- ),
|
|
|
- configurations: [
|
|
|
- {
|
|
|
- language: 'bash',
|
|
|
- code: 'bun add @sentry/bun',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- type: StepType.CONFIGURE,
|
|
|
- description: t(
|
|
|
- "Initialize Sentry as early as possible in your application's lifecycle."
|
|
|
- ),
|
|
|
- configurations: [
|
|
|
- {
|
|
|
- language: 'javascript',
|
|
|
- code: `
|
|
|
+const getConfigureSnippet = (params: Params) => `
|
|
|
//...
|
|
|
import * as Sentry from "@sentry/bun";
|
|
|
|
|
|
Sentry.init({
|
|
|
- ${sentryInitContent}
|
|
|
-});
|
|
|
- `,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- type: StepType.VERIFY,
|
|
|
- description: t(
|
|
|
- "This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected."
|
|
|
- ),
|
|
|
- configurations: [
|
|
|
- {
|
|
|
- language: 'javascript',
|
|
|
- code: `try {
|
|
|
- throw new Error('Sentry Bun test');
|
|
|
- } catch (e) {
|
|
|
- Sentry.captureException(e);
|
|
|
- }`,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-];
|
|
|
-
|
|
|
-export const nextSteps = [
|
|
|
- {
|
|
|
- id: 'performance-monitoring',
|
|
|
- name: t('Performance Monitoring'),
|
|
|
- description: t(
|
|
|
- 'Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
|
|
|
- ),
|
|
|
- link: 'https://docs.sentry.io/platforms/javascript/guides/bun/performance/',
|
|
|
- },
|
|
|
-];
|
|
|
-// Configuration End
|
|
|
-
|
|
|
-export function GettingStartedWithBun({
|
|
|
- dsn,
|
|
|
- activeProductSelection = [],
|
|
|
- newOrg,
|
|
|
- platformKey,
|
|
|
- ...props
|
|
|
-}: ModuleProps) {
|
|
|
- const integrations: string[] = [];
|
|
|
- const otherConfigs: string[] = [];
|
|
|
- let nextStepDocs = [...nextSteps];
|
|
|
-
|
|
|
- if (activeProductSelection.includes(ProductSolution.PERFORMANCE_MONITORING)) {
|
|
|
- otherConfigs.push(performanceOtherConfig.trim());
|
|
|
- nextStepDocs = nextStepDocs.filter(
|
|
|
- step => step.id !== ProductSolution.PERFORMANCE_MONITORING
|
|
|
- );
|
|
|
+ dsn: "${params.dsn}",${
|
|
|
+ params.isPerformanceSelected
|
|
|
+ ? `
|
|
|
+ // Performance Monitoring
|
|
|
+ tracesSampleRate: 1.0, // Capture 100% of the transactions`
|
|
|
+ : ''
|
|
|
}
|
|
|
+});`;
|
|
|
|
|
|
- let sentryInitContent: string[] = [`dsn: "${dsn}",`];
|
|
|
+const getVerifySnippet = () => `try {
|
|
|
+ throw new Error('Sentry Bun test');
|
|
|
+} catch (e) {
|
|
|
+ Sentry.captureException(e);
|
|
|
+}`;
|
|
|
|
|
|
- if (integrations.length > 0) {
|
|
|
- sentryInitContent = sentryInitContent.concat('integrations: [', integrations, '],');
|
|
|
- }
|
|
|
-
|
|
|
- if (otherConfigs.length > 0) {
|
|
|
- sentryInitContent = sentryInitContent.concat(otherConfigs);
|
|
|
- }
|
|
|
+const onboarding: OnboardingConfig = {
|
|
|
+ install: () => [
|
|
|
+ {
|
|
|
+ type: StepType.INSTALL,
|
|
|
+ description: t(
|
|
|
+ "Sentry captures data by using an SDK within your application's runtime."
|
|
|
+ ),
|
|
|
+ configurations: [
|
|
|
+ {
|
|
|
+ language: 'bash',
|
|
|
+ code: 'bun add @sentry/bun',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ configure: params => [
|
|
|
+ {
|
|
|
+ type: StepType.CONFIGURE,
|
|
|
+ description: t(
|
|
|
+ "Initialize Sentry as early as possible in your application's lifecycle."
|
|
|
+ ),
|
|
|
+ configurations: [
|
|
|
+ {
|
|
|
+ language: 'javascript',
|
|
|
+ code: getConfigureSnippet(params),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ verify: () => [
|
|
|
+ {
|
|
|
+ type: StepType.VERIFY,
|
|
|
+ description: t(
|
|
|
+ "This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected."
|
|
|
+ ),
|
|
|
+ configurations: [
|
|
|
+ {
|
|
|
+ language: 'javascript',
|
|
|
+ code: getVerifySnippet(),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ nextSteps: params =>
|
|
|
+ params.isPerformanceSelected
|
|
|
+ ? []
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ id: 'performance-monitoring',
|
|
|
+ name: t('Performance Monitoring'),
|
|
|
+ description: t(
|
|
|
+ 'Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
|
|
|
+ ),
|
|
|
+ link: 'https://docs.sentry.io/platforms/javascript/guides/bun/performance/',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+};
|
|
|
|
|
|
- return (
|
|
|
- <Layout
|
|
|
- steps={steps({
|
|
|
- sentryInitContent: sentryInitContent.join('\n'),
|
|
|
- })}
|
|
|
- nextSteps={nextStepDocs}
|
|
|
- platformKey={platformKey}
|
|
|
- newOrg={newOrg}
|
|
|
- {...props}
|
|
|
- />
|
|
|
- );
|
|
|
-}
|
|
|
+const docs: Docs = {
|
|
|
+ onboarding,
|
|
|
+};
|
|
|
|
|
|
-export default GettingStartedWithBun;
|
|
|
+export default docs;
|