deno.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  2. import type {
  3. Docs,
  4. DocsParams,
  5. OnboardingConfig,
  6. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  7. import {
  8. feedbackOnboardingJsLoader,
  9. replayOnboardingJsLoader,
  10. } from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
  11. import {t} from 'sentry/locale';
  12. type Params = DocsParams;
  13. const getInstallConfig = () => [
  14. {
  15. code: [
  16. {
  17. label: 'Deno registry',
  18. value: 'deno',
  19. language: 'javascript',
  20. code: `import * as Sentry from "https://deno.land/x/sentry/index.mjs";"`,
  21. },
  22. {
  23. label: 'npm registry',
  24. value: 'npm',
  25. language: 'javascript',
  26. code: `import * as Sentry from "npm:@sentry/deno";`,
  27. },
  28. ],
  29. },
  30. ];
  31. const getConfigureSnippet = (params: Params) =>
  32. `
  33. Sentry.init({
  34. dsn: "${params.dsn.public}",${
  35. params.isPerformanceSelected
  36. ? `
  37. // enable performance
  38. tracesSampleRate: 1.0,`
  39. : ''
  40. }
  41. });
  42. `;
  43. const getVerifySnippet = () => `;
  44. setTimeout(() => {
  45. throw new Error();
  46. });
  47. `;
  48. const onboarding: OnboardingConfig = {
  49. install: () => [
  50. {
  51. type: StepType.INSTALL,
  52. description: t(
  53. "Sentry captures data by using an SDK within your application's runtime."
  54. ),
  55. configurations: getInstallConfig(),
  56. },
  57. ],
  58. configure: params => [
  59. {
  60. type: StepType.CONFIGURE,
  61. description: t(
  62. "Initialize Sentry as early as possible in your application's lifecycle."
  63. ),
  64. configurations: [
  65. {
  66. language: 'javascript',
  67. code: getConfigureSnippet(params),
  68. },
  69. ],
  70. },
  71. ],
  72. verify: () => [
  73. {
  74. type: StepType.VERIFY,
  75. description: t(
  76. "This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected."
  77. ),
  78. configurations: [
  79. {
  80. language: 'javascript',
  81. code: getVerifySnippet(),
  82. },
  83. ],
  84. },
  85. ],
  86. nextSteps: () => [],
  87. };
  88. const docs: Docs = {
  89. onboarding,
  90. replayOnboardingJsLoader,
  91. feedbackOnboardingJsLoader,
  92. };
  93. export default docs;