Some checks failed
CI/CD Pipeline - Xpeditis PreProd / Deploy to PreProd Server (push) Blocked by required conditions
CI/CD Pipeline - Xpeditis PreProd / Run Smoke Tests (push) Blocked by required conditions
CI/CD Pipeline - Xpeditis PreProd / Backend - Build & Test (push) Failing after 5m59s
CI/CD Pipeline - Xpeditis PreProd / Backend - Docker Build & Push (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Frontend - Build & Test (push) Successful in 11m1s
CI/CD Pipeline - Xpeditis PreProd / Frontend - Docker Build & Push (push) Has been cancelled
- Replace all ../../domain/ imports with @domain/ across 67 files - Configure NestJS to use tsconfig.build.json with rootDir - Add tsc-alias to resolve path aliases after build - This fixes 'Cannot find module' TypeScript compilation errors Fixed files: - 30 files in application layer - 37 files in infrastructure layer
43 lines
1.1 KiB
JavaScript
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`);
|