|
@@ -1,36 +1,35 @@
|
|
|
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 {PlatformKey} from 'sentry/data/platformCategories';
|
|
|
import {t, tct} from 'sentry/locale';
|
|
|
-import type {Organization} from 'sentry/types';
|
|
|
+import {
|
|
|
+ getDefaultInitParams,
|
|
|
+ getDefaultNodeImports,
|
|
|
+ getInstallSnippet,
|
|
|
+ getProductInitParams,
|
|
|
+ getProductIntegrations,
|
|
|
+ getProductSelectionMap,
|
|
|
+ joinWithIndentation,
|
|
|
+} from 'sentry/utils/gettingStartedDocs/node';
|
|
|
|
|
|
-type StepProps = {
|
|
|
- newOrg: boolean;
|
|
|
- organization: Organization;
|
|
|
- platformKey: PlatformKey;
|
|
|
- projectId: string;
|
|
|
- sentryInitContent: string;
|
|
|
-};
|
|
|
+interface StepProps {
|
|
|
+ importContent: string;
|
|
|
+ initContent: string;
|
|
|
+ installSnippet: string;
|
|
|
+}
|
|
|
|
|
|
export const steps = ({
|
|
|
- sentryInitContent,
|
|
|
-}: Partial<StepProps> = {}): LayoutProps['steps'] => [
|
|
|
+ installSnippet,
|
|
|
+ importContent,
|
|
|
+ initContent,
|
|
|
+}: StepProps): LayoutProps['steps'] => [
|
|
|
{
|
|
|
type: StepType.INSTALL,
|
|
|
- description: (
|
|
|
- <p>{tct('Add [code:@sentry/node] as a dependency:', {code: <code />})}</p>
|
|
|
- ),
|
|
|
+ description: t('Add the Sentry Node SDK as a dependency:'),
|
|
|
configurations: [
|
|
|
{
|
|
|
language: 'bash',
|
|
|
- code: `
|
|
|
-# Using yarn
|
|
|
-yarn add @sentry/node
|
|
|
-
|
|
|
-# Using npm
|
|
|
-npm install --save @sentry/node
|
|
|
- `,
|
|
|
+ code: installSnippet,
|
|
|
},
|
|
|
],
|
|
|
},
|
|
@@ -43,10 +42,10 @@ npm install --save @sentry/node
|
|
|
code: `
|
|
|
"use strict";
|
|
|
|
|
|
-const Sentry = require("@sentry/node");
|
|
|
+${importContent}
|
|
|
|
|
|
Sentry.init({
|
|
|
- ${sentryInitContent},
|
|
|
+${initContent}
|
|
|
});
|
|
|
|
|
|
module.exports = async function (context, req) {
|
|
@@ -81,21 +80,33 @@ module.exports = async function (context, req) {
|
|
|
|
|
|
export function GettingStartedWithAzurefunctions({
|
|
|
dsn,
|
|
|
- organization,
|
|
|
newOrg,
|
|
|
platformKey,
|
|
|
- projectId,
|
|
|
+ activeProductSelection = [],
|
|
|
}: ModuleProps) {
|
|
|
- const sentryInitContent: string[] = [`dsn: "${dsn}"`];
|
|
|
+ const productSelection = getProductSelectionMap(activeProductSelection);
|
|
|
+
|
|
|
+ const installSnippet = getInstallSnippet({productSelection});
|
|
|
+ const imports = getDefaultNodeImports({productSelection});
|
|
|
+ const integrations = getProductIntegrations({productSelection});
|
|
|
+
|
|
|
+ const integrationParam =
|
|
|
+ integrations.length > 0
|
|
|
+ ? `integrations: [\n${joinWithIndentation(integrations)}\n],`
|
|
|
+ : null;
|
|
|
+
|
|
|
+ const initContent = joinWithIndentation([
|
|
|
+ ...getDefaultInitParams({dsn}),
|
|
|
+ ...(integrationParam ? [integrationParam] : []),
|
|
|
+ ...getProductInitParams({productSelection}),
|
|
|
+ ]);
|
|
|
|
|
|
return (
|
|
|
<Layout
|
|
|
steps={steps({
|
|
|
- sentryInitContent: sentryInitContent.join('\n'),
|
|
|
- organization,
|
|
|
- newOrg,
|
|
|
- platformKey,
|
|
|
- projectId,
|
|
|
+ installSnippet,
|
|
|
+ importContent: imports.join('\n'),
|
|
|
+ initContent,
|
|
|
})}
|
|
|
newOrg={newOrg}
|
|
|
platformKey={platformKey}
|