Files
openapi-clean-arch-gen/src/utils/logger.ts
didavila bd67e6c6d1 feat: Implement Clean Architecture code generation with Mustache templates
- Added `clean-arch.generator.ts` for generating models, mappers, repositories, use cases, and providers based on OpenAPI specs.
- Introduced `dto.generator.ts` to invoke `openapi-generator-cli` for generating DTOs and organizing them.
- Created `report.generator.ts` to generate a JSON report of the generation process.
- Implemented `analyzer.ts` for parsing OpenAPI/Swagger files and extracting relevant data.
- Defined new types in `cli.types.ts`, `generation.types.ts`, `openapi.types.ts`, and `swagger.types.ts` for better type safety.
- Added utility functions in `filesystem.ts` for creating directory structures and cleaning up temporary files.
- Developed logging utilities in `logger.ts` for better console output.
- Included OpenAPI generator checks and installation in `openapi-generator.ts`.
- Added type mapping utility in `type-mapper.ts` for converting OpenAPI types to TypeScript types.
- Updated `package.json` scripts to lint all TypeScript files.
- Modified `tsconfig.json` to include all TypeScript files in the project.
2026-03-24 11:16:45 +01:00

44 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const colors = {
reset: '\x1b[0m',
bright: '\x1b[1m',
green: '\x1b[32m',
blue: '\x1b[34m',
yellow: '\x1b[33m',
red: '\x1b[31m',
cyan: '\x1b[36m'
} as const;
type Color = keyof typeof colors;
/** Imprime un mensaje en consola con el color ANSI indicado. */
export function log(message: string, color: Color = 'reset'): void {
console.log(`${colors[color]}${message}${colors.reset}`);
}
/** Imprime un mensaje de éxito (verde). */
export function logSuccess(message: string): void {
log(`${message}`, 'green');
}
/** Imprime un mensaje informativo (azul). */
export function logInfo(message: string): void {
log(` ${message}`, 'blue');
}
/** Imprime un mensaje de advertencia (amarillo). */
export function logWarning(message: string): void {
log(`⚠️ ${message}`, 'yellow');
}
/** Imprime un mensaje de error (rojo). */
export function logError(message: string): void {
log(`${message}`, 'red');
}
/** Imprime un encabezado de paso/etapa (cian). */
export function logStep(message: string): void {
log(`\n🚀 ${message}`, 'cyan');
}
export { colors };