mango-cms 0.2.7 → 0.2.9

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.
Files changed (2) hide show
  1. package/cli.js +22 -18
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -422,26 +422,30 @@ async function configureWebServer(settings, buildPath) {
422
422
  `/etc/apache2/sites-available/${settings.siteName.toLowerCase()}.conf`;
423
423
 
424
424
  try {
425
- // Write config file
426
- fs.writeFileSync(configPath, config);
427
- console.log(`Created ${webServer} configuration at ${configPath}`);
428
-
429
- if (webServer === 'nginx') {
430
- // Create symlink if it doesn't exist
431
- const enabledPath = `/etc/nginx/sites-enabled/${settings.siteName.toLowerCase()}`;
432
- if (!fs.existsSync(enabledPath)) {
433
- execSync(`sudo ln -s ${configPath} ${enabledPath}`);
434
- }
435
- // Test and reload nginx
436
- execSync('sudo nginx -t');
437
- execSync('sudo systemctl reload nginx');
425
+ // Check if config already exists
426
+ if (fs.existsSync(configPath)) {
427
+ console.log(`${webServer} configuration already exists at ${configPath}, skipping creation`);
438
428
  } else {
439
- // Enable site and reload apache
440
- execSync(`sudo a2ensite ${settings.siteName.toLowerCase()}`);
441
- execSync('sudo systemctl reload apache2');
429
+ // Write config file only if it doesn't exist
430
+ fs.writeFileSync(configPath, config);
431
+ console.log(`Created ${webServer} configuration at ${configPath}`);
432
+
433
+ if (webServer === 'nginx') {
434
+ // Create symlink if it doesn't exist
435
+ const enabledPath = `/etc/nginx/sites-enabled/${settings.siteName.toLowerCase()}`;
436
+ if (!fs.existsSync(enabledPath)) {
437
+ execSync(`sudo ln -s ${configPath} ${enabledPath}`);
438
+ }
439
+ execSync('sudo nginx -t');
440
+ execSync('sudo systemctl reload nginx');
441
+ } else {
442
+ // Enable apache site
443
+ execSync(`sudo a2ensite ${settings.siteName.toLowerCase()}`);
444
+ execSync('sudo systemctl reload apache2');
445
+ }
446
+ console.log(`${webServer} configuration has been updated and service reloaded`);
442
447
  }
443
448
 
444
- console.log(`${webServer} configuration has been updated and service reloaded`);
445
449
  } catch (error) {
446
450
  console.error(`Error configuring ${webServer}:`, error.message);
447
451
  throw error;
@@ -465,7 +469,7 @@ async function managePM2Process(settings) {
465
469
 
466
470
  try {
467
471
  // Check if process exists
468
- const processListOutput = execSync('pm2 list --mini', { encoding: 'utf8' });
472
+ const processListOutput = execSync('pm2 list', { encoding: 'utf8' });
469
473
  const processExists = processListOutput.includes(processName);
470
474
 
471
475
  if (processExists) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mango-cms",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "main": "./index.js",
5
5
  "exports": {
6
6
  ".": "./index.js",