remix.tsx 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 crashReportCallout from 'sentry/components/onboarding/gettingStartedDoc/feedback/crashReportCallout';
  6. import tracePropagationMessage from 'sentry/components/onboarding/gettingStartedDoc/replay/tracePropagationMessage';
  7. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  8. import type {
  9. Docs,
  10. DocsParams,
  11. OnboardingConfig,
  12. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  13. import {
  14. getFeedbackConfigureDescription,
  15. getFeedbackSDKSetupSnippet,
  16. } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
  17. import {getJSMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
  18. import {
  19. getReplayConfigureDescription,
  20. getReplaySDKSetupSnippet,
  21. } from 'sentry/components/onboarding/gettingStartedDoc/utils/replayOnboarding';
  22. import {t, tct} from 'sentry/locale';
  23. type Params = DocsParams;
  24. const getConfigStep = () => [
  25. {
  26. description: tct(
  27. 'Configure your app automatically with the [wizardLink:Sentry wizard].',
  28. {
  29. wizardLink: (
  30. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/#install" />
  31. ),
  32. }
  33. ),
  34. language: 'bash',
  35. code: `npx @sentry/wizard@latest -i remix`,
  36. },
  37. ];
  38. const getInstallConfig = () => [
  39. {
  40. type: StepType.INSTALL,
  41. configurations: getConfigStep(),
  42. },
  43. ];
  44. const onboarding: OnboardingConfig = {
  45. introduction: () =>
  46. tct("Sentry's integration with [remixLink:Remix] supports Remix 1.0.0 and above.", {
  47. remixLink: <ExternalLink href="https://remix.run/" />,
  48. }),
  49. install: () => getInstallConfig(),
  50. configure: () => [
  51. {
  52. type: StepType.CONFIGURE,
  53. description: t(
  54. 'The Sentry wizard will automatically add code to your project to inialize and configure the Sentry SDK:'
  55. ),
  56. configurations: [
  57. {
  58. description: (
  59. <List symbol="bullet">
  60. <ListItem>
  61. {tct(
  62. "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).",
  63. {
  64. clientEntry: <code />,
  65. serverEntry: <code />,
  66. }
  67. )}
  68. </ListItem>
  69. <ListItem>
  70. {tct(
  71. 'Add the default [sentryInitCode:Sentry.init] call to both, client and server entry files.',
  72. {
  73. sentryInitCode: <code />,
  74. }
  75. )}
  76. </ListItem>
  77. <ListItem>
  78. {tct(
  79. 'Create a [cliRc:.sentryclirc] with an auth token to upload source maps (this file is automatically added to your [gitignore:.gitignore]).',
  80. {
  81. cliRc: <code />,
  82. gitignore: <code />,
  83. }
  84. )}
  85. </ListItem>
  86. <ListItem>
  87. {tct(
  88. 'Adjust your [buildscript:build] script in your [pkgJson:package.json] to automatically upload source maps to Sentry when you build your application.',
  89. {
  90. buildscript: <code />,
  91. pkgJson: <code />,
  92. }
  93. )}
  94. </ListItem>
  95. </List>
  96. ),
  97. },
  98. {
  99. description: tct(
  100. 'You can also further [manualConfigure:configure your SDK] or [manualSetupLink:set it up manually], without the wizard.',
  101. {
  102. manualConfigure: (
  103. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#configuration" />
  104. ),
  105. manualSetupLink: (
  106. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/" />
  107. ),
  108. }
  109. ),
  110. },
  111. ],
  112. },
  113. ],
  114. verify: () => [],
  115. nextSteps: () => [
  116. {
  117. id: 'performance-monitoring',
  118. name: t('Performance Monitoring'),
  119. description: t(
  120. 'Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
  121. ),
  122. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/performance/',
  123. },
  124. {
  125. id: 'session-replay',
  126. name: t('Session Replay'),
  127. description: t(
  128. '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.'
  129. ),
  130. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/session-replay/',
  131. },
  132. ],
  133. };
  134. const replayOnboarding: OnboardingConfig = {
  135. install: () => getInstallConfig(),
  136. configure: (params: Params) => [
  137. {
  138. type: StepType.CONFIGURE,
  139. description: getReplayConfigureDescription({
  140. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/session-replay/',
  141. }),
  142. configurations: [
  143. {
  144. code: [
  145. {
  146. label: 'JavaScript',
  147. value: 'javascript',
  148. language: 'javascript',
  149. code: getReplaySDKSetupSnippet({
  150. importStatement: `import * as Sentry from "@sentry/remix";`,
  151. dsn: params.dsn,
  152. mask: params.replayOptions?.mask,
  153. block: params.replayOptions?.block,
  154. }),
  155. },
  156. ],
  157. },
  158. ],
  159. additionalInfo: (
  160. <Fragment>
  161. {tracePropagationMessage}
  162. {tct(
  163. '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].',
  164. {entryClient: <code />, sentryServer: <code />}
  165. )}
  166. </Fragment>
  167. ),
  168. },
  169. ],
  170. verify: () => [],
  171. nextSteps: () => [],
  172. };
  173. const feedbackOnboarding: OnboardingConfig = {
  174. install: () => [
  175. {
  176. type: StepType.INSTALL,
  177. description: tct(
  178. 'For the User Feedback integration to work, you must have the Sentry browser SDK package, or an equivalent framework SDK (e.g. [code:@sentry/remix]) installed, minimum version 7.85.0.',
  179. {
  180. code: <code />,
  181. }
  182. ),
  183. configurations: getConfigStep(),
  184. },
  185. ],
  186. configure: (params: Params) => [
  187. {
  188. type: StepType.CONFIGURE,
  189. description: getFeedbackConfigureDescription({
  190. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/',
  191. }),
  192. configurations: [
  193. {
  194. code: [
  195. {
  196. label: 'JavaScript',
  197. value: 'javascript',
  198. language: 'javascript',
  199. code: getFeedbackSDKSetupSnippet({
  200. importStatement: `import * as Sentry from "@sentry/remix";`,
  201. dsn: params.dsn,
  202. }),
  203. },
  204. ],
  205. },
  206. ],
  207. additionalInfo: crashReportCallout({
  208. link: 'https://docs.sentry.io/platforms/javascript/guides/remix/user-feedback/#user-feedback-api',
  209. }),
  210. },
  211. ],
  212. verify: () => [],
  213. nextSteps: () => [],
  214. };
  215. const docs: Docs = {
  216. onboarding,
  217. feedbackOnboardingNpm: feedbackOnboarding,
  218. replayOnboardingNpm: replayOnboarding,
  219. customMetricsOnboarding: getJSMetricsOnboarding({getInstallConfig}),
  220. };
  221. export default docs;