(blockPath: string)
| 2706 | } |
| 2707 | |
| 2708 | async function generateBlockDoc(blockPath: string) { |
| 2709 | try { |
| 2710 | const blockFileName = path.basename(blockPath, '.ts') |
| 2711 | if (blockFileName.endsWith('.test')) { |
| 2712 | return |
| 2713 | } |
| 2714 | |
| 2715 | const fileContent = fs.readFileSync(blockPath, 'utf-8') |
| 2716 | |
| 2717 | // Extract ALL block configs from the file (already filters out hideFromToolbar: true) |
| 2718 | const blockConfigs = extractAllBlockConfigs(fileContent) |
| 2719 | |
| 2720 | if (blockConfigs.length === 0) { |
| 2721 | console.warn(`Skipping ${blockFileName} - no valid block configs found`) |
| 2722 | return |
| 2723 | } |
| 2724 | |
| 2725 | // Process each block config |
| 2726 | for (const blockConfig of blockConfigs) { |
| 2727 | if (!blockConfig.type) { |
| 2728 | continue |
| 2729 | } |
| 2730 | |
| 2731 | if ( |
| 2732 | blockConfig.type.includes('_trigger') || |
| 2733 | blockConfig.type.includes('_webhook') || |
| 2734 | blockConfig.type.includes('rss') |
| 2735 | ) { |
| 2736 | console.log(`Skipping ${blockConfig.type} - contains '_trigger'`) |
| 2737 | continue |
| 2738 | } |
| 2739 | |
| 2740 | if ( |
| 2741 | (blockConfig.category === 'blocks' && |
| 2742 | !NATIVE_RESOURCE_BLOCK_TYPES.has(stripVersionSuffix(blockConfig.type))) || |
| 2743 | blockConfig.type === 'sim_workspace_event' || |
| 2744 | blockConfig.type === 'evaluator' || |
| 2745 | blockConfig.type === 'number' || |
| 2746 | blockConfig.type === 'webhook' || |
| 2747 | blockConfig.type === 'schedule' || |
| 2748 | blockConfig.type === 'mcp' || |
| 2749 | blockConfig.type === 'generic_webhook' || |
| 2750 | blockConfig.type === 'rss' |
| 2751 | ) { |
| 2752 | continue |
| 2753 | } |
| 2754 | |
| 2755 | // Use stripped type for file name (removes _v2, _v3 suffixes for cleaner URLs) |
| 2756 | const displayType = stripVersionSuffix(blockConfig.type) |
| 2757 | const outputFilePath = path.join(DOCS_OUTPUT_PATH, `${displayType}.mdx`) |
| 2758 | |
| 2759 | let existingContent: string | null = null |
| 2760 | if (fs.existsSync(outputFilePath)) { |
| 2761 | existingContent = fs.readFileSync(outputFilePath, 'utf-8') |
| 2762 | } |
| 2763 | |
| 2764 | const manualSections = existingContent ? extractManualContent(existingContent) : {} |
| 2765 |
no test coverage detected