slicejs-cli 2.2.0 → 2.2.3

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.
@@ -412,34 +412,35 @@ export async function buildCommand(options = {}) {
412
412
  }
413
413
 
414
414
  /**
415
- * Verifica que las dependencias de build estén instaladas
415
+ * Verifica que las dependencias de build estén instaladas en el CLI
416
416
  */
417
417
  async function checkBuildDependencies() {
418
418
  try {
419
419
  Print.info('Checking build dependencies...');
420
420
 
421
- const packageJsonPath = path.join(__dirname, '../../../../package.json');
421
+ // Verificar dependencias en el CLI en lugar del proyecto
422
+ const cliPackageJsonPath = path.join(__dirname, '../../package.json');
422
423
 
423
- if (!await fs.pathExists(packageJsonPath)) {
424
- throw new Error('package.json not found');
424
+ if (!await fs.pathExists(cliPackageJsonPath)) {
425
+ throw new Error('CLI package.json not found');
425
426
  }
426
427
 
427
- const packageJson = await fs.readJson(packageJsonPath);
428
- const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
428
+ const cliPackageJson = await fs.readJson(cliPackageJsonPath);
429
+ const deps = { ...cliPackageJson.dependencies, ...cliPackageJson.devDependencies };
429
430
 
430
431
  const requiredDeps = ['terser', 'clean-css', 'html-minifier-terser'];
431
432
  const missing = requiredDeps.filter(dep => !deps[dep]);
432
433
 
433
434
  if (missing.length > 0) {
434
- Print.error('Missing build dependencies:');
435
+ Print.error('Missing build dependencies in CLI:');
435
436
  missing.forEach(dep => console.log(` • ${dep}`));
436
437
  Print.newLine();
437
- Print.info('Install missing dependencies:');
438
- console.log(`npm install --save-dev ${missing.join(' ')}`);
438
+ Print.info('Please update slicejs-cli to the latest version:');
439
+ console.log('npm install -g slicejs-cli@latest');
439
440
  return false;
440
441
  }
441
442
 
442
- Print.success('All build dependencies are installed');
443
+ Print.success('All build dependencies are available in CLI');
443
444
  return true;
444
445
 
445
446
  } catch (error) {
@@ -34,7 +34,6 @@ async function createProductionIndexFile() {
34
34
  const apiDir = path.join(__dirname, '../../../../api');
35
35
  const originalIndexPath = path.join(apiDir, 'index.js');
36
36
  const backupIndexPath = path.join(apiDir, 'index.dev.js');
37
- const prodIndexPath = path.join(apiDir, 'index.prod.js');
38
37
 
39
38
  // Crear backup del index original si no existe
40
39
  if (!await fs.pathExists(backupIndexPath)) {
@@ -53,11 +52,8 @@ async function createProductionIndexFile() {
53
52
  "express.static(path.join(__dirname, '../dist'))"
54
53
  );
55
54
 
56
- // Escribir archivo temporal de producción
57
- await fs.writeFile(prodIndexPath, productionContent, 'utf8');
58
-
59
- // Reemplazar index.js con versión de producción
60
- await fs.copy(prodIndexPath, originalIndexPath);
55
+ // Escribir la versión modificada directamente
56
+ await fs.writeFile(originalIndexPath, productionContent, 'utf8');
61
57
 
62
58
  Print.success('Express server configured for production mode');
63
59
 
@@ -164,7 +160,7 @@ export default async function startServer(options = {}) {
164
160
  throw new Error('No production build found. Run "slice build" first.');
165
161
  }
166
162
 
167
- // Configurar Express para modo producción
163
+ // Configurar Express para modo producción (modifica api/index.js temporalmente)
168
164
  const configSuccess = await createProductionIndexFile();
169
165
  if (!configSuccess) {
170
166
  throw new Error('Failed to configure production server');
@@ -177,7 +173,7 @@ export default async function startServer(options = {}) {
177
173
  Print.info('Development mode: serving files from /src with hot reload');
178
174
  }
179
175
 
180
- // Iniciar el servidor
176
+ // Iniciar el servidor (solo uno)
181
177
  await startNodeServer(port, mode);
182
178
 
183
179
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "2.2.0",
3
+ "version": "2.2.3",
4
4
  "description": "Command client for developing web applications with Slice.js framework",
5
5
  "main": "client.js",
6
6
  "scripts": {
@@ -17,9 +17,12 @@
17
17
  "type": "module",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
+ "clean-css": "^5.3.3",
20
21
  "commander": "^12.0.0",
21
22
  "fs-extra": "^11.2.0",
23
+ "html-minifier-terser": "^7.2.0",
22
24
  "inquirer": "^12.4.2",
23
- "slicejs-web-framework": "latest"
25
+ "slicejs-web-framework": "latest",
26
+ "terser": "^5.43.1"
24
27
  }
25
28
  }