| import fs from 'fs'; | |
| import path from 'path'; | |
| import { fileURLToPath } from 'url'; | |
| // Define __dirname for ES Module scope | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); | |
| const dirs = [ | |
| 'src/store', | |
| 'src/components', | |
| 'public', | |
| 'dist' | |
| ]; | |
| console.log('--- Abyssinia v15 Repository Initialization (ESM) ---'); | |
| dirs.forEach(dir => { | |
| const fullPath = path.join(__dirname, '..', dir); | |
| if (!fs.existsSync(fullPath)) { | |
| fs.mkdirSync(fullPath, { recursive: true }); | |
| console.log(`Verified: ${dir}`); | |
| } | |
| }); | |
| // Logic to prevent nested src/components/src errors | |
| const nestedPath = path.join(__dirname, '..', 'src/components/src'); | |
| if (fs.existsSync(nestedPath)) { | |
| console.log('Warning: Detected nested src directory. Correcting pathing...'); | |
| fs.rmSync(nestedPath, { recursive: true, force: true }); | |
| } | |
| console.log('System: Architecture validated for build.'); |