MCPcopy Index your code
hub / github.com/simstudioai/sim / buildProviderColorMap

Function buildProviderColorMap

scripts/generate-docs.ts:3739–3755  ·  view source on GitHub ↗

* Build a map of block-type → bgColor from all block definitions. * Used to pick provider colours for the BlockInfoCard on trigger pages.

()

Source from the content-addressed store, hash-verified

3737 * Used to pick provider colours for the BlockInfoCard on trigger pages.
3738 */
3739async function buildProviderColorMap(): Promise<Map<string, string>> {
3740 const colorMap = new Map<string, string>()
3741 const blockFiles = (await glob(`${BLOCKS_PATH}/*.ts`)).sort()
3742
3743 for (const blockFile of blockFiles) {
3744 const fileContent = fs.readFileSync(blockFile, 'utf-8')
3745 const configs = extractAllBlockConfigs(fileContent)
3746 for (const config of configs) {
3747 if (config.bgColor && config.type) {
3748 const baseType = stripVersionSuffix(config.type)
3749 if (!colorMap.has(baseType)) colorMap.set(baseType, config.bgColor)
3750 }
3751 }
3752 }
3753
3754 return colorMap
3755}
3756
3757/**
3758 * Generate one MDX file per trigger provider and update the sidebar meta.json.

Callers 1

generateAllTriggerDocsFunction · 0.85

Calls 4

stripVersionSuffixFunction · 0.90
globFunction · 0.85
extractAllBlockConfigsFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected