@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.
120 lines (98 loc) ⢠4.31 kB
JavaScript
/**
* Basic Validation Script for UI Components React
* Mirrors the validation system from ui-components
*/
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = path.join(__dirname, '..');
console.log('š UI Components React Basic Validation');
console.log('==================================================');
console.log(`š Working directory: ${projectRoot}`);
// Check project structure
console.log('\nš Checking project structure...');
const expectedDirs = {
'src/components/atoms': 'Atomic components',
'src/components/molecules': 'Molecule components',
'src/components/organisms': 'Organism components',
'src/components/applications': 'Application components',
'src/core': 'Core utilities',
'src/store': 'Redux store setup',
'scripts': 'Build and validation scripts'
};
let foundDirs = 0;
const componentCounts = {};
for (const [dir, description] of Object.entries(expectedDirs)) {
const fullPath = path.join(projectRoot, dir);
if (fs.existsSync(fullPath)) {
const items = fs.readdirSync(fullPath);
const componentCount = items.filter(item => {
const itemPath = path.join(fullPath, item);
return fs.statSync(itemPath).isFile() &&
(item.endsWith('.tsx') || item.endsWith('.ts')) &&
!item.includes('.test.') &&
!item.includes('.spec.');
}).length;
componentCounts[dir] = componentCount;
console.log(` ā ${dir}/ (${componentCount} components)`);
foundDirs++;
} else {
console.log(` ā ${dir}/ - Missing`);
}
}
// Check package configuration
console.log('\nš Checking package configuration...');
const packageJsonPath = path.join(projectRoot, 'package.json');
if (fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
console.log(` ā package.json - ${packageJson.name}@${packageJson.version}`);
console.log(` ā Type: ${packageJson.type || 'CommonJS (default)'}`);
const scripts = Object.keys(packageJson.scripts || {});
console.log(` ā Scripts: ${scripts.join(', ')}`);
// Check for required dependencies
const requiredDeps = ['react', 'react-dom', '@reduxjs/toolkit', 'styled-components'];
const missingDeps = requiredDeps.filter(dep =>
!packageJson.dependencies?.[dep] && !packageJson.devDependencies?.[dep]
);
if (missingDeps.length === 0) {
console.log(' ā Required dependencies present');
} else {
console.log(` ā Missing dependencies: ${missingDeps.join(', ')}`);
}
} else {
console.log(' ā package.json - Missing');
}
// Check TypeScript configuration
const tsconfigPath = path.join(projectRoot, 'tsconfig.json');
if (fs.existsSync(tsconfigPath)) {
console.log(' ā TypeScript configuration found');
} else {
console.log(' ā tsconfig.json - Missing');
}
// Check build configuration
const rollupConfigPath = path.join(projectRoot, 'rollup.config.js');
if (fs.existsSync(rollupConfigPath)) {
console.log(' ā Rollup build configuration found');
} else {
console.log(' ā rollup.config.js - Missing');
}
console.log('\nš Summary');
console.log('==============================');
console.log(`Found directories: ${foundDirs}/${Object.keys(expectedDirs).length}`);
const totalComponents = Object.values(componentCounts).reduce((sum, count) => sum + count, 0);
console.log(`Total components: ${totalComponents}`);
if (foundDirs >= 5 && totalComponents >= 3) {
console.log('\nā
Basic structure validation PASSED!');
console.log('Your React UI components structure is ready for development.');
} else {
console.log('\nā Basic structure validation FAILED!');
console.log('Please ensure you have the required directory structure and components.');
}
console.log('\nš Next steps:');
console.log(' ⢠Run: npm run build (to test build system)');
console.log(' ⢠Run: npm run dev (to start development server)');
console.log(' ⢠Run: npm run certify (for detailed validation)');
console.log('\nValidation completed successfully! šÆ');