slicejs-cli 2.2.5 → 2.2.7
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 +22 -68
- package/commands/buildProduction/buildProduction.js +364 -357
- package/commands/startServer/startServer.js +34 -11
- package/package.json +28 -28
- package/post.js +30 -75
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.
|
|
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
|
-
//
|
|
77
|
+
// DEV COMMAND (DEVELOPMENT) - COMANDO PRINCIPAL
|
|
79
78
|
sliceClient
|
|
80
|
-
.command("
|
|
81
|
-
.description("
|
|
82
|
-
.option("--
|
|
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: '
|
|
85
|
+
mode: 'development',
|
|
133
86
|
port: parseInt(options.port)
|
|
134
87
|
});
|
|
135
88
|
});
|
|
136
89
|
});
|
|
137
90
|
|
|
138
|
-
//
|
|
91
|
+
// START COMMAND - ALIAS PARA DEV
|
|
139
92
|
sliceClient
|
|
140
|
-
.command("
|
|
141
|
-
.description("Start development server")
|
|
142
|
-
.option("-p, --port <port>", "Port for
|
|
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 -
|
|
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
|
|
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,
|
|
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
|
|
382
|
-
• slice
|
|
383
|
-
• slice
|
|
384
|
-
• slice start
|
|
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
|
-
//
|
|
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();
|