remix.tsx 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import {Fragment} from 'react';
  2. import ExternalLink from 'sentry/components/links/externalLink';
  3. import List from 'sentry/components/list';
  4. import ListItem from 'sentry/components/list/listItem';
  5. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  6. import {
  7. Docs,
  8. DocsParams,
  9. OnboardingConfig,
  10. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  11. import {
  12. getReplayConfigureDescription,
  13. getReplaySDKSetupSnippet,
  14. } from 'sentry/components/onboarding/gettingStartedDoc/utils';
  15. import {getJSMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
  16. import {tracePropagationMessage} from 'sentry/components/replaysOnboarding/utils';
  17. import {t, tct} from 'sentry/locale';
  18. type Params = DocsParams;
  19. const getInstallConfig = () => [
  20. {
  21. type: StepType.INSTALL,
  22. configurations: [
  23. {
  24. description: tct(
  25. 'Configure your app automatically with the [wizardLink:Sentry wizard].',
  26. {
  27. wizardLink: (
  28. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/#install" />
  29. ),
  30. }
  31. ),
  32. language: 'bash',
  33. code: `npx @sentry/wizard@latest -i remix`,
  34. },
  35. ],
  36. },
  37. ];
  38. const onboarding: OnboardingConfig = {
  39. introduction: () =>
  40. tct("Sentry's integration with [remixLink:Remix] supports Remix 1.0.0 and above.", {
  41. remixLink: <ExternalLink href="https://remix.run/" />,
  42. }),
  43. install: () => getInstallConfig(),
  44. configure: () => [
  45. {
  46. type: StepType.CONFIGURE,
  47. description: t(
  48. 'The Sentry wizard will automatically add code to your project to inialize and configure the Sentry SDK:'
  49. ),
  50. configurations: [
  51. {
  52. description: (
  53. <List symbol="bullet">
  54. <ListItem>
  55. {tct(
  56. "Create two files in the root directory of your project, [clientEntry:entry.client.tsx] and [serverEntry:entry.server.tsx] (if they don't already exist).",
  57. {
  58. clientEntry: <code />,
  59. serverEntry: <code />,
  60. }
  61. )}
  62. </ListItem>
  63. <ListItem>
  64. {tct(
  65. 'Add the default [sentryInitCode:Sentry.init] call to both, client and server entry files.',
  66. {
  67. sentryInitCode: <code />,
  68. }
  69. )}
  70. </ListItem>
  71. <ListItem>
  72. {tct(
  73. 'Create a [cliRc:.sentryclirc] with an auth token to upload source maps (this file is automatically added to your [gitignore:.gitignore]).',
  74. {
  75. cliRc: <code />,
  76. gitignore: <code />,
  77. }
  78. )}
  79. </ListItem>
  80. <ListItem>
  81. {tct(
  82. 'Adjust your [buildscript:build] script in your [pkgJson:package.json] to automatically upload source maps to Sentry when you build your application.',
  83. {
  84. buildscript: <code />,
  85. pkgJson: <code />,
  86. }
  87. )}
  88. </ListItem>
  89. </List>
  90. ),
  91. },
  92. {
  93. description: tct(
  94. 'You can also further [manualConfigure:configure your SDK] or [manualSetupLink:set it up manually], without the wizard.',
  95. {
  96. manualConfigure: (
  97. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#configuration" />
  98. ),
  99. manualSetupLink: (
  100. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/" />
  101. ),
  102. }
  103. ),
  104. },
  105. ],
  106. },
  107. ],
  108. verify: () => [],
  109. nextSteps: () => [
  110. {
  111. id: 'performance-monitoring',
  112. name: t('Performance Monitoring'),
  113. description: t(
  114. 'Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
  115. ),
  116. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/performance/',
  117. },
  118. {
  119. id: 'session-replay',
  120. name: t('Session Replay'),
  121. description: t(
  122. 'Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.'
  123. ),
  124. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/session-replay/',
  125. },
  126. ],
  127. };
  128. const replayOnboarding: OnboardingConfig = {
  129. install: () => getInstallConfig(),
  130. configure: (params: Params) => [
  131. {
  132. type: StepType.CONFIGURE,
  133. description: getReplayConfigureDescription({
  134. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/session-replay/',
  135. }),
  136. configurations: [
  137. {
  138. code: [
  139. {
  140. label: 'JavaScript',
  141. value: 'javascript',
  142. language: 'javascript',
  143. code: getReplaySDKSetupSnippet({
  144. importStatement: `import * as Sentry from "@sentry/remix";`,
  145. dsn: params.dsn,
  146. mask: params.replayOptions?.mask,
  147. block: params.replayOptions?.block,
  148. }),
  149. },
  150. ],
  151. },
  152. ],
  153. additionalInfo: (
  154. <Fragment>
  155. {tracePropagationMessage}
  156. {tct(
  157. 'Note: The Replay integration only needs to be added to your [entryClient:entry.client.tsx] file. It will not run if it is added into [sentryServer:sentry.server.config.js].',
  158. {entryClient: <code />, sentryServer: <code />}
  159. )}
  160. </Fragment>
  161. ),
  162. },
  163. ],
  164. verify: () => [],
  165. nextSteps: () => [],
  166. };
  167. const docs: Docs = {
  168. onboarding,
  169. replayOnboardingNpm: replayOnboarding,
  170. customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
  171. };
  172. export default docs;