feat: add TypeScript-based OpenAPI Clean Architecture generator
- Introduced a new TypeScript file (generate.ts) for generating Angular code with Clean Architecture from OpenAPI/Swagger specifications. - Implemented a CLI using Commander.js for user input and options. - Added functions for analyzing Swagger files, generating code, organizing files, and creating a report. - Integrated Mustache templates for generating models, repositories, use cases, and mappers. - Created a build process with TypeScript and updated package.json to include build scripts and dependencies. - Added TypeScript configuration (tsconfig.json) for compiling the TypeScript code. - Updated the main entry point in package.json to point to the compiled JavaScript file in the dist directory.
This commit is contained in:
23
README.md
23
README.md
@@ -23,13 +23,20 @@ npm run setup
|
||||
### Comando básico
|
||||
|
||||
```bash
|
||||
node generate.js -i swagger.yaml
|
||||
# Versión compilada
|
||||
npm run generate -- -i swagger.yaml
|
||||
|
||||
# Versión desarrollo (ts-node)
|
||||
npm run generate:dev -- -i swagger.yaml
|
||||
|
||||
# Versión link global (si hiciste npm link)
|
||||
generate-clean-arch -i swagger.yaml
|
||||
```
|
||||
|
||||
### Opciones disponibles
|
||||
|
||||
```bash
|
||||
node generate.js [opciones]
|
||||
npm run generate -- [opciones]
|
||||
|
||||
Opciones:
|
||||
-V, --version Mostrar versión
|
||||
@@ -45,16 +52,16 @@ Opciones:
|
||||
|
||||
```bash
|
||||
# Generar desde swagger.yaml en src/app
|
||||
node generate.js -i swagger.yaml -o ./src/app
|
||||
npm run generate -- -i swagger.yaml -o ./src/app
|
||||
|
||||
# Usar templates personalizados
|
||||
node generate.js -i api.yaml -t ./mis-templates
|
||||
npm run generate -- -i api.yaml -t ./mis-templates
|
||||
|
||||
# Modo de prueba (no genera archivos)
|
||||
node generate.js -i swagger.yaml --dry-run
|
||||
npm run generate -- -i swagger.yaml --dry-run
|
||||
|
||||
# Especificar todos los parámetros
|
||||
node generate.js -i ./docs/api.yaml -o ./frontend/src/app -t ./custom-templates
|
||||
npm run generate -- -i ./docs/api.yaml -o ./frontend/src/app -t ./custom-templates
|
||||
```
|
||||
|
||||
## 📁 Estructura Generada
|
||||
@@ -183,7 +190,7 @@ cp ../docs/api.yaml ./swagger.yaml
|
||||
### 3. Generar código
|
||||
|
||||
```bash
|
||||
node generate.js
|
||||
npm run generate -- -i swagger.yaml
|
||||
```
|
||||
|
||||
### 4. Registrar providers en Angular
|
||||
@@ -246,7 +253,7 @@ npm run setup
|
||||
|
||||
Asegúrate de especificar la ruta correcta:
|
||||
```bash
|
||||
node generate.js -i ./ruta/a/tu/swagger.yaml
|
||||
npm run generate -- -i ./ruta/a/tu/swagger.yaml
|
||||
```
|
||||
|
||||
### Los imports no se resuelven (@/ no funciona)
|
||||
|
||||
Reference in New Issue
Block a user