config.tsx 892 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* global process */
  2. /**
  3. * This module is used to define the look and feels for charts rendered via the
  4. * backend chart rendering service Chartcuterie.
  5. *
  6. * Be careful what you import into this file, as it will end up being bundled
  7. * into the configuration file loaded by the service.
  8. */
  9. import {discoverCharts} from './discover';
  10. import {ChartcuterieConfig, ChartType, RenderConfig, RenderDescriptor} from './types';
  11. /**
  12. * All registered style descriptors
  13. */
  14. const renderConfig: RenderConfig<ChartType> = new Map();
  15. /**
  16. * Chartcuterie configuration object
  17. */
  18. const config: ChartcuterieConfig = {
  19. version: process.env.COMMIT_SHA!,
  20. renderConfig,
  21. };
  22. /**
  23. * Register a style descriptor
  24. */
  25. const register = (renderDescriptor: RenderDescriptor<ChartType>) =>
  26. renderConfig.set(renderDescriptor.key, renderDescriptor);
  27. discoverCharts.forEach(register);
  28. export default config;