chore: initialize project repository with core extension files
- Add .gitignore to exclude node_modules, dist, logs, and system files - Add comprehensive project documentation including README, deployment guide, and development setup - Add .kiro project specifications for amazon-product-bar-extension, appwrite-cloud-storage, appwrite-userid-repair, blacklist-feature, and enhanced-item-management - Add .kiro steering documents for product, structure, styling, and tech guidelines - Add VSCode settings configuration for consistent development environment - Add manifest.json and babel/vite configuration for extension build setup - Add complete source code implementation including AppWrite integration, storage managers, UI components, and services - Add comprehensive test suite with Jest configuration and 30+ test files covering all major modules - Add test HTML files for integration testing and validation - Add coverage reports and build validation scripts - Add AppWrite setup and repair documentation for database schema management - Add migration guides and responsive accessibility implementation documentation - Establish foundation for Amazon product bar extension with full feature set including blacklist management, enhanced item workflows, and real-time synchronization
This commit is contained in:
188
validate-build.js
Normal file
188
validate-build.js
Normal file
@@ -0,0 +1,188 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Build Validation Script for Amazon Product Bar Extension
|
||||
* Tests the complete build integration of Enhanced Item Management features
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
console.log('🚀 Amazon Product Bar Extension - Build Validation');
|
||||
console.log('=' .repeat(60));
|
||||
|
||||
// Test 1: Check if build files exist
|
||||
console.log('\n📦 Testing Build Files...');
|
||||
const buildFiles = [
|
||||
'dist/content.js',
|
||||
'dist/style.css'
|
||||
];
|
||||
|
||||
let buildFilesValid = true;
|
||||
buildFiles.forEach(file => {
|
||||
if (fs.existsSync(file)) {
|
||||
const stats = fs.statSync(file);
|
||||
const sizeKB = (stats.size / 1024).toFixed(2);
|
||||
console.log(`✅ ${file} - ${sizeKB} KB`);
|
||||
} else {
|
||||
console.log(`❌ ${file} - Missing`);
|
||||
buildFilesValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Test 2: Check JavaScript content for Enhanced Item Management components
|
||||
console.log('\n🔧 Testing Enhanced Item Management Components...');
|
||||
const jsContent = fs.readFileSync('dist/content.js', 'utf8');
|
||||
|
||||
const requiredComponents = [
|
||||
'EnhancedItemsPanelManager',
|
||||
'EnhancedStorageManager',
|
||||
'ProductExtractor',
|
||||
'MistralAIService',
|
||||
'TitleSelectionManager',
|
||||
'SettingsPanelManager',
|
||||
'EnhancedAddItemWorkflow',
|
||||
'ErrorHandler',
|
||||
'InteractivityEnhancer',
|
||||
'AccessibilityTester'
|
||||
];
|
||||
|
||||
let componentsValid = true;
|
||||
requiredComponents.forEach(component => {
|
||||
if (jsContent.includes(component)) {
|
||||
console.log(`✅ ${component} - Included`);
|
||||
} else {
|
||||
console.log(`❌ ${component} - Missing`);
|
||||
componentsValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Test 3: Check CSS content for Enhanced Item Management styles
|
||||
console.log('\n🎨 Testing Enhanced Item Management Styles...');
|
||||
const cssContent = fs.readFileSync('dist/style.css', 'utf8');
|
||||
|
||||
const requiredStyles = [
|
||||
'amazon-ext-enhanced-items-content',
|
||||
'enhanced-items-header',
|
||||
'Responsive Design and Accessibility',
|
||||
'Interactivity Enhancements',
|
||||
'Enhanced Accessibility Features'
|
||||
];
|
||||
|
||||
let stylesValid = true;
|
||||
requiredStyles.forEach(style => {
|
||||
if (cssContent.includes(style)) {
|
||||
console.log(`✅ ${style} - Included`);
|
||||
} else {
|
||||
console.log(`❌ ${style} - Missing`);
|
||||
stylesValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Test 4: Check for proper imports and initialization
|
||||
console.log('\n🔗 Testing Component Integration...');
|
||||
const integrationTests = [
|
||||
{ name: 'CSS Bundle', test: cssContent.includes('Enhanced Item Management') },
|
||||
{ name: 'Responsive CSS', test: cssContent.includes('Responsive Design and Accessibility') },
|
||||
{ name: 'Interactivity CSS', test: cssContent.includes('Interactivity Enhancements') },
|
||||
{ name: 'Global Variables', test: jsContent.includes('window.amazonExtEnhancedStorage') },
|
||||
{ name: 'Event Bus Setup', test: jsContent.includes('enhanced:item:saved') },
|
||||
{ name: 'Component Initialization', test: jsContent.includes('initializeEnhancedItemManagement') }
|
||||
];
|
||||
|
||||
let integrationValid = true;
|
||||
integrationTests.forEach(test => {
|
||||
if (test.test) {
|
||||
console.log(`✅ ${test.name} - Configured`);
|
||||
} else {
|
||||
console.log(`❌ ${test.name} - Missing`);
|
||||
integrationValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Test 5: Check manifest.json for proper extension configuration
|
||||
console.log('\n📋 Testing Extension Manifest...');
|
||||
let manifestValid = true;
|
||||
try {
|
||||
const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf8'));
|
||||
|
||||
const manifestTests = [
|
||||
{ name: 'Content Script', test: manifest.content_scripts && manifest.content_scripts.length > 0 },
|
||||
{ name: 'Permissions', test: manifest.permissions && manifest.permissions.includes('storage') },
|
||||
{ name: 'Host Permissions', test: manifest.host_permissions && manifest.host_permissions.some(p => p.includes('amazon')) }
|
||||
];
|
||||
|
||||
manifestTests.forEach(test => {
|
||||
if (test.test) {
|
||||
console.log(`✅ ${test.name} - Configured`);
|
||||
} else {
|
||||
console.log(`❌ ${test.name} - Missing`);
|
||||
manifestValid = false;
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(`❌ Manifest parsing failed: ${error.message}`);
|
||||
manifestValid = false;
|
||||
}
|
||||
|
||||
// Test 6: Check package.json for proper dependencies
|
||||
console.log('\n📦 Testing Dependencies...');
|
||||
let dependenciesValid = true;
|
||||
try {
|
||||
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||
|
||||
const requiredDeps = ['react', 'react-dom'];
|
||||
const requiredDevDeps = ['vite', '@vitejs/plugin-react'];
|
||||
|
||||
requiredDeps.forEach(dep => {
|
||||
if (packageJson.dependencies && packageJson.dependencies[dep]) {
|
||||
console.log(`✅ ${dep} - ${packageJson.dependencies[dep]}`);
|
||||
} else {
|
||||
console.log(`❌ ${dep} - Missing`);
|
||||
dependenciesValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
requiredDevDeps.forEach(dep => {
|
||||
if (packageJson.devDependencies && packageJson.devDependencies[dep]) {
|
||||
console.log(`✅ ${dep} - ${packageJson.devDependencies[dep]}`);
|
||||
} else {
|
||||
console.log(`❌ ${dep} - Missing`);
|
||||
dependenciesValid = false;
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(`❌ Package.json parsing failed: ${error.message}`);
|
||||
dependenciesValid = false;
|
||||
}
|
||||
|
||||
// Final Summary
|
||||
console.log('\n' + '=' .repeat(60));
|
||||
console.log('📊 VALIDATION SUMMARY');
|
||||
console.log('=' .repeat(60));
|
||||
|
||||
const allTestsValid = buildFilesValid && componentsValid && stylesValid && integrationValid && manifestValid && dependenciesValid;
|
||||
|
||||
console.log(`Build Files: ${buildFilesValid ? '✅ PASS' : '❌ FAIL'}`);
|
||||
console.log(`Components: ${componentsValid ? '✅ PASS' : '❌ FAIL'}`);
|
||||
console.log(`Styles: ${stylesValid ? '✅ PASS' : '❌ FAIL'}`);
|
||||
console.log(`Integration: ${integrationValid ? '✅ PASS' : '❌ FAIL'}`);
|
||||
console.log(`Manifest: ${manifestValid ? '✅ PASS' : '❌ FAIL'}`);
|
||||
console.log(`Dependencies: ${dependenciesValid ? '✅ PASS' : '❌ FAIL'}`);
|
||||
|
||||
console.log('\n' + '=' .repeat(60));
|
||||
if (allTestsValid) {
|
||||
console.log('🎉 ALL TESTS PASSED - Build is ready for deployment!');
|
||||
console.log('\n📋 Next Steps:');
|
||||
console.log('1. Load the extension in Chrome Developer Mode');
|
||||
console.log('2. Navigate to Amazon search results');
|
||||
console.log('3. Test Enhanced Item Management features');
|
||||
console.log('4. Verify responsive design and accessibility');
|
||||
} else {
|
||||
console.log('⚠️ SOME TESTS FAILED - Please review the issues above');
|
||||
}
|
||||
|
||||
console.log('\n🔗 Test the build: open test-complete-build.html in your browser');
|
||||
console.log('=' .repeat(60));
|
||||
|
||||
process.exit(allTestsValid ? 0 : 1);
|
||||
Reference in New Issue
Block a user