genbox 1.0.108 → 1.0.110
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/dist/commands/init.js +12 -1
- package/dist/commands/status.js +4 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -1555,12 +1555,23 @@ function generateEnvFile(projectName, detected, envVars, serviceUrlMappings) {
|
|
|
1555
1555
|
content += `\n# Git authentication\n# GIT_TOKEN=ghp_xxxxxxxxxxxx\n`;
|
|
1556
1556
|
}
|
|
1557
1557
|
// Add app-specific sections from existing env files
|
|
1558
|
+
// Convert hardcoded localhost URLs to placeholders so they can be expanded based on profile
|
|
1558
1559
|
const appEnvFiles = findAppEnvFiles(detected.apps, detected._meta.scanned_root);
|
|
1559
1560
|
for (const envFile of appEnvFiles) {
|
|
1560
1561
|
try {
|
|
1561
|
-
|
|
1562
|
+
let fileContent = fs_1.default.readFileSync(envFile.fullPath, 'utf8').trim();
|
|
1562
1563
|
if (fileContent) {
|
|
1564
|
+
// Replace hardcoded localhost URLs with placeholders
|
|
1565
|
+
// This allows the URLs to be expanded to local/staging/production based on profile
|
|
1566
|
+
for (const mapping of serviceUrlMappings) {
|
|
1567
|
+
// Escape special regex characters in the URL
|
|
1568
|
+
const escapedUrl = mapping.localUrl.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1569
|
+
// Match the URL with optional quotes around it
|
|
1570
|
+
const urlPattern = new RegExp(`(["']?)${escapedUrl}\\1`, 'g');
|
|
1571
|
+
fileContent = fileContent.replace(urlPattern, `"\${${mapping.varName}}"`);
|
|
1572
|
+
}
|
|
1563
1573
|
content += `\n# === ${envFile.appName} ===\n`;
|
|
1574
|
+
content += `# URLs use placeholders that get expanded based on profile (local vs staging)\n`;
|
|
1564
1575
|
content += fileContent;
|
|
1565
1576
|
content += '\n';
|
|
1566
1577
|
}
|
package/dist/commands/status.js
CHANGED
|
@@ -421,7 +421,10 @@ exports.statusCommand = new commander_1.Command('status')
|
|
|
421
421
|
for (const app of pm2Services) {
|
|
422
422
|
const statusColor = app.status === 'online' ? chalk_1.default.green :
|
|
423
423
|
app.status === 'stopped' ? chalk_1.default.yellow : chalk_1.default.red;
|
|
424
|
-
|
|
424
|
+
// Memory is already in MB from heartbeat (or bytes from legacy heartbeats)
|
|
425
|
+
// If value > 10000, assume bytes and convert; otherwise assume MB
|
|
426
|
+
const memoryMb = app.memory ? (app.memory > 10000 ? Math.round(app.memory / (1024 * 1024)) : app.memory) : 0;
|
|
427
|
+
console.log(`${app.name}\t\t${statusColor(app.status)}\t\t${app.cpu || 0}%\t${memoryMb}MB`);
|
|
425
428
|
}
|
|
426
429
|
console.log('');
|
|
427
430
|
}
|