utn-cli 2.0.14 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/commit.js +40 -0
- package/commands/frontend.js +0 -36
- package/index.js +10 -5
- package/package.json +1 -1
- package/templates/backend/rutas/ConsentimientoInformado.js +1 -1
- package/templates/backend/servicios/Nucleo/ConsentimientoInformado.js +4 -2
- package/templates/frontend/src/app/Paginas/Nucleo/contenedor-componentes/contenedor-componentes.component.ts +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { hacerPreguntaTrim, closeReadLine } from '../utils/index.js';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
|
|
4
|
+
async function confirmarPaso(pregunta) {
|
|
5
|
+
const respuesta = await hacerPreguntaTrim(`${pregunta} (Sí/no) [Sí]: `);
|
|
6
|
+
const respuestaNormalizada = respuesta.trim().toLowerCase();
|
|
7
|
+
if (respuesta === '' || respuestaNormalizada === 'si' || respuestaNormalizada === 'sí' || respuestaNormalizada === 's') {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function runCommit() {
|
|
14
|
+
if (!await confirmarPaso('¿Ya realizó la revisión ortográfica del proyecto?')) return closeReadLine();
|
|
15
|
+
if (!await confirmarPaso('¿Todos los endpoints hacen uso de la estrategia de "Mensajes"?')) return closeReadLine();
|
|
16
|
+
if (!await confirmarPaso('¿Ya realizó el registro de los servicios?')) return closeReadLine();
|
|
17
|
+
if (!await confirmarPaso('¿Ya realizó la revisión con Gemini?')) return closeReadLine();
|
|
18
|
+
if (!await confirmarPaso('¿Todos los endpoints están en el archivo rest?')) return closeReadLine();
|
|
19
|
+
if (!await confirmarPaso('¿Ya realizó el build del frontend?')) return closeReadLine();
|
|
20
|
+
if (!await confirmarPaso('¿Ya realizó el update de los módulos de UTN?')) return closeReadLine();
|
|
21
|
+
if (!await confirmarPaso('¿Ya revisó la visualización en móvil?')) return closeReadLine();
|
|
22
|
+
if (!await confirmarPaso('¿Ya hizo el stage de todos los cambios?')) return closeReadLine();
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
console.log('Ejecutando git commit...');
|
|
26
|
+
execSync('git commit -m "* NEW: Respaldo de código"', { stdio: 'inherit' });
|
|
27
|
+
|
|
28
|
+
console.log('Ejecutando git pull --rebase...');
|
|
29
|
+
execSync('git pull --rebase', { stdio: 'inherit' });
|
|
30
|
+
|
|
31
|
+
console.log('Ejecutando git push...');
|
|
32
|
+
execSync('git push', { stdio: 'inherit' });
|
|
33
|
+
|
|
34
|
+
console.log('Proceso de commit finalizado con éxito.');
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('Ocurrió un error al ejecutar los comandos de git.', error.message);
|
|
37
|
+
} finally {
|
|
38
|
+
closeReadLine();
|
|
39
|
+
}
|
|
40
|
+
}
|
package/commands/frontend.js
CHANGED
|
@@ -58,43 +58,7 @@ export async function updateFrontend() {
|
|
|
58
58
|
closeReadLine();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
async function confirmarPaso(pregunta) {
|
|
62
|
-
const respuesta = await hacerPreguntaTrim(`${pregunta} (Sí/no) [Sí]: `);
|
|
63
|
-
const respuestaNormalizada = respuesta.trim().toLowerCase();
|
|
64
|
-
if (respuesta === '' || respuestaNormalizada === 'si' || respuestaNormalizada === 'sí' || respuestaNormalizada === 's') {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
61
|
|
|
70
|
-
export async function commitFrontend() {
|
|
71
|
-
// Original commit logic, wrapped
|
|
72
|
-
if (!await confirmarPaso('¿Ya realizó la revisión ortográfica del proyecto?')) return closeReadLine();
|
|
73
|
-
if (!await confirmarPaso('¿Ya realizó el registro de los servicios?')) return closeReadLine();
|
|
74
|
-
if (!await confirmarPaso('¿Ya realizó la revisión con Gemini?')) return closeReadLine();
|
|
75
|
-
if (!await confirmarPaso('¿Todos los endpoints están en el archivo rest?')) return closeReadLine();
|
|
76
|
-
if (!await confirmarPaso('¿Ya realizó el build del frontend?')) return closeReadLine();
|
|
77
|
-
if (!await confirmarPaso('¿Ya realizó el update de los módulos de UTN?')) return closeReadLine();
|
|
78
|
-
if (!await confirmarPaso('¿Ya revisó la visualización en móvil?')) return closeReadLine();
|
|
79
|
-
if (!await confirmarPaso('¿Ya hizo el stage de todos los cambios?')) return closeReadLine();
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
console.log('Ejecutando git commit...');
|
|
83
|
-
execSync('git commit -m "* NEW: Respaldo de código"', { stdio: 'inherit' });
|
|
84
|
-
|
|
85
|
-
console.log('Ejecutando git pull --rebase...');
|
|
86
|
-
execSync('git pull --rebase', { stdio: 'inherit' });
|
|
87
|
-
|
|
88
|
-
console.log('Ejecutando git push...');
|
|
89
|
-
execSync('git push', { stdio: 'inherit' });
|
|
90
|
-
|
|
91
|
-
console.log('Proceso de commit finalizado con éxito.');
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error('Ocurrió un error al ejecutar los comandos de git.', error.message);
|
|
94
|
-
} finally {
|
|
95
|
-
closeReadLine();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
62
|
|
|
99
63
|
export async function cloneFrontendComponent() {
|
|
100
64
|
const nombre = await hacerPreguntaTrim('Ingrese el nombre del nuevo componente (se reemplazará XYZ): ');
|
package/index.js
CHANGED
|
@@ -6,7 +6,8 @@ import path from 'path';
|
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
7
|
import { initDb, showDbVersion } from './commands/db.js';
|
|
8
8
|
import { initBackend, updateBackend, addServiceBackend, showBackendVersion } from './commands/backend.js';
|
|
9
|
-
import { initFrontend, updateFrontend, cloneFrontendComponent,
|
|
9
|
+
import { initFrontend, updateFrontend, cloneFrontendComponent, showFrontendVersion } from './commands/frontend.js';
|
|
10
|
+
import { runCommit } from './commands/commit.js';
|
|
10
11
|
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = path.dirname(__filename);
|
|
@@ -71,7 +72,6 @@ program.command('frontend')
|
|
|
71
72
|
.option('--init', 'Inicializa un nuevo proyecto de frontend.')
|
|
72
73
|
.option('--update', 'Actualiza un proyecto de frontend existente.')
|
|
73
74
|
.option('--clone-component', 'Clona un componente existente (e.g., gestion-tabla-XYZ).')
|
|
74
|
-
.option('--commit', 'Realiza un commit siguiendo el flujo de trabajo predefinido.')
|
|
75
75
|
.option('--version', 'Muestra la versión del módulo de frontend.')
|
|
76
76
|
.action(async (options) => {
|
|
77
77
|
if (options.init) {
|
|
@@ -80,16 +80,21 @@ program.command('frontend')
|
|
|
80
80
|
await updateFrontend();
|
|
81
81
|
} else if (options.cloneComponent) {
|
|
82
82
|
await cloneFrontendComponent();
|
|
83
|
-
} else if (options.commit) {
|
|
84
|
-
await commitFrontend();
|
|
85
83
|
} else if (options.version) {
|
|
86
84
|
showFrontendVersion();
|
|
87
85
|
} else {
|
|
88
|
-
console.log('Uso: utn frontend [--init | --update | --clone-component | --
|
|
86
|
+
console.log('Uso: utn frontend [--init | --update | --clone-component | --version]');
|
|
89
87
|
closeReadLine();
|
|
90
88
|
}
|
|
91
89
|
});
|
|
92
90
|
|
|
91
|
+
// Define 'commit' command
|
|
92
|
+
program.command('commit')
|
|
93
|
+
.description('Realiza un commit siguiendo el flujo de trabajo predefinido.')
|
|
94
|
+
.action(async () => {
|
|
95
|
+
await runCommit();
|
|
96
|
+
});
|
|
97
|
+
|
|
93
98
|
program.parse(process.argv);
|
|
94
99
|
|
|
95
100
|
if (!process.argv.slice(2).length) {
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ Router.get("/ConsentimientoInformado", async (solicitud, respuesta, next) => {
|
|
|
33
33
|
return respuesta.json({ body: await ConsentimientoInformado.ConsentimientoInformado(Datos), error: undefined });
|
|
34
34
|
} catch (error) {
|
|
35
35
|
const MensajeDeError = "No fue posible determiniar el consentimiento informado";
|
|
36
|
-
console.error(new ManejadorDeErrores(
|
|
36
|
+
console.error(new ManejadorDeErrores(MensajeDeError, ManejadorDeErrores.obtenerNumeroDeLinea(), true, `Dirección IP: ${solicitud.ip}`));
|
|
37
37
|
return respuesta.status(500).json({ body: undefined, error: MensajeDeError });
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -22,7 +22,8 @@ class ConsentimientoInformado {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async AceptarConsentimientoInformado(Datos) {
|
|
25
|
-
|
|
25
|
+
// Por agilidad no se usa el nombre formal de la tabla
|
|
26
|
+
return await ejecutarConsulta("INSERT INTO `AceptacionesDeConsentimientosInformados` VALUES \
|
|
26
27
|
(NULL, ?, ?, 'Aceptación de versión de módulo', UUID(), NOW(4), NOW(4), ?)"
|
|
27
28
|
, [await this.ConsentimientoInformadoId(), Datos.LastUser.split("@")[0], Datos.LastUser]);
|
|
28
29
|
}
|
|
@@ -39,7 +40,8 @@ class ConsentimientoInformado {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
async ConsentimientoInformado(Datos) {
|
|
42
|
-
|
|
43
|
+
// Por agilidad no se usa el nombre formal de la tabla
|
|
44
|
+
const Aceptaciones = await ejecutarConsulta("SELECT COUNT(*) AS `Total` FROM `AceptacionesDeConsentimientosInformados` \
|
|
43
45
|
WHERE `ConsentimientoInformadoId` = ? AND `Identificador` = ?"
|
|
44
46
|
, [await this.ConsentimientoInformadoId(), Datos.LastUser.split("@")[0]]);
|
|
45
47
|
const ValoresARetornar = {};
|
|
@@ -72,7 +72,7 @@ export class ContenedorComponentesComponent {
|
|
|
72
72
|
const ConsentimientoInformadoId = datos.body.Consentimiento[0].ConsentimientoInformadoId;
|
|
73
73
|
this.dialog.open(MensajeConfirmacionHTMLComponent, {
|
|
74
74
|
data: {
|
|
75
|
-
titulo:
|
|
75
|
+
titulo: datos.body.Consentimiento[0].Titulo,
|
|
76
76
|
mensaje: datos.body.Consentimiento[0].Texto,
|
|
77
77
|
textoCerrar: 'Cancelar',
|
|
78
78
|
textoAceptar: 'Aceptar',
|