slicejs-web-framework 2.0.1 → 2.0.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.
package/Slice/Slice.js CHANGED
@@ -11,7 +11,6 @@ export default class Slice {
11
11
  this.loggerConfig = sliceConfig.logger;
12
12
  this.debuggerConfig = sliceConfig.debugger;
13
13
  this.loadingConfig = sliceConfig.loading;
14
- this.productionConfig = sliceConfig.production;
15
14
  }
16
15
 
17
16
  async getClass(module) {
@@ -24,7 +23,7 @@ export default class Slice {
24
23
  }
25
24
 
26
25
  isProduction(){
27
- return this.productionConfig.enabled;
26
+ return true;
28
27
  }
29
28
 
30
29
  getComponent(componentSliceId) {
package/api/index.js CHANGED
@@ -14,35 +14,20 @@ const app = express();
14
14
 
15
15
  // Parsear argumentos de línea de comandos
16
16
  const args = process.argv.slice(2);
17
- let runMode = 'development'; // Default
18
17
 
19
- // Detectar modo basado en argumentos
20
- if (args.includes('--production') || args.includes('--prod')) {
21
- runMode = 'production';
22
- } else if (args.includes('--development') || args.includes('--dev')) {
23
- runMode = 'development';
24
- }
25
-
26
- // También mantener compatibilidad con NODE_ENV como fallback
27
- if (!args.length) {
28
- const NODE_ENV = process.env.NODE_ENV || 'development';
29
- runMode = NODE_ENV === 'production' ? 'production' : 'development';
30
- }
18
+ // Siempre usar development mode (ignorar argumentos de production)
19
+ const runMode = 'development';
20
+ const folderDeployed = 'src';
31
21
 
32
22
  // Obtener puerto desde sliceConfig.json, con fallback a process.env.PORT
33
23
  const PORT = sliceConfig.server?.port || process.env.PORT || 3001;
34
24
 
35
- // Determinar directorio a servir basado en argumentos
36
- let folderDeployed;
37
- if (runMode === 'production') {
38
- folderDeployed = 'dist';
39
- } else {
40
- folderDeployed = 'src';
41
- }
42
-
43
25
  console.log(`🚀 Starting Slice.js server in ${runMode} mode`);
44
26
  console.log(`📁 Serving files from: /${folderDeployed}`);
45
27
 
28
+ app.use('/Slice/', express.static(path.join(__dirname, '..', 'node_modules', 'slicejs-web-framework', 'Slice')));
29
+
30
+
46
31
  // Middleware para servir archivos estáticos
47
32
  app.use(express.static(path.join(__dirname, `../${folderDeployed}`)));
48
33
 
@@ -77,7 +62,7 @@ app.get('/api/status', (req, res) => {
77
62
 
78
63
  // SPA fallback - servir index.html para rutas no encontradas
79
64
  app.get('*', (req, res) => {
80
- const indexPath = path.join(__dirname, `../${folderDeployed}`, 'index.html');
65
+ const indexPath = path.join(__dirname, `../${folderDeployed}`,"App", 'index.html');
81
66
  res.sendFile(indexPath, (err) => {
82
67
  if (err) {
83
68
  res.status(404).send(`
@@ -95,24 +80,29 @@ app.get('*', (req, res) => {
95
80
 
96
81
  function startServer() {
97
82
  server = app.listen(PORT, () => {
98
- console.log(`✅ Server running at http://localhost:${PORT}`);
99
- console.log(`📂 Mode: ${runMode} (serving from /${folderDeployed})`);
100
-
101
- if (runMode === 'development') {
102
- console.log('🔄 Development mode: Changes in /src will require server restart');
103
- } else {
104
- console.log('⚡ Production mode: Serving optimized files from /dist');
105
- }
83
+ // Limpiar consola y mostrar banner de inicio
84
+ console.clear();
85
+ showWelcomeBanner();
106
86
 
107
- console.log('🛑 Press Ctrl+C to stop');
108
- console.log('\n💡 Available commands:');
109
- console.log(' - Development: npm run slice:dev');
110
- console.log(' - Production: npm run slice:start');
111
- console.log(' - Build: npm run slice:build');
87
+ // Información del servidor
88
+ console.log(`✅ Server running at ${'\x1b[36m'}http://localhost:${PORT}${'\x1b[0m'}`);
89
+ console.log(`📂 Mode: ${'\x1b[32m'}${runMode}${'\x1b[0m'} (serving from ${'\x1b[33m'}/${folderDeployed}${'\x1b[0m'})`);
90
+ console.log(`🔄 ${'\x1b[32m'}Development mode${'\x1b[0m'}: Changes in /src are served instantly`);
91
+ console.log(`🛑 Press ${'\x1b[31m'}Ctrl+C${'\x1b[0m'} to stop\n`);
112
92
  });
113
93
 
114
- // Siempre mostrar menú interactivo
115
- setTimeout(showInteractiveMenu, 1000);
94
+ // Mostrar menú interactivo después de un momento
95
+ setTimeout(showInteractiveMenu, 1500);
96
+ }
97
+
98
+ function showWelcomeBanner() {
99
+ const banner = `
100
+ ${'\x1b[36m'}╔══════════════════════════════════════════════════╗${'\x1b[0m'}
101
+ ${'\x1b[36m'}║${'\x1b[0m'} ${'\x1b[1m'}🍰 SLICE.JS SERVER${'\x1b[0m'} ${'\x1b[36m'}║${'\x1b[0m'}
102
+ ${'\x1b[36m'}║${'\x1b[0m'} ${'\x1b[90m'}Development Environment${'\x1b[0m'} ${'\x1b[36m'}║${'\x1b[0m'}
103
+ ${'\x1b[36m'}╚══════════════════════════════════════════════════╝${'\x1b[0m'}
104
+ `;
105
+ console.log(banner);
116
106
  }
117
107
 
118
108
  async function showInteractiveMenu() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-web-framework",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20"