Backend Complete: Interface Refactoring & Service Container Enhancements
Repository Interface Optimization: - Created IBaseRepository.ts and IPaginatedRepository.ts - Refactored all 7 repository interfaces to extend base interfaces - Eliminated ~200 lines of redundant code (70% reduction) - Improved type safety and maintainability Dependency Injection Improvements: - Added EmailService and GameTokenService to DIContainer - Updated CreateUserCommandHandler constructor for DI - Updated RequestPasswordResetCommandHandler constructor for DI - Enhanced testability and service consistency Environment Configuration: - Created comprehensive .env.example with 40+ variables - Organized into 12 logical sections (Database, Security, Email, etc.) - Added security guidelines and best practices - Documented all backend environment requirements Documentation: - Added comprehensive codebase review - Created refactoring summary report - Added frontend implementation guide Impact: Improved code quality, reduced maintenance overhead, enhanced developer experience
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* Copy Assets Script for SerpentRace Backend
|
||||
* Copies non-TypeScript files to the dist directory
|
||||
*/
|
||||
|
||||
const srcDir = path.join(__dirname, '..', 'src');
|
||||
const distDir = path.join(__dirname, '..', 'dist');
|
||||
|
||||
// File extensions to copy
|
||||
const assetExtensions = ['.json', '.html', '.css', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico', '.woff', '.woff2', '.ttf', '.eot'];
|
||||
|
||||
// Directories to exclude from copying
|
||||
const excludeDirs = ['node_modules', '.git', 'tests', '__tests__'];
|
||||
|
||||
function copyAssets(srcPath, distPath) {
|
||||
if (!fs.existsSync(srcPath)) {
|
||||
console.log(`Source directory ${srcPath} does not exist`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(distPath)) {
|
||||
fs.mkdirSync(distPath, { recursive: true });
|
||||
}
|
||||
|
||||
const items = fs.readdirSync(srcPath);
|
||||
|
||||
items.forEach(item => {
|
||||
const srcItemPath = path.join(srcPath, item);
|
||||
const distItemPath = path.join(distPath, item);
|
||||
const stat = fs.statSync(srcItemPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
// Skip excluded directories
|
||||
if (excludeDirs.includes(item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Recursively copy subdirectories
|
||||
copyAssets(srcItemPath, distItemPath);
|
||||
} else {
|
||||
const ext = path.extname(item).toLowerCase();
|
||||
|
||||
// Copy asset files
|
||||
if (assetExtensions.includes(ext)) {
|
||||
console.log(`Copying asset: ${srcItemPath} -> ${distItemPath}`);
|
||||
fs.copyFileSync(srcItemPath, distItemPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('Copying assets from src to dist...');
|
||||
copyAssets(srcDir, distDir);
|
||||
console.log('Asset copying completed successfully!');
|
||||
} catch (error) {
|
||||
console.error('Error copying assets:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user