feat: enhance logging and linting functionality with detailed reports
All checks were successful
Lint / lint (pull_request) Successful in 16s

This commit is contained in:
2026-03-26 13:03:10 +01:00
parent b54a94c6d3
commit 79ea7dfc7e
8 changed files with 133 additions and 44 deletions

View File

@@ -1,7 +1,7 @@
import { execSync } from 'child_process';
import fs from 'fs-extra';
import path from 'path';
import { logStep, logSuccess, logError, logInfo } from '../utils/logger';
import { logStep, logSuccess, logError, logDetail } from '../utils/logger';
/** Invokes `openapi-generator-cli` to generate DTOs into a temporary directory. */
export function generateCode(swaggerFile: string, templatesDir: string): string {
@@ -22,7 +22,7 @@ export function generateCode(swaggerFile: string, templatesDir: string): string
-o "${tempDir}" \
--additional-properties=ngVersion=17.0.0,modelFileSuffix=.dto,modelNameSuffix=Dto`;
execSync(command, { stdio: 'inherit' });
execSync(command, { stdio: 'pipe' });
logSuccess('Code generated successfully');
return tempDir;
@@ -51,10 +51,9 @@ export function organizeFiles(tempDir: string, outputDir: string): void {
files.forEach((file) => {
const sourcePath = path.join(sourceDir, file);
const destPath = path.join(destDir, file);
fs.copySync(sourcePath, destPath);
filesMoved++;
logInfo(` ${file}${path.relative(process.cwd(), destPath)}`);
logDetail('dto', `${file}${path.relative(process.cwd(), destPath)}`);
});
}
@@ -119,7 +118,7 @@ export function addDtoImports(outputDir: string): void {
if (content !== originalContent) {
fs.writeFileSync(filePath, content);
filesProcessed++;
logInfo(` Procesado ${file}`);
logDetail('dto', `Post-processed ${file} (added ${imports.length} import(s))`);
}
});