utn-cli 2.0.4 → 2.0.6

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.
@@ -1,3 +1,4 @@
1
+ import { fileURLToPath } from 'url';
1
2
  import { limpiarDirectorioActual, copiarDirectorios, hacerPreguntaTrim, reemplazarContenidoEnArchivo, closeReadLine, mostrarVersion } from '../utils/index.js';
2
3
  import path from 'path';
3
4
  import fs from 'fs'; // Need fs here for renameSync
@@ -6,7 +7,7 @@ const __filename = fileURLToPath(import.meta.url);
6
7
  const __dirname = path.dirname(__filename);
7
8
 
8
9
  async function inicializarProyectoBackend() {
9
- const rutaDelModuloJson = path.join(__dirname, '../../package.json'); // Main CLI's package.json
10
+ const rutaDelModuloJson = path.join(__dirname, '../package.json'); // Main CLI's package.json
10
11
  const informacionDeRutaDelModuloJson = JSON.parse(fs.readFileSync(rutaDelModuloJson, 'utf-8'));
11
12
  console.log(`Versión de utn-backend (a través de utn-cli): ${informacionDeRutaDelModuloJson.version}.`);
12
13
 
@@ -122,7 +123,7 @@ export async function initBackend() {
122
123
  limpiarDirectorioActual(['commit-message.txt']);
123
124
  console.log('Inicializando el proyecto de backend...');
124
125
 
125
- const directoriodePlantillas = path.join(__dirname, '../../templates/backend');
126
+ const directoriodePlantillas = path.join(__dirname, '../templates/backend');
126
127
  const directorioDestino = process.cwd();
127
128
 
128
129
  if (!fs.existsSync(directoriodePlantillas)) {
@@ -147,7 +148,7 @@ export async function initBackend() {
147
148
  export async function updateBackend() {
148
149
  console.log('Actualizando el proyecto de backend...');
149
150
  const archivosAExcluir = ['InformacionDelModulo.json', 'rutas.js', 'Monitoreo.js', 'API.js'];
150
- const directoriodePlantillas = path.join(__dirname, '../../templates/backend');
151
+ const directoriodePlantillas = path.join(__dirname, '../templates/backend');
151
152
  const directorioDestino = process.cwd();
152
153
 
153
154
  if (!fs.existsSync(directoriodePlantillas)) {
@@ -157,7 +158,7 @@ export async function updateBackend() {
157
158
  }
158
159
 
159
160
  copiarDirectorios(directoriodePlantillas, directorioDestino, archivosAExcluir);
160
- mostrarVersion(path.join(__dirname, '../../package.json')); // Show main CLI version
161
+ mostrarVersion(path.join(__dirname, '../package.json')); // Show main CLI version
161
162
  console.log('Proyecto de backend actualizado exitosamente.');
162
163
  closeReadLine();
163
164
  }
@@ -277,6 +278,6 @@ export const routes: Routes = [`
277
278
  }
278
279
 
279
280
  export function showBackendVersion() {
280
- mostrarVersion(path.join(__dirname, '../../package.json'));
281
+ mostrarVersion(path.join(__dirname, '../package.json'));
281
282
  closeReadLine();
282
283
  }
package/commands/db.js CHANGED
@@ -11,7 +11,7 @@ export async function initDb() {
11
11
  limpiarDirectorioActual(['commit-message.txt']); // Assuming this is still relevant for DB
12
12
  console.log('Inicializando el proyecto de base de datos...');
13
13
 
14
- const directoriodePlantillas = path.join(__dirname, '../../templates/bd');
14
+ const directoriodePlantillas = path.join(__dirname, '../templates/bd');
15
15
  const directorioDestino = process.cwd();
16
16
 
17
17
  if (!fs.existsSync(directoriodePlantillas)) {
@@ -1,3 +1,4 @@
1
+ import { fileURLToPath } from 'url';
1
2
  import { limpiarDirectorioActual, copiarDirectorios, hacerPreguntaTrim, reemplazarContenidoEnArchivo, closeReadLine, mostrarVersion } from '../utils/index.js';
2
3
  import path from 'path';
3
4
  import fs from 'fs';
@@ -6,12 +7,7 @@ import { execSync } from 'child_process';
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = path.dirname(__filename);
8
9
 
9
- export async function initFrontend() {
10
- console.log('Limpiando directorio actual...');
11
- limpiarDirectorioActual(['commit-message.txt']);
12
- console.log('Inicializando el proyecto de frontend...');
13
-
14
- const directoriodePlantillas = path.join(__dirname, '../../templates/frontend');
10
+ const directoriodePlantillas = path.join(__dirname, '../templates/frontend');
15
11
  const directorioDestino = process.cwd();
16
12
 
17
13
  if (!fs.existsSync(directoriodePlantillas)) {
@@ -43,7 +39,7 @@ export async function initFrontend() {
43
39
  export async function updateFrontend() {
44
40
  console.log('Actualizando el proyecto de frontend...');
45
41
  const archivosAExcluir = ['app.routes.ts', 'contenedor-principal.component.css', 'contenedor-principal.component.html', 'contenedor-principal.component.ts', '.vscode', 'dist'];
46
- const directoriodePlantillas = path.join(__dirname, '../../templates/frontend');
42
+ const directoriodePlantillas = path.join(__dirname, '../templates/frontend');
47
43
  const directorioDestino = process.cwd();
48
44
 
49
45
  if (!fs.existsSync(directoriodePlantillas)) {
@@ -112,7 +108,7 @@ export async function cloneFrontendComponent() {
112
108
  const nombreClase = `GestionTabla${nombreCapitalizado}Component`;
113
109
  const nombreRuta = `gestion-tabla-${nombreLower}`;
114
110
 
115
- const rutaFuente = path.join(__dirname, '../../templates/frontend', 'src', 'app', 'Paginas', 'gestion-tabla-XYZ');
111
+ const rutaFuente = path.join(__dirname, '../templates/frontend', 'src', 'app', 'Paginas', 'gestion-tabla-XYZ');
116
112
  const rutaDestino = path.join(process.cwd(), 'src', 'app', 'Paginas', nombreRuta);
117
113
 
118
114
  if (!fs.existsSync(rutaFuente)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utn-cli",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Herramienta CLI unificada para la gestión de plantillas en SIGU.",
5
5
  "main": "index.js",
6
6
  "type": "module",