feat: translate comments and logs to English for better accessibility
This commit is contained in:
@@ -3,9 +3,9 @@ import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { logStep, logSuccess, logError, logInfo } from '../utils/logger';
|
||||
|
||||
/** Invoca `openapi-generator-cli` para generar DTOs en un directorio temporal. */
|
||||
/** Invokes `openapi-generator-cli` to generate DTOs into a temporary directory. */
|
||||
export function generateCode(swaggerFile: string, templatesDir: string): string {
|
||||
logStep('Generando código desde OpenAPI...');
|
||||
logStep('Generating code from OpenAPI spec...');
|
||||
|
||||
const tempDir = path.join(process.cwd(), '.temp-generated');
|
||||
|
||||
@@ -23,11 +23,11 @@ export function generateCode(swaggerFile: string, templatesDir: string): string
|
||||
--additional-properties=ngVersion=17.0.0,modelFileSuffix=.dto,modelNameSuffix=Dto`;
|
||||
|
||||
execSync(command, { stdio: 'inherit' });
|
||||
logSuccess('Código generado correctamente');
|
||||
logSuccess('Code generated successfully');
|
||||
|
||||
return tempDir;
|
||||
} catch (_error) {
|
||||
logError('Error al generar código');
|
||||
logError('Error generating code');
|
||||
if (fs.existsSync(tempDir)) {
|
||||
fs.removeSync(tempDir);
|
||||
}
|
||||
@@ -35,9 +35,9 @@ export function generateCode(swaggerFile: string, templatesDir: string): string
|
||||
}
|
||||
}
|
||||
|
||||
/** Copia los DTOs generados desde el directorio temporal al directorio de salida. */
|
||||
/** Copies the generated DTOs from the temporary directory to the output directory. */
|
||||
export function organizeFiles(tempDir: string, outputDir: string): void {
|
||||
logStep('Organizando archivos DTO generados...');
|
||||
logStep('Organising generated DTO files...');
|
||||
|
||||
const sourceDir = path.join(tempDir, 'model');
|
||||
const destDir = path.join(outputDir, 'data/dtos');
|
||||
@@ -58,12 +58,12 @@ export function organizeFiles(tempDir: string, outputDir: string): void {
|
||||
});
|
||||
}
|
||||
|
||||
logSuccess(`${filesMoved} DTOs movidos correctamente`);
|
||||
logSuccess(`${filesMoved} DTOs moved successfully`);
|
||||
}
|
||||
|
||||
/** Post-procesa los DTOs generados añadiendo imports y normalizando Array<T> → T[]. */
|
||||
/** Post-processes the generated DTOs: adds cross-DTO imports and normalises Array<T> → T[]. */
|
||||
export function addDtoImports(outputDir: string): void {
|
||||
logStep('Añadiendo imports a los DTOs generados...');
|
||||
logStep('Post-processing generated DTOs...');
|
||||
|
||||
const dtosDir = path.join(outputDir, 'data/dtos');
|
||||
|
||||
@@ -123,5 +123,5 @@ export function addDtoImports(outputDir: string): void {
|
||||
}
|
||||
});
|
||||
|
||||
logSuccess(`Imports añadidos a ${filesProcessed} DTOs`);
|
||||
logSuccess(`${filesProcessed} DTOs post-processed`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user