* Build a map of block-type → bgColor from all block definitions. * Used to pick provider colours for the BlockInfoCard on trigger pages.
()
| 3737 | * Used to pick provider colours for the BlockInfoCard on trigger pages. |
| 3738 | */ |
| 3739 | async 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. |
no test coverage detected