platforms.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. const platformIntegrations: PlatformIntegration[] = [
  19. ...integrationDocsPlatforms.platforms,
  20. otherPlatform,
  21. ]
  22. .map(platform => {
  23. const integrations = platform.integrations.reduce((acc, value) => {
  24. // filter out any javascript-[angular|angularjs|ember|gatsby|nextjs|react|remix|svelte|sveltekit|vue]-* platforms; as they're not meant to be used as a platform in the PlatformPicker component
  25. if (value.id.match('^javascript-([A-Za-z]+)-([a-zA-Z0-9]+.*)$')) {
  26. return acc;
  27. }
  28. // filter out any tracing platforms; as they're not meant to be used as a platform for
  29. // the project creation flow
  30. if ((tracing as readonly string[]).includes(value.id)) {
  31. return acc;
  32. }
  33. // filter out any performance onboarding documentation
  34. if (value.id.includes('performance-onboarding')) {
  35. return acc;
  36. }
  37. // filter out any replay onboarding documentation
  38. if (value.id.includes('replay-onboarding')) {
  39. return acc;
  40. }
  41. // filter out any profiling onboarding documentation
  42. if (value.id.includes('profiling-onboarding')) {
  43. return acc;
  44. }
  45. if (!acc[value.id]) {
  46. acc[value.id] = {...value, language: platform.id};
  47. return acc;
  48. }
  49. return acc;
  50. }, {});
  51. return Object.values(integrations) as PlatformIntegration[];
  52. })
  53. .flat();
  54. const platforms = sortBy(platformIntegrations, 'id');
  55. export default platforms;