UNPKG

@tamyla/ui-components-react

Version:

React-based UI component library with Factory Bridge pattern - integrates seamlessly with @tamyla/ui-components. Enhanced AI agent discoverability with structured component registry, comprehensive Storybook (8 components), and detailed guides.

198 lines (166 loc) • 6.14 kB
#!/usr/bin/env node /** * Repository Status and Information Script for UI Components React * Shows complete status of the React components repository */ import fs from 'fs'; import path from 'path'; import { execSync } from 'child_process'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); class ReactRepositoryStatus { constructor() { this.projectRoot = path.resolve(__dirname, '..'); } exec(command) { try { return execSync(command, { cwd: this.projectRoot, encoding: 'utf8' }); } catch (error) { throw error; } } async checkStatus() { console.log('\nšŸ“Š UI Components React Repository Status'); console.log('=' .repeat(60)); await this.checkGitStatus(); await this.checkFileStructure(); await this.checkBuildOutputs(); await this.checkReactComponents(); await this.showDeploymentOptions(); } async checkGitStatus() { console.log('\nšŸ“ Git Repository Status:'); try { // Current directory const currentDir = process.cwd(); console.log(` āœ“ Location: ${currentDir}`); // Git status const status = this.exec('git status --porcelain').toString().trim(); if (status) { console.log(` ⚠ Uncommitted changes: ${status.split('\n').length} files`); } else { console.log(' āœ“ All changes committed'); } // Branch info const branch = this.exec('git branch --show-current').toString().trim(); console.log(` āœ“ Current branch: ${branch}`); // Commit count const commits = this.exec('git rev-list --count HEAD').toString().trim(); console.log(` āœ“ Total commits: ${commits}`); // Remote status try { const remotes = this.exec('git remote -v').toString().trim(); if (remotes) { console.log(' āœ“ Remote repositories:'); remotes.split('\n').forEach(remote => { console.log(` ${remote}`); }); } else { console.log(' āŒ No remote repositories configured'); console.log(' Run: npm run deploy (to set up GitHub)'); } } catch (error) { console.log(' āŒ No remote repositories'); } } catch (error) { console.log(' āŒ Not a git repository'); } } async checkFileStructure() { console.log('\nšŸ“‚ Project Structure:'); const requiredDirs = [ 'src', 'dist', 'scripts', 'bridges' ]; for (const dir of requiredDirs) { const dirPath = path.join(this.projectRoot, dir); if (fs.existsSync(dirPath)) { const items = fs.readdirSync(dirPath); console.log(` āœ“ ${dir}/ (${items.length} items)`); } else { console.log(` āŒ ${dir}/ - missing`); } } // Check important files const importantFiles = [ 'package.json', '.gitignore', 'README.md', 'rollup.config.js', 'tsconfig.json' ]; importantFiles.forEach(file => { const filePath = path.join(this.projectRoot, file); if (fs.existsSync(filePath)) { console.log(` āœ“ ${file}`); } else { console.log(` āŒ ${file} - missing`); } }); } async checkBuildOutputs() { console.log('\nšŸ—ļø Build Outputs:'); const distPath = path.join(this.projectRoot, 'dist'); if (fs.existsSync(distPath)) { const files = fs.readdirSync(distPath); console.log(` āœ“ Distribution files: ${files.length}`); files.forEach(file => { const filePath = path.join(distPath, file); const stats = fs.statSync(filePath); const sizeKB = (stats.size / 1024).toFixed(2); console.log(` ${file}: ${sizeKB}KB`); }); } else { console.log(' āŒ No build outputs found'); console.log(' Run: npm run build'); } } async checkReactComponents() { console.log('\nāš›ļø React Components:'); const srcPath = path.join(this.projectRoot, 'src'); const componentTypes = ['atoms', 'molecules', 'organisms', 'applications']; let totalComponents = 0; componentTypes.forEach(type => { const typePath = path.join(srcPath, 'components', type); if (fs.existsSync(typePath)) { const components = fs.readdirSync(typePath).filter(item => item.endsWith('.tsx') || item.endsWith('.ts') ); console.log(` āœ“ ${type}: ${components.length} components`); totalComponents += components.length; } else { console.log(` āŒ ${type}: directory not found`); } }); console.log(` šŸ“Š Total React components: ${totalComponents}`); // Check bridge files const bridgesPath = path.join(this.projectRoot, 'bridges'); if (fs.existsSync(bridgesPath)) { const bridges = fs.readdirSync(bridgesPath).filter(item => item.endsWith('.tsx') || item.endsWith('.ts') ); console.log(` šŸŒ‰ Bridge files: ${bridges.length}`); } } async showDeploymentOptions() { console.log('\nšŸš€ Deployment Options:'); const packagePath = path.join(this.projectRoot, 'package.json'); const packageData = JSON.parse(fs.readFileSync(packagePath, 'utf8')); console.log(' Available scripts:'); Object.keys(packageData.scripts || {}).forEach(script => { if (script.includes('deploy') || script.includes('publish') || script.includes('certify')) { console.log(` npm run ${script}`); } }); console.log('\n šŸ“¦ Package Information:'); console.log(` Name: ${packageData.name}`); console.log(` Version: ${packageData.version}`); console.log(` Private: ${packageData.private || false}`); } } // Run status check const status = new ReactRepositoryStatus(); status.checkStatus().catch(error => { console.error('āŒ Status check failed:', error.message); process.exit(1); });