mango-cms 0.2.18 → 0.2.20
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/cli.js +13 -1
- package/default/package.json +1 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -559,11 +559,12 @@ async function checkPM2() {
|
|
|
559
559
|
// Helper function to manage PM2 process
|
|
560
560
|
async function managePM2Process(settings) {
|
|
561
561
|
const processName = `${settings.siteName.toLowerCase()}-mango`;
|
|
562
|
+
const name = settings.siteName.toLowerCase()
|
|
562
563
|
|
|
563
564
|
try {
|
|
564
565
|
// Check if process exists
|
|
565
566
|
const processListOutput = execSync('pm2 list', { encoding: 'utf8' });
|
|
566
|
-
|
|
567
|
+
let processExists = processListOutput.includes(processName);
|
|
567
568
|
|
|
568
569
|
if (processExists) {
|
|
569
570
|
console.log(`Reloading PM2 process: ${processName}`);
|
|
@@ -572,6 +573,17 @@ async function managePM2Process(settings) {
|
|
|
572
573
|
console.log(`Starting new PM2 process: ${processName}`);
|
|
573
574
|
execSync(`pm2 start index.js --name ${processName}`, { cwd: './build' });
|
|
574
575
|
}
|
|
576
|
+
|
|
577
|
+
processExists = processListOutput.includes(name);
|
|
578
|
+
|
|
579
|
+
if (processExists) {
|
|
580
|
+
console.log(`Reloading PM2 process: ${name}`);
|
|
581
|
+
execSync(`pm2 reload ${name}`);
|
|
582
|
+
} else {
|
|
583
|
+
console.log(`Starting new PM2 process: ${name}`);
|
|
584
|
+
execSync(`pm2 start index.js --name ${name}`, { cwd: './dist' });
|
|
585
|
+
}
|
|
586
|
+
|
|
575
587
|
} catch (error) {
|
|
576
588
|
console.error('Error managing PM2 process:', error.message);
|
|
577
589
|
throw error;
|
package/default/package.json
CHANGED