slicejs-cli 2.1.8 → 2.1.10

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.
@@ -19,7 +19,8 @@ const COMPONENTS_REGISTRY_URL = 'https://raw.githubusercontent.com/VKneider/slic
19
19
  */
20
20
  const loadConfig = () => {
21
21
  try {
22
- const configPath = path.join(__dirname, '../../../src/sliceConfig.json');
22
+ // CORREGIDO: Usar 4 niveles como en listComponents para compatibilidad con node_modules
23
+ const configPath = path.join(__dirname, '../../../../src/sliceConfig.json');
23
24
  if (!fs.existsSync(configPath)) {
24
25
  throw new Error('sliceConfig.json not found in src folder');
25
26
  }
@@ -67,8 +68,8 @@ class ComponentRegistry {
67
68
 
68
69
  async getLocalComponents() {
69
70
  try {
70
- // ✅ CAMBIO: Usar ruta dinámica basada en sliceConfig.json
71
- const componentsPath = path.join(__dirname, '../../../src/Components/components.js');
71
+ // ✅ CORREGIDO: Usar 4 niveles como en listComponents para compatibilidad con node_modules
72
+ const componentsPath = path.join(__dirname, '../../../../src/Components/components.js');
72
73
 
73
74
  if (!await fs.pathExists(componentsPath)) {
74
75
  return {};
@@ -98,11 +99,11 @@ class ComponentRegistry {
98
99
  // Check if local component directory exists using dynamic paths
99
100
  const categoryPath = validations.getCategoryPath(category);
100
101
 
101
- // ✅ CAMBIO: Determinar si estamos en modo producción
102
+ // ✅ CORREGIDO: Usar 4 niveles para compatibilidad con node_modules
102
103
  const isProduction = this.config?.production?.enabled === true;
103
104
  const folderSuffix = isProduction ? 'dist' : 'src';
104
105
 
105
- const componentPath = path.join(__dirname, `../../../${folderSuffix}`, categoryPath, name);
106
+ const componentPath = path.join(__dirname, `../../../../${folderSuffix}`, categoryPath, name);
106
107
 
107
108
  if (fs.pathExistsSync(componentPath)) {
108
109
  updatableComponents.push({
@@ -207,8 +208,8 @@ class ComponentRegistry {
207
208
  }
208
209
 
209
210
  async updateLocalRegistry(componentName, category) {
210
- // ✅ CAMBIO PRINCIPAL: Usar ruta dinámica basada en sliceConfig.json
211
- const componentsPath = path.join(__dirname, '../../../src/Components/components.js');
211
+ // ✅ CORREGIDO: Usar 4 niveles para compatibilidad con node_modules
212
+ const componentsPath = path.join(__dirname, '../../../../src/Components/components.js');
212
213
 
213
214
  try {
214
215
  let content = await fs.readFile(componentsPath, 'utf8');
@@ -261,11 +262,11 @@ class ComponentRegistry {
261
262
 
262
263
  const categoryPath = validations.getCategoryPath(category);
263
264
 
264
- // ✅ CAMBIO: Usar configuración dinámica para determinar la ruta base
265
+ // ✅ CORREGIDO: Usar 4 niveles para compatibilidad con node_modules
265
266
  const isProduction = this.config?.production?.enabled === true;
266
267
  const folderSuffix = isProduction ? 'dist' : 'src';
267
268
 
268
- const targetPath = path.join(__dirname, `../../../${folderSuffix}`, categoryPath, componentName);
269
+ const targetPath = path.join(__dirname, `../../../../${folderSuffix}`, categoryPath, componentName);
269
270
 
270
271
  // Check if component already exists
271
272
  if (await fs.pathExists(targetPath) && !force) {
@@ -335,22 +336,30 @@ class ComponentRegistry {
335
336
  }
336
337
 
337
338
  async updateAllComponents(force = false) {
338
- Print.info('Looking for updatable components...');
339
+ Print.info('Looking for updatable Visual components...');
339
340
 
340
- const updatableComponents = await this.findUpdatableComponents();
341
+ const allUpdatableComponents = await this.findUpdatableComponents();
342
+
343
+ // ✅ NUEVO: Filtrar solo componentes Visual
344
+ const updatableComponents = allUpdatableComponents.filter(comp => comp.category === 'Visual');
341
345
 
342
346
  if (updatableComponents.length === 0) {
343
- Print.info('No local components found that match the official repository');
344
- Print.info('Use "npm run slice:browse" to see available components');
347
+ Print.info('No local Visual components found that match the official repository');
348
+ Print.info('Use "slice browse" to see available components');
345
349
  return true;
346
350
  }
347
351
 
352
+ // Mostrar estadísticas si hay componentes Service que no se sincronizarán
353
+ const serviceComponents = allUpdatableComponents.filter(comp => comp.category === 'Service');
354
+ if (serviceComponents.length > 0) {
355
+ Print.info(`Found ${serviceComponents.length} Service components (skipped - sync only affects Visual components)`);
356
+ }
357
+
348
358
  Print.newLine();
349
- Print.subtitle(`Found ${updatableComponents.length} updatable components:`);
359
+ Print.subtitle(`Found ${updatableComponents.length} updatable Visual components:`);
350
360
  Print.newLine();
351
361
  updatableComponents.forEach(comp => {
352
- const icon = comp.category === 'Visual' ? '🎨' : '⚙️';
353
- console.log(`${icon} ${comp.name} (${comp.category})`);
362
+ console.log(`🎨 ${comp.name} (${comp.category})`);
354
363
  });
355
364
 
356
365
  if (!force) {
@@ -358,7 +367,7 @@ class ComponentRegistry {
358
367
  {
359
368
  type: 'confirm',
360
369
  name: 'confirmUpdate',
361
- message: `Do you want to update all these components to the repository versions?`,
370
+ message: `Do you want to update these Visual components to the repository versions?`,
362
371
  default: true
363
372
  }
364
373
  ]);
@@ -369,38 +378,32 @@ class ComponentRegistry {
369
378
  }
370
379
  }
371
380
 
372
- // Group by category for efficient processing
373
- const visualComponents = updatableComponents.filter(c => c.category === 'Visual').map(c => c.name);
374
- const serviceComponents = updatableComponents.filter(c => c.category === 'Service').map(c => c.name);
375
-
376
- let allResults = [];
377
-
378
- // Update Visual components
379
- if (visualComponents.length > 0) {
380
- Print.info(`Updating ${visualComponents.length} Visual components...`);
381
- const visualResults = await this.installMultipleComponents(visualComponents, 'Visual', true);
382
- allResults = allResults.concat(visualResults);
383
- }
384
-
385
- // Update Service components
386
- if (serviceComponents.length > 0) {
387
- Print.info(`Updating ${serviceComponents.length} Service components...`);
388
- const serviceResults = await this.installMultipleComponents(serviceComponents, 'Service', true);
389
- allResults = allResults.concat(serviceResults);
390
- }
381
+ // SIMPLIFICADO: Solo actualizar componentes Visual
382
+ const visualComponentNames = updatableComponents.map(c => c.name);
383
+
384
+ Print.info(`Updating ${visualComponentNames.length} Visual components...`);
385
+ const results = await this.installMultipleComponents(visualComponentNames, 'Visual', true);
391
386
 
392
387
  // Final summary
393
- const totalSuccessful = allResults.filter(r => r.success).length;
394
- const totalFailed = allResults.filter(r => !r.success).length;
388
+ const totalSuccessful = results.filter(r => r.success).length;
389
+ const totalFailed = results.filter(r => !r.success).length;
395
390
 
396
391
  Print.newLine();
397
- Print.title('Final Update Summary');
398
- Print.success(`Components updated: ${totalSuccessful}`);
392
+ Print.title('Visual Components Sync Summary');
393
+ Print.success(`Visual components updated: ${totalSuccessful}`);
399
394
 
400
395
  if (totalFailed > 0) {
401
- Print.error(`Components failed: ${totalFailed}`);
396
+ Print.error(`Visual components failed: ${totalFailed}`);
402
397
  } else {
403
- Print.success('All your components are now updated to the latest official versions!');
398
+ Print.success('All your Visual components are now updated to the latest official versions!');
399
+ }
400
+
401
+ // Información adicional sobre Service components
402
+ if (serviceComponents.length > 0) {
403
+ Print.newLine();
404
+ Print.info(`Note: ${serviceComponents.length} Service components were found but not updated`);
405
+ Print.info('Service components maintain manual versioning - update them individually if needed');
406
+ Print.commandExample('Update Service component manually', 'slice get FetchManager --service --force');
404
407
  }
405
408
 
406
409
  return totalFailed === 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "description": "Command client for developing web applications with Slice.js framework",
5
5
  "main": "client.js",
6
6
  "scripts": {