feat: translate comments and logs to English for better accessibility

This commit is contained in:
didavila
2026-03-25 08:44:39 +01:00
parent ad9a957be4
commit 5f34aa2f89
16 changed files with 87 additions and 65 deletions

View File

@@ -8,6 +8,10 @@ export interface ApiKeyInfo {
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', '.angular', 'coverage', '.cache']);
/**
* Recursively searches for an `environment.ts` file starting from `dir`,
* up to `maxDepth` directory levels deep.
*/
export function findEnvironmentFile(dir: string, maxDepth = 8, currentDepth = 0): string | null {
if (currentDepth > maxDepth) return null;
try {

View File

@@ -2,7 +2,7 @@ import fs from 'fs-extra';
import path from 'path';
import { logSuccess, logInfo } from './logger';
/** Crea la estructura de directorios necesaria para Clean Architecture (idempotente). */
/** Creates the required Clean Architecture directory structure (idempotent). */
export function createDirectoryStructure(baseDir: string): void {
const dirs = [
path.join(baseDir, 'data/dtos'),
@@ -19,13 +19,13 @@ export function createDirectoryStructure(baseDir: string): void {
fs.ensureDirSync(dir);
});
logSuccess('Estructura de directorios creada');
logSuccess('Directory structure created');
}
/** Elimina un directorio temporal y todo su contenido. */
/** Removes a temporary directory and all its contents. */
export function cleanup(tempDir: string): void {
if (fs.existsSync(tempDir)) {
fs.removeSync(tempDir);
logInfo('Archivos temporales eliminados');
logInfo('Temporary files removed');
}
}

View File

@@ -10,32 +10,32 @@ const colors = {
type Color = keyof typeof colors;
/** Imprime un mensaje en consola con el color ANSI indicado. */
/** Prints a console message with the given ANSI colour. */
export function log(message: string, color: Color = 'reset'): void {
console.log(`${colors[color]}${message}${colors.reset}`);
}
/** Imprime un mensaje de éxito (verde). */
/** Prints a success message (green). */
export function logSuccess(message: string): void {
log(`${message}`, 'green');
}
/** Imprime un mensaje informativo (azul). */
/** Prints an informational message (blue). */
export function logInfo(message: string): void {
log(` ${message}`, 'blue');
}
/** Imprime un mensaje de advertencia (amarillo). */
/** Prints a warning message (yellow). */
export function logWarning(message: string): void {
log(`⚠️ ${message}`, 'yellow');
}
/** Imprime un mensaje de error (rojo). */
/** Prints an error message (red). */
export function logError(message: string): void {
log(`${message}`, 'red');
}
/** Imprime un encabezado de paso/etapa (cian). */
/** Prints a step/stage header (cyan). */
export function logStep(message: string): void {
log(`\n🚀 ${message}`, 'cyan');
}

View File

@@ -1,7 +1,7 @@
import { execSync } from 'child_process';
import { logStep, logSuccess, logError } from './logger';
/** Verifica si `openapi-generator-cli` está disponible en el PATH. */
/** Checks whether `openapi-generator-cli` is available on the PATH. */
export function checkOpenApiGenerator(): boolean {
try {
execSync('openapi-generator-cli version', { stdio: 'ignore' });
@@ -11,14 +11,14 @@ export function checkOpenApiGenerator(): boolean {
}
}
/** Instala `@openapitools/openapi-generator-cli` de forma global vía npm. */
/** Installs `@openapitools/openapi-generator-cli` globally via npm. */
export function installOpenApiGenerator(): void {
logStep('Instalando @openapitools/openapi-generator-cli...');
logStep('Installing @openapitools/openapi-generator-cli...');
try {
execSync('npm install -g @openapitools/openapi-generator-cli', { stdio: 'inherit' });
logSuccess('OpenAPI Generator CLI instalado correctamente');
logSuccess('OpenAPI Generator CLI installed successfully');
} catch (_error) {
logError('Error al instalar OpenAPI Generator CLI');
logError('Error installing OpenAPI Generator CLI');
process.exit(1);
}
}

View File

@@ -1,4 +1,4 @@
/** Traduce un tipo primitivo de OpenAPI/Swagger al equivalente TypeScript. */
/** Translates a primitive OpenAPI/Swagger type to its TypeScript equivalent. */
export function mapSwaggerTypeToTs(type?: string): string {
if (!type) return 'unknown';