#!/usr/bin/env tsx /** * Test script to verify embed components are properly structured */ import { existsSync } from 'fs'; import { join } from 'path'; const componentsDir = join(process.cwd(), 'src', 'components'); const embedsDir = join(componentsDir, 'Embeds'); const requiredFiles = [ 'YouTubeEmbed.astro', 'TwitterEmbed.astro', 'GenericEmbed.astro', 'Embeds/index.ts' ]; const optionalFiles = [ 'embedDemoPost.ts' ]; console.log('šŸ” Testing Embed Components...\n'); let allPassed = true; // Check component files exist requiredFiles.forEach(file => { const filePath = join(process.cwd(), 'src', 'components', file.replace('Embeds/', '')); const exists = existsSync(filePath); if (exists) { console.log(`āœ… ${file}`); } else { console.log(`āŒ ${file} - MISSING`); allPassed = false; } }); // Check optional files optionalFiles.forEach(file => { const filePath = join(process.cwd(), 'src', 'data', file); const exists = existsSync(filePath); if (exists) { console.log(`āœ… ${file} (optional)`); } else { console.log(`āš ļø ${file} - not found (optional)`); } }); // Check embeds directory if (existsSync(embedsDir)) { console.log(`āœ… Embeds directory exists`); } else { console.log(`āŒ Embeds directory - MISSING`); allPassed = false; } console.log('\nšŸ“‹ Component Summary:'); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); console.log('YouTubeEmbed - Build-time YouTube embeds with full styling control'); console.log('TwitterEmbed - Build-time Twitter embeds with oEmbed API'); console.log('GenericEmbed - Universal oEmbed support for any provider'); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); if (allPassed) { console.log('\nšŸŽ‰ All required components are in place!'); console.log('\nNext steps:'); console.log('1. Add embeds to your blog posts'); console.log('2. Customize styling with CSS variables'); console.log('3. Check EMBED_USAGE_GUIDE.md for examples'); process.exit(0); } else { console.log('\nāŒ Some components are missing. Please check the files above.'); process.exit(1); }