sveltekit.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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/sveltekit/#install" />
  17. ),
  18. })}
  19. </p>
  20. ),
  21. configurations: [
  22. {
  23. language: 'bash',
  24. code: `npx @sentry/wizard@latest -i sveltekit`,
  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 or update [hookClientCode:src/hooks.client.js] and [hookServerCode:src/hooks.server.js] with the default [sentryInitCode:Sentry.init] call and SvelteKit hooks handlers.',
  39. {
  40. hookClientCode: <code />,
  41. hookServerCode: <code />,
  42. sentryInitCode: <code />,
  43. }
  44. )}
  45. </ListItem>
  46. <ListItem>
  47. {tct(
  48. 'Update [code:vite.config.js] to add source maps upload and auto-instrumentation via Vite plugins.',
  49. {
  50. code: <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. </List>
  64. <p>
  65. {tct('Alternatively, you can also [manualSetupLink:set up the SDK manually].', {
  66. manualSetupLink: (
  67. <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/sveltekit/manual-setup/" />
  68. ),
  69. })}
  70. </p>
  71. </Fragment>
  72. ),
  73. },
  74. ];
  75. // Configuration End
  76. export function GettingStartedWithSvelteKit({...props}: ModuleProps) {
  77. return <Layout steps={steps()} {...props} />;
  78. }
  79. export default GettingStartedWithSvelteKit;