platforms.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import integrationDocsPlatforms from 'integration-docs-platforms';
  2. import sortBy from 'lodash/sortBy';
  3. import {t} from 'sentry/locale';
  4. import {PlatformIntegration} from 'sentry/types';
  5. import {tracing} from './platformCategories';
  6. const otherPlatform = {
  7. integrations: [
  8. {
  9. link: 'https://docs.sentry.io/platforms/',
  10. type: 'language',
  11. id: 'other',
  12. name: t('Other'),
  13. },
  14. ],
  15. id: 'other',
  16. name: t('Other'),
  17. };
  18. export enum ReactDocVariant {
  19. ErrorMonitoring = 'javascript-react-with-error-monitoring',
  20. ErrorMonitoringAndPerformance = 'javascript-react-with-error-monitoring-and-performance',
  21. ErrorMonitoringAndSessionReplay = 'javascript-react-with-error-monitoring-and-replay',
  22. ErrorMonitoringPerformanceAndReplay = 'javascript-react-with-error-monitoring-performance-and-replay',
  23. }
  24. const platformIntegrations: PlatformIntegration[] = [
  25. ...integrationDocsPlatforms.platforms,
  26. otherPlatform,
  27. ]
  28. .map(platform => {
  29. const integrations = platform.integrations.reduce((acc, value) => {
  30. // filter out any javascript-react-* platforms; as they're not meant to be used as a platform in the PlatformPicker component
  31. // but only to load specific documentation for the React SDK
  32. if (Object.values(ReactDocVariant).includes(value.id as ReactDocVariant)) {
  33. return acc;
  34. }
  35. // filter out any tracing platforms; as they're not meant to be used as a platform for
  36. // the project creation flow
  37. if ((tracing as readonly string[]).includes(value.id)) {
  38. return acc;
  39. }
  40. // filter out any performance onboarding documentation
  41. if (value.id.includes('performance-onboarding')) {
  42. return acc;
  43. }
  44. // filter out any replay onboarding documentation
  45. if (value.id.includes('replay-onboarding')) {
  46. return acc;
  47. }
  48. // filter out any profiling onboarding documentation
  49. if (value.id.includes('profiling-onboarding')) {
  50. return acc;
  51. }
  52. if (!acc[value.id]) {
  53. acc[value.id] = {...value, language: platform.id};
  54. return acc;
  55. }
  56. return acc;
  57. }, {});
  58. return Object.values(integrations) as PlatformIntegration[];
  59. })
  60. .flat();
  61. const platforms = sortBy(platformIntegrations, 'id');
  62. export default platforms;