slicejs-cli 2.2.2 → 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.
|
@@ -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
|
|
57
|
-
await fs.writeFile(
|
|
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) {
|