slicejs-cli 2.2.6 → 2.2.8

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/client.js CHANGED
@@ -6,7 +6,6 @@ import createComponent from "./commands/createComponent/createComponent.js";
6
6
  import listComponents from "./commands/listComponents/listComponents.js";
7
7
  import deleteComponent from "./commands/deleteComponent/deleteComponent.js";
8
8
  import getComponent, { listComponents as listRemoteComponents, syncComponents } from "./commands/getComponent/getComponent.js";
9
- import buildProduction, { buildCommand, serveProductionBuild } from "./commands/buildProduction/buildProduction.js";
10
9
  import startServer from "./commands/startServer/startServer.js";
11
10
  import versionChecker from "./commands/utils/versionChecker.js";
12
11
  import fs from "fs";
@@ -53,7 +52,7 @@ async function runWithVersionCheck(commandFunction, ...args) {
53
52
 
54
53
  const sliceClient = program;
55
54
 
56
- sliceClient.version("2.1.3").description("CLI for managing Slice.js framework components");
55
+ sliceClient.version("2.2.6").description("CLI for managing Slice.js framework components");
57
56
 
58
57
  // INIT COMMAND
59
58
  sliceClient
@@ -75,73 +74,28 @@ sliceClient
75
74
  await versionChecker.showVersionInfo();
76
75
  });
77
76
 
78
- // BUILD COMMAND
77
+ // DEV COMMAND (DEVELOPMENT) - COMANDO PRINCIPAL
79
78
  sliceClient
80
- .command("build")
81
- .description("Build project for production")
82
- .option("--serve", "Start production server after build")
83
- .option("--preview", "Start preview server after build")
84
- .option("--analyze", "Analyze build without building")
85
- .option("--skip-clean", "Skip cleaning previous build")
86
- .option("-p, --port <port>", "Port for preview/serve server", 3001)
87
- .action(async (options) => {
88
- await runWithVersionCheck(async () => {
89
- const success = await buildCommand({
90
- serve: options.serve,
91
- preview: options.preview,
92
- analyze: options.analyze,
93
- skipClean: options.skipClean,
94
- port: parseInt(options.port)
95
- });
96
-
97
- if (!success) {
98
- process.exit(1);
99
- }
100
- });
101
- });
102
-
103
- // START COMMAND (PRODUCTION)
104
- sliceClient
105
- .command("start")
106
- .description("Start production server (requires build first)")
107
- .option("-p, --port <port>", "Port for production server", 3000)
108
- .option("--build", "Build for production before starting")
79
+ .command("dev")
80
+ .description("Start development server")
81
+ .option("-p, --port <port>", "Port for development server", 3000)
109
82
  .action(async (options) => {
110
83
  await runWithVersionCheck(async () => {
111
- const distDir = path.join(__dirname, "../../dist");
112
-
113
- // Verificar si existe build de producción
114
- if (!fs.existsSync(distDir) && !options.build) {
115
- Print.error("No production build found");
116
- Print.info("Run 'slice build' first or use 'slice start --build'");
117
- return false;
118
- }
119
-
120
- // Si se solicita build, construir primero
121
- if (options.build) {
122
- Print.info("Building for production...");
123
- const buildSuccess = await buildProduction();
124
- if (!buildSuccess) {
125
- Print.error("Build failed, cannot start production server");
126
- return false;
127
- }
128
- }
129
-
130
- // Iniciar servidor de producción
131
84
  await startServer({
132
- mode: 'production',
85
+ mode: 'development',
133
86
  port: parseInt(options.port)
134
87
  });
135
88
  });
136
89
  });
137
90
 
138
- // DEV COMMAND (DEVELOPMENT)
91
+ // START COMMAND - ALIAS PARA DEV
139
92
  sliceClient
140
- .command("dev")
141
- .description("Start development server")
142
- .option("-p, --port <port>", "Port for development server", 3000)
93
+ .command("start")
94
+ .description("Start development server (alias for dev)")
95
+ .option("-p, --port <port>", "Port for server", 3000)
143
96
  .action(async (options) => {
144
97
  await runWithVersionCheck(async () => {
98
+ Print.info("Starting development server...");
145
99
  await startServer({
146
100
  mode: 'development',
147
101
  port: parseInt(options.port)
@@ -358,13 +312,12 @@ sliceClient
358
312
  subcommandTerm: (cmd) => cmd.name() + ' ' + cmd.usage()
359
313
  });
360
314
 
361
- // Custom help - usando Print para consistencia
315
+ // Custom help - SIMPLIFICADO para development only
362
316
  sliceClient.addHelpText('after', `
363
317
  Common Usage Examples:
364
318
  slice init - Initialize new Slice.js project
365
319
  slice dev - Start development server
366
- slice build - Build for production
367
- slice start - Start production server
320
+ slice start - Start development server (same as dev)
368
321
  slice get Button Card Input - Install Visual components from registry
369
322
  slice get FetchManager -s - Install Service component from registry
370
323
  slice browse - Browse all available components
@@ -372,16 +325,18 @@ Common Usage Examples:
372
325
  slice component create - Create new local component
373
326
 
374
327
  Command Categories:
375
- • init, dev, build, start - Project lifecycle
328
+ • init, dev, start - Project lifecycle (development only)
376
329
  • get, browse, sync - Quick registry shortcuts
377
330
  • component <cmd> - Local component management
378
331
  • registry <cmd> - Official repository operations
379
332
  • version, update - Maintenance commands
380
333
 
381
- Development vs Production:
382
- • slice dev - Development server (serves from /src)
383
- • slice build - Create optimized /dist build
384
- • slice start - Production server (serves from /dist)
334
+ Development Workflow:
335
+ • slice init - Initialize project
336
+ • slice dev - Start development server (serves from /src)
337
+ • slice start - Alternative to dev command
338
+
339
+ Note: Production builds are disabled. Use development mode for all workflows.
385
340
 
386
341
  More info: https://slice-js-docs.vercel.app/
387
342
  `);
@@ -402,10 +357,9 @@ program.on('command:*', () => {
402
357
  process.exit(1);
403
358
  });
404
359
 
405
- //CREATE HELP Command
360
+ // HELP Command
406
361
  const helpCommand = sliceClient.command("help").description("Display help information for Slice.js CLI").action(() => {
407
362
  sliceClient.outputHelp();
408
- }
409
- );
363
+ });
410
364
 
411
365
  program.parse();
@@ -1,9 +1,9 @@
1
- // commands/buildProduction/buildProduction.js - CON SLICECONFIG PORT
1
+ // commands/buildProduction/buildProduction.js - VERSIÓN LIMPIA
2
2
 
3
3
  import fs from 'fs-extra';
4
4
  import path from 'path';
5
5
  import { fileURLToPath } from 'url';
6
- import UglifyJS from 'uglify-js';
6
+ import { minify as terserMinify } from 'terser';
7
7
  import { minify } from 'html-minifier-terser';
8
8
  import CleanCSS from 'clean-css';
9
9
  import Print from '../Print.js';
@@ -36,7 +36,67 @@ async function checkBuildDependencies() {
36
36
  return false;
37
37
  }
38
38
 
39
- return true;
39
+ try {
40
+ await import('terser');
41
+ await import('clean-css');
42
+ await import('html-minifier-terser');
43
+ Print.success('Build dependencies available');
44
+ return true;
45
+ } catch (error) {
46
+ Print.warning('Some build dependencies missing - using fallback copy mode');
47
+ return true;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Verifica que existan los archivos críticos para Slice.js
53
+ */
54
+ async function verifySliceFiles(srcDir) {
55
+ Print.info('Verifying Slice.js critical files...');
56
+
57
+ const criticalFiles = [
58
+ 'sliceConfig.json',
59
+ 'Components/components.js',
60
+ 'App/index.js'
61
+ ];
62
+
63
+ for (const file of criticalFiles) {
64
+ const filePath = path.join(srcDir, file);
65
+ if (!await fs.pathExists(filePath)) {
66
+ throw new Error(`Critical Slice.js file missing: ${file}`);
67
+ }
68
+ }
69
+
70
+ Print.success('All critical Slice.js files verified');
71
+ }
72
+
73
+ /**
74
+ * Verifica la integridad del build para Slice.js
75
+ */
76
+ async function verifyBuildIntegrity(distDir) {
77
+ Print.info('Verifying build integrity for Slice.js...');
78
+
79
+ const criticalBuiltFiles = [
80
+ 'sliceConfig.json',
81
+ 'Components/components.js',
82
+ 'App/index.js'
83
+ ];
84
+
85
+ for (const file of criticalBuiltFiles) {
86
+ const filePath = path.join(distDir, file);
87
+ if (!await fs.pathExists(filePath)) {
88
+ throw new Error(`Critical built file missing: ${file}`);
89
+ }
90
+
91
+ if (file === 'Components/components.js') {
92
+ const content = await fs.readFile(filePath, 'utf8');
93
+ if (!content.includes('const components') || !content.includes('export default')) {
94
+ throw new Error('components.js structure corrupted during build');
95
+ }
96
+ }
97
+ }
98
+
99
+ Print.success('Build integrity verified - all Slice.js components preserved');
40
100
  }
41
101
 
42
102
  /**
@@ -77,48 +137,130 @@ async function processDirectory(srcPath, distPath, baseSrcPath) {
77
137
  */
78
138
  async function processFile(srcFilePath, distFilePath) {
79
139
  const ext = path.extname(srcFilePath).toLowerCase();
140
+ const fileName = path.basename(srcFilePath);
80
141
 
81
142
  try {
82
- if (ext === '.js') {
143
+ if (fileName === 'components.js') {
144
+ await processComponentsFile(srcFilePath, distFilePath);
145
+ } else if (ext === '.js') {
83
146
  await minifyJavaScript(srcFilePath, distFilePath);
84
147
  } else if (ext === '.css') {
85
148
  await minifyCSS(srcFilePath, distFilePath);
86
149
  } else if (ext === '.html') {
87
150
  await minifyHTML(srcFilePath, distFilePath);
151
+ } else if (fileName === 'sliceConfig.json') {
152
+ await fs.copy(srcFilePath, distFilePath);
153
+ Print.info(`📄 Preserved: ${fileName} (configuration file)`);
88
154
  } else {
89
- // Copiar archivos que no necesitan minificación
90
155
  await fs.copy(srcFilePath, distFilePath);
156
+ const stat = await fs.stat(srcFilePath);
157
+ const sizeKB = (stat.size / 1024).toFixed(1);
158
+ Print.info(`📄 Copied: ${fileName} (${sizeKB} KB)`);
91
159
  }
92
160
  } catch (error) {
93
- Print.error(`Processing ${path.basename(srcFilePath)}: ${error.message}`);
94
- // Copiar archivo original si falla la minificación
161
+ Print.error(`Processing ${fileName}: ${error.message}`);
95
162
  await fs.copy(srcFilePath, distFilePath);
96
163
  }
97
164
  }
98
165
 
99
166
  /**
100
- * Minifica archivos JavaScript
167
+ * Procesa el archivo components.js de forma especial
168
+ */
169
+ async function processComponentsFile(srcPath, distPath) {
170
+ const content = await fs.readFile(srcPath, 'utf8');
171
+ const originalSize = Buffer.byteLength(content, 'utf8');
172
+
173
+ const result = await terserMinify(content, {
174
+ compress: false,
175
+ mangle: false,
176
+ format: {
177
+ comments: false,
178
+ beautify: false,
179
+ indent_level: 0
180
+ }
181
+ });
182
+
183
+ if (result.error) {
184
+ throw new Error(`Terser error in components.js: ${result.error}`);
185
+ }
186
+
187
+ await fs.writeFile(distPath, result.code, 'utf8');
188
+
189
+ const minifiedSize = Buffer.byteLength(result.code, 'utf8');
190
+ const savings = Math.round(((originalSize - minifiedSize) / originalSize) * 100);
191
+
192
+ Print.minificationResult(`${path.basename(srcPath)} (preserved structure)`, originalSize, minifiedSize, savings);
193
+ }
194
+
195
+ /**
196
+ * Minifica archivos JavaScript preservando la arquitectura de Slice.js
101
197
  */
102
198
  async function minifyJavaScript(srcPath, distPath) {
103
199
  const content = await fs.readFile(srcPath, 'utf8');
104
200
  const originalSize = Buffer.byteLength(content, 'utf8');
105
201
 
106
- const result = UglifyJS.minify(content, {
202
+ const result = await terserMinify(content, {
107
203
  compress: {
108
204
  drop_console: false,
109
205
  drop_debugger: true,
110
- pure_funcs: ['console.log']
206
+ pure_funcs: [],
207
+ passes: 1,
208
+ unused: false,
209
+ side_effects: false,
210
+ reduce_vars: false,
211
+ collapse_vars: false
111
212
  },
112
213
  mangle: {
113
- reserved: ['slice', 'Slice']
214
+ reserved: [
215
+ // Core Slice
216
+ 'slice', 'Slice', 'SliceJS', 'window', 'document',
217
+ // Clases principales
218
+ 'Controller', 'StylesManager', 'Router', 'Logger', 'Debugger',
219
+ // Métodos de Slice
220
+ 'getClass', 'isProduction', 'getComponent', 'build', 'setTheme', 'attachTemplate',
221
+ // Controller
222
+ 'componentCategories', 'templates', 'classes', 'requestedStyles', 'activeComponents',
223
+ 'registerComponent', 'registerComponentsRecursively', 'loadTemplateToComponent',
224
+ 'fetchText', 'setComponentProps', 'verifyComponentIds', 'destroyComponent',
225
+ // StylesManager
226
+ 'componentStyles', 'themeManager', 'init', 'appendComponentStyles', 'registerComponentStyles',
227
+ // Router
228
+ 'routes', 'pathToRouteMap', 'activeRoute', 'navigate', 'matchRoute', 'handleRoute',
229
+ 'onRouteChange', 'loadInitialRoute', 'renderRoutesComponentsInPage',
230
+ // Propiedades de componentes
231
+ 'sliceId', 'sliceType', 'sliceConfig', 'debuggerProps', 'parentComponent',
232
+ 'value', 'customColor', 'icon', 'layout', 'view', 'items', 'columns', 'rows',
233
+ 'onClickCallback', 'props',
234
+ // Custom Elements
235
+ 'customElements', 'define', 'HTMLElement',
236
+ // DOM APIs críticas
237
+ 'addEventListener', 'removeEventListener', 'querySelector', 'querySelectorAll',
238
+ 'appendChild', 'removeChild', 'innerHTML', 'textContent', 'style', 'classList',
239
+ // Lifecycle
240
+ 'beforeMount', 'afterMount', 'beforeDestroy', 'afterDestroy',
241
+ 'mount', 'unmount', 'destroy', 'update', 'start', 'stop',
242
+ // Browser APIs
243
+ 'fetch', 'setTimeout', 'clearTimeout', 'localStorage', 'history', 'pushState',
244
+ // Exports/Imports
245
+ 'default', 'export', 'import', 'from', 'await', 'async',
246
+ // Nombres de componentes
247
+ 'Button', 'Grid', 'Layout', 'HomePage', 'NotFound', 'Loading', 'TreeView', 'Link',
248
+ 'FetchManager', 'Translator'
249
+ ],
250
+ properties: {
251
+ regex: /^(slice|_|\$|on[A-Z]|get|set|has|is)/
252
+ }
114
253
  },
115
- output: {
116
- comments: false
117
- }
254
+ format: {
255
+ comments: false,
256
+ beautify: false
257
+ },
258
+ keep_fnames: true,
259
+ keep_classnames: true
118
260
  });
119
261
 
120
262
  if (result.error) {
121
- throw new Error(`UglifyJS error: ${result.error}`);
263
+ throw new Error(`Terser error: ${result.error}`);
122
264
  }
123
265
 
124
266
  await fs.writeFile(distPath, result.code, 'utf8');
@@ -170,7 +312,14 @@ async function minifyHTML(srcPath, distPath) {
170
312
  removeStyleLinkTypeAttributes: true,
171
313
  useShortDoctype: true,
172
314
  minifyCSS: true,
173
- minifyJS: true
315
+ minifyJS: {
316
+ mangle: {
317
+ reserved: ['slice', 'Slice', 'SliceJS', 'sliceId', 'sliceConfig']
318
+ }
319
+ },
320
+ ignoreCustomFragments: [
321
+ /slice-[\w-]+="[^"]*"/g
322
+ ]
174
323
  });
175
324
 
176
325
  await fs.writeFile(distPath, minified, 'utf8');
@@ -255,7 +404,7 @@ async function analyzeBuild() {
255
404
  }
256
405
 
257
406
  /**
258
- * Función principal de build
407
+ * FUNCIÓN PRINCIPAL DE BUILD
259
408
  */
260
409
  export default async function buildProduction(options = {}) {
261
410
  const startTime = Date.now();
@@ -267,12 +416,13 @@ export default async function buildProduction(options = {}) {
267
416
  const srcDir = path.join(__dirname, '../../../../src');
268
417
  const distDir = path.join(__dirname, '../../../../dist');
269
418
 
270
- // Verificar que existe el directorio src
271
419
  if (!await fs.pathExists(srcDir)) {
272
420
  throw new Error('Source directory not found. Run "slice init" first.');
273
421
  }
274
422
 
275
- // 1. Limpiar directorio dist
423
+ await verifySliceFiles(srcDir);
424
+
425
+ // Limpiar directorio dist
276
426
  if (await fs.pathExists(distDir)) {
277
427
  if (!options.skipClean) {
278
428
  Print.info('Cleaning previous build...');
@@ -282,32 +432,26 @@ export default async function buildProduction(options = {}) {
282
432
  }
283
433
 
284
434
  await fs.ensureDir(distDir);
285
-
286
- // 2. Copiar sliceConfig.json sin modificaciones
287
435
  await copySliceConfig();
288
436
 
289
- // 3. Procesar todos los archivos de src
290
- Print.info('Processing and minifying source files...');
437
+ // Procesar archivos
438
+ Print.info('Processing and optimizing source files for Slice.js...');
291
439
  await processDirectory(srcDir, distDir, srcDir);
292
440
  Print.success('All source files processed and optimized');
293
441
 
294
- // 4. Crear bundle optimizado del archivo principal
442
+ await verifyBuildIntegrity(distDir);
295
443
  await createOptimizedBundle();
296
-
297
- // 5. Generar estadísticas
298
444
  await generateBuildStats(srcDir, distDir);
299
445
 
300
- // 6. Tiempo total
301
446
  const buildTime = ((Date.now() - startTime) / 1000).toFixed(1);
302
447
 
303
448
  Print.newLine();
304
- Print.success(`✨ Production build completed in ${buildTime}s`);
449
+ Print.success(`✨ Slice.js production build completed in ${buildTime}s`);
305
450
  Print.info('Your optimized project is ready in the /dist directory');
306
451
  Print.newLine();
307
452
  Print.info('Next steps:');
308
453
  console.log(' • Use "npm run slice:start" to test the production build');
309
- console.log(' • Deploy both /api and /dist directories to your hosting provider');
310
- console.log(' • Use "slice build --serve" to preview the production build');
454
+ console.log(' • All Slice.js components and architecture preserved');
311
455
 
312
456
  return true;
313
457
 
@@ -334,19 +478,15 @@ export async function serveProductionBuild(port) {
334
478
 
335
479
  Print.info(`Starting production preview server on port ${finalPort}...`);
336
480
 
337
- // Implementar servidor estático simple
338
481
  const express = await import('express');
339
482
  const app = express.default();
340
483
 
341
- // Servir archivos estáticos desde dist
342
484
  app.use(express.default.static(distDir));
343
485
 
344
- // SPA fallback - servir index.html para rutas no encontradas
345
486
  app.get('*', (req, res) => {
346
487
  const indexPath = path.join(distDir, 'App/index.html');
347
488
  const fallbackPath = path.join(distDir, 'index.html');
348
489
 
349
- // Intentar primero App/index.html, luego index.html
350
490
  if (fs.existsSync(indexPath)) {
351
491
  res.sendFile(indexPath);
352
492
  } else if (fs.existsSync(fallbackPath)) {
@@ -376,24 +516,20 @@ export async function buildCommand(options = {}) {
376
516
  const config = loadConfig();
377
517
  const defaultPort = config?.server?.port || 3001;
378
518
 
379
- // Verificar dependencias necesarias
380
519
  if (!await checkBuildDependencies()) {
381
520
  return false;
382
521
  }
383
522
 
384
523
  if (options.serve) {
385
- // Solo servir build existente
386
524
  await serveProductionBuild(options.port || defaultPort);
387
525
  return true;
388
526
  }
389
527
 
390
528
  if (options.analyze) {
391
- // Analizar build sin construir
392
529
  await analyzeBuild();
393
530
  return true;
394
531
  }
395
532
 
396
- // Build completo
397
533
  const success = await buildProduction(options);
398
534
 
399
535
  if (success && options.preview) {
@@ -43,8 +43,8 @@ const getComponents = () => {
43
43
  const config = loadConfig();
44
44
  if (!config) return {};
45
45
 
46
- const isProduction = config.production.enabled===true;
47
- const folderSuffix = isProduction ? 'dist' : 'src';
46
+ //const isProduction = config.production.enabled===true;
47
+ const folderSuffix = 'src'; // Siempre usar 'src' para desarrollo
48
48
 
49
49
  const componentPaths = config.paths?.components || {}; // Obtiene dinámicamente las rutas de los componentes
50
50
  let allComponents = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "Command client for developing web applications with Slice.js framework",
5
5
  "main": "client.js",
6
6
  "scripts": {
package/post.js CHANGED
@@ -22,11 +22,10 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
22
22
  // Add custom commands to the project scripts
23
23
  projectPackageJson.scripts = projectPackageJson.scripts || {};
24
24
 
25
- // Main project commands
25
+ // Main project commands - SOLO DEVELOPMENT
26
26
  projectPackageJson.scripts['slice:init'] = 'node node_modules/slicejs-cli/client.js init';
27
27
  projectPackageJson.scripts['slice:dev'] = 'node api/index.js --development';
28
- projectPackageJson.scripts['slice:start'] = 'node api/index.js --production';
29
- projectPackageJson.scripts['slice:build'] = 'node node_modules/slicejs-cli/client.js build';
28
+ projectPackageJson.scripts['slice:start'] = 'node api/index.js --development';
30
29
  projectPackageJson.scripts['slice:version'] = 'node node_modules/slicejs-cli/client.js version';
31
30
  projectPackageJson.scripts['slice:update'] = 'node node_modules/slicejs-cli/client.js update';
32
31
 
@@ -45,12 +44,7 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
45
44
  projectPackageJson.scripts['slice:registry-list'] = 'node node_modules/slicejs-cli/client.js registry list';
46
45
  projectPackageJson.scripts['slice:registry-sync'] = 'node node_modules/slicejs-cli/client.js registry sync';
47
46
 
48
- // Build-related commands
49
- projectPackageJson.scripts['slice:build-serve'] = 'node node_modules/slicejs-cli/client.js build --serve';
50
- projectPackageJson.scripts['slice:build-preview'] = 'node node_modules/slicejs-cli/client.js build --preview';
51
- projectPackageJson.scripts['slice:build-analyze'] = 'node node_modules/slicejs-cli/client.js build --analyze';
52
-
53
- // Legacy/compatibility commands - ACTUALIZADOS
47
+ // Legacy commands - SOLO DEVELOPMENT
54
48
  projectPackageJson.scripts['run'] = 'node api/index.js --development';
55
49
  projectPackageJson.scripts['development'] = 'node api/index.js --development';
56
50
 
@@ -68,8 +62,7 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
68
62
  console.log('\n🚀 Main workflow commands:');
69
63
  console.log(' npm run slice:init - Initialize Slice.js project');
70
64
  console.log(' npm run slice:dev - Start development server (serves from /src)');
71
- console.log(' npm run slice:build - Build for production (creates /dist)');
72
- console.log(' npm run slice:start - Start production server (serves from /dist)');
65
+ console.log(' npm run slice:start - Start development server (same as dev)');
73
66
  console.log('\n📦 Component management:');
74
67
  console.log(' npm run slice:get Button - Get components from official repository');
75
68
  console.log(' npm run slice:browse - View all available components');
@@ -78,23 +71,14 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
78
71
  console.log(' npm run slice:create - Create local component');
79
72
  console.log(' npm run slice:list - List local components');
80
73
  console.log(' npm run slice:delete - Delete local component');
81
- console.log('\n🔧 Build utilities:');
82
- console.log(' npm run slice:build-serve - Build and serve immediately');
83
- console.log(' npm run slice:build-preview- Build and preview');
84
- console.log(' npm run slice:build-analyze- Analyze build size');
85
74
  console.log('\n🔧 Other utilities:');
86
75
  console.log(' npm run slice:version - View version information');
87
76
  console.log(' npm run slice:update - Check for available updates');
88
- console.log('\n🎯 Development workflow:');
77
+ console.log('\n🎯 Simplified workflow:');
89
78
  console.log(' 1. npm run slice:init - Initialize project');
90
- console.log(' 2. npm run slice:dev - Develop with hot reload');
91
- console.log(' 3. npm run slice:build - Build for production');
92
- console.log(' 4. npm run slice:start - Test production build');
93
- console.log('\n💡 Tip: Use "slice:sync" to keep your components updated');
94
- console.log('\n🔧 New argument-based system:');
95
- console.log(' • slice:dev → node api/index.js --development');
96
- console.log(' • slice:start → node api/index.js --production');
97
- console.log(' • Arguments take precedence over environment variables');
79
+ console.log(' 2. npm run slice:dev - Start development server');
80
+ console.log(' 3. Develop and iterate - No build step needed!');
81
+ console.log('\n💡 Development-focused: All commands serve from /src for instant changes');
98
82
  })
99
83
  .catch(err => {
100
84
  if (err.code === 'ENOENT') {
@@ -105,11 +89,10 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
105
89
  description: 'Slice.js project',
106
90
  main: 'api/index.js',
107
91
  scripts: {
108
- // Main workflow commands - UPDATED with arguments
92
+ // Main workflow commands - SOLO DEVELOPMENT
109
93
  'slice:init': 'node node_modules/slicejs-cli/client.js init',
110
94
  'slice:dev': 'node api/index.js --development',
111
- 'slice:start': 'node api/index.js --production',
112
- 'slice:build': 'node node_modules/slicejs-cli/client.js build',
95
+ 'slice:start': 'node api/index.js --development',
113
96
  'slice:version': 'node node_modules/slicejs-cli/client.js version',
114
97
  'slice:update': 'node node_modules/slicejs-cli/client.js update',
115
98
 
@@ -123,12 +106,7 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
123
106
  'slice:browse': 'node node_modules/slicejs-cli/client.js browse',
124
107
  'slice:sync': 'node node_modules/slicejs-cli/client.js sync',
125
108
 
126
- // Build utilities
127
- 'slice:build-serve': 'node node_modules/slicejs-cli/client.js build --serve',
128
- 'slice:build-preview': 'node node_modules/slicejs-cli/client.js build --preview',
129
- 'slice:build-analyze': 'node node_modules/slicejs-cli/client.js build --analyze',
130
-
131
- // Legacy commands - UPDATED
109
+ // Legacy commands - SOLO DEVELOPMENT
132
110
  'run': 'node api/index.js --development',
133
111
  'development': 'node api/index.js --development'
134
112
  },
@@ -145,16 +123,16 @@ fs.promises.access(projectPackageJsonPath, fs.constants.F_OK)
145
123
  })
146
124
  .then(() => {
147
125
  console.log('✅ SliceJS CLI commands configured successfully');
148
- console.log('\n🎯 Updated workflow:');
126
+ console.log('\n🎯 Simplified development workflow:');
149
127
  console.log(' npm run slice:dev → node api/index.js --development (serves /src)');
150
- console.log(' npm run slice:start → node api/index.js --production (serves /dist)');
128
+ console.log(' npm run slice:start → node api/index.js --development (same as dev)');
151
129
  console.log('\n🔧 Benefits:');
152
- console.log(' • Clear argument-based mode detection');
153
- console.log(' • No confusion between src/dist directories');
154
- console.log(' • Maintains backward compatibility with NODE_ENV');
155
- console.log(' • More reliable and predictable behavior');
130
+ console.log(' • Simple development-only workflow');
131
+ console.log(' • Instant changes without build steps');
132
+ console.log(' • Always serves from /src directory');
133
+ console.log(' • Interactive menu always available');
156
134
  })
157
135
  .catch(err => {
158
136
  console.error('❌ Error setting up package.json:', err.message);
159
137
  process.exit(1);
160
- });
138
+ });