xpeditis2.0/apps/backend/fix-domain-imports.js
David 08787c89c8
Some checks failed
Dev CI / Unit Tests (${{ matrix.app }}) (backend) (push) Blocked by required conditions
Dev CI / Unit Tests (${{ matrix.app }}) (frontend) (push) Blocked by required conditions
Dev CI / Notify Failure (push) Blocked by required conditions
Dev CI / Quality (${{ matrix.app }}) (backend) (push) Has been cancelled
Dev CI / Quality (${{ matrix.app }}) (frontend) (push) Has been cancelled
chore: sync full codebase from cicd branch
Aligns dev with the complete application codebase (cicd branch).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 12:56:16 +02:00

43 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Script to fix TypeScript imports in domain/services
* Replace relative paths with path aliases
*/
const fs = require('fs');
const path = require('path');
function fixImportsInFile(filePath) {
const content = fs.readFileSync(filePath, 'utf8');
let modified = content;
// Replace relative imports to ../ports/ with @domain/ports/
modified = modified.replace(/from ['"]\.\.\/ports\//g, "from '@domain/ports/");
modified = modified.replace(/import\s+(['"])\.\.\/ports\//g, "import $1@domain/ports/");
if (modified !== content) {
fs.writeFileSync(filePath, modified, 'utf8');
return true;
}
return false;
}
const servicesDir = path.join(__dirname, 'src/domain/services');
console.log('🔧 Fixing domain/services imports...\n');
const files = fs.readdirSync(servicesDir);
let count = 0;
for (const file of files) {
if (file.endsWith('.ts')) {
const filePath = path.join(servicesDir, file);
if (fixImportsInFile(filePath)) {
console.log(`✅ Fixed: ${filePath}`);
count++;
}
}
}
console.log(`\n✅ Fixed ${count} files in domain/services`);