* Main function to generate all static JSON data
()
| 35 | * Main function to generate all static JSON data |
| 36 | */ |
| 37 | async function generateLibraryData() { |
| 38 | console.log('🚀 Starting library data generation...') |
| 39 | |
| 40 | try { |
| 41 | // Ensure data directory exists |
| 42 | await ensureDataDirectory() |
| 43 | |
| 44 | // Read all five libraries |
| 45 | const [promptzLibrary, kiroLibrary, kiroBestPracticesLibrary, productTeamsLibrary, genaiStartupsLibrary] = await Promise.allSettled([ |
| 46 | readPromptzLibrary(), |
| 47 | readKiroLibrary(), |
| 48 | readKiroBestPracticesLibrary(), |
| 49 | readProductTeamsLibrary(), |
| 50 | readGenaiStartupsLibrary() |
| 51 | ]) |
| 52 | |
| 53 | // Extract data from successful library reads |
| 54 | const promptzData = promptzLibrary.status === 'fulfilled' ? promptzLibrary.value : createEmptyLibrary('promptz', '') |
| 55 | const kiroData = kiroLibrary.status === 'fulfilled' ? kiroLibrary.value : createEmptyLibrary('kiro-powers', '') |
| 56 | const kiroBestPracticesData = kiroBestPracticesLibrary.status === 'fulfilled' ? kiroBestPracticesLibrary.value : createEmptyLibrary('kiro-best-practices', '') |
| 57 | const productTeamsData = productTeamsLibrary.status === 'fulfilled' ? productTeamsLibrary.value : createEmptyLibrary('product-teams', '') |
| 58 | const genaiStartupsData = genaiStartupsLibrary.status === 'fulfilled' ? genaiStartupsLibrary.value : createEmptyLibrary('genai-startups', '') |
| 59 | |
| 60 | // Log any library read failures |
| 61 | if (promptzLibrary.status === 'rejected') { |
| 62 | console.warn('⚠️ Failed to read promptz library:', promptzLibrary.reason) |
| 63 | } |
| 64 | if (kiroLibrary.status === 'rejected') { |
| 65 | console.warn('⚠️ Failed to read kiro library:', kiroLibrary.reason) |
| 66 | } |
| 67 | if (kiroBestPracticesLibrary.status === 'rejected') { |
| 68 | console.warn('⚠️ Failed to read kiro-best-practices library:', kiroBestPracticesLibrary.reason) |
| 69 | } |
| 70 | if (productTeamsLibrary.status === 'rejected') { |
| 71 | console.warn('⚠️ Failed to read product-teams library:', productTeamsLibrary.reason) |
| 72 | } |
| 73 | if (genaiStartupsLibrary.status === 'rejected') { |
| 74 | console.warn('⚠️ Failed to read genai-startups library:', genaiStartupsLibrary.reason) |
| 75 | } |
| 76 | |
| 77 | // Generate JSON files for each content type |
| 78 | await Promise.all([ |
| 79 | generatePromptsData(promptzData, productTeamsData), |
| 80 | generateAgentsData(promptzData, genaiStartupsData), |
| 81 | generatePowersData(promptzData, kiroData), |
| 82 | generateSteeringData(promptzData, kiroData, kiroBestPracticesData, productTeamsData, genaiStartupsData), |
| 83 | generateHooksData(promptzData, kiroBestPracticesData, productTeamsData) |
| 84 | ]) |
| 85 | |
| 86 | console.log('✅ Library data generation completed successfully!') |
| 87 | |
| 88 | } catch (error) { |
| 89 | console.error('❌ Error during library data generation:', error) |
| 90 | // Don't exit with error code - log warning and continue build |
| 91 | console.warn('⚠️ Continuing build with potentially incomplete data') |
| 92 | } |
| 93 | } |
| 94 |
no test coverage detected