remix.tsx 5.7 KB

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