nextjs.tsx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
  6. import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
  7. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  8. import {t, tct} from 'sentry/locale';
  9. export const steps = (): LayoutProps['steps'] => [
  10. {
  11. type: StepType.INSTALL,
  12. description: (
  13. <p>
  14. {tct('Configure your app automatically with the [wizardLink:Sentry wizard].', {
  15. wizardLink: (
  16. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/nextjs/#install" />
  17. ),
  18. })}
  19. </p>
  20. ),
  21. configurations: [
  22. {
  23. language: 'bash',
  24. code: `npx @sentry/wizard@latest -i nextjs`,
  25. },
  26. ],
  27. },
  28. {
  29. type: StepType.CONFIGURE,
  30. description: (
  31. <Fragment>
  32. {t(
  33. 'The Sentry wizard will automatically patch your application to configure the Sentry SDK:'
  34. )}
  35. <List symbol="bullet">
  36. <ListItem>
  37. {tct(
  38. 'Create [clientCode:sentry.client.config.js] and [serverCode:sentry.server.config.js] with the default [sentryInitCode:Sentry.init].',
  39. {
  40. clientCode: <code />,
  41. serverCode: <code />,
  42. sentryInitCode: <code />,
  43. }
  44. )}
  45. </ListItem>
  46. <ListItem>
  47. {tct(
  48. 'Create or update your Next.js config [nextConfig:next.confg.js] with the default Sentry configuration',
  49. {
  50. nextConfig: <code />,
  51. }
  52. )}
  53. </ListItem>
  54. <ListItem>
  55. {tct(
  56. 'Create [sentryClircCode:.sentryclirc] and [sentryPropertiesCode:sentry.properties] files with configuration for sentry-cli (which is used when automatically uploading source maps).',
  57. {
  58. sentryClircCode: <code />,
  59. sentryPropertiesCode: <code />,
  60. }
  61. )}
  62. </ListItem>
  63. <ListItem>
  64. {tct('add an example page to your app to verify your Sentry setup', {
  65. sentryClircCode: <code />,
  66. })}
  67. </ListItem>
  68. </List>
  69. <p>
  70. {tct('Alternatively, you can also [manualSetupLink:set up the SDK manually].', {
  71. manualSetupLink: (
  72. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/" />
  73. ),
  74. })}
  75. </p>
  76. </Fragment>
  77. ),
  78. },
  79. ];
  80. // Configuration End
  81. export function GettingStartedWithNextJs({...props}: ModuleProps) {
  82. return <Layout steps={steps()} {...props} />;
  83. }
  84. export default GettingStartedWithNextJs;