mango-cms 0.2.49 → 0.2.51

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 CHANGED
@@ -834,11 +834,36 @@ const proxyCmd = program
834
834
 
835
835
  // Start the proxy server as a detached background process
836
836
  const proxyScript = path.join(__dirname, 'lib/dev-proxy.js');
837
- const child = spawn('sudo', ['node', proxyScript, frontDomain, apiDomain, String(frontendPort), String(backendPort), pidPath], {
838
- detached: true,
839
- stdio: 'ignore',
840
- });
841
- child.unref();
837
+ const logPath = path.join(process.cwd(), '.mango-proxy.log');
838
+
839
+ // Use shell to redirect output to a log file and background the process
840
+ // This keeps sudo in the current TTY so the password prompt works
841
+ execSync(
842
+ `sudo node "${proxyScript}" ${frontDomain} ${apiDomain} ${frontendPort} ${backendPort} "${pidPath}" > "${logPath}" 2>&1 &`,
843
+ { stdio: 'inherit', shell: true }
844
+ );
845
+
846
+ // Wait briefly for the proxy to start and write its PID
847
+ let started = false;
848
+ for (let i = 0; i < 10; i++) {
849
+ await new Promise(r => setTimeout(r, 300));
850
+ if (fs.existsSync(pidPath)) {
851
+ const pid = fs.readFileSync(pidPath, 'utf8').trim();
852
+ try {
853
+ execSync(`kill -0 ${pid} 2>/dev/null`);
854
+ started = true;
855
+ break;
856
+ } catch (e) { /* not running yet */ }
857
+ }
858
+ }
859
+
860
+ if (!started) {
861
+ console.error('\nFailed to start proxy server.');
862
+ if (fs.existsSync(logPath)) {
863
+ console.error('Log output:\n' + fs.readFileSync(logPath, 'utf8'));
864
+ }
865
+ process.exit(1);
866
+ }
842
867
 
843
868
  console.log(`
844
869
  Mango Dev Proxy started.
@@ -850,6 +875,7 @@ Start your dev servers with proxy support:
850
875
  mango start (backend on port ${backendPort})
851
876
  VITE_DEV_PROXY=${apiDomain} mango ui dev (frontend on port ${frontendPort})
852
877
 
878
+ Proxy log: ${logPath}
853
879
  To stop: mango proxy stop
854
880
  `);
855
881
  } else if (action === 'stop') {
@@ -25,7 +25,7 @@
25
25
  "dayjs": "^1.10.7",
26
26
  "express": "^4.18.1",
27
27
  "google-maps": "^4.3.3",
28
- "mango-cms": "^0.2.49",
28
+ "mango-cms": "^0.2.51",
29
29
  "mapbox-gl": "^2.7.0",
30
30
  "sweetalert2": "^11.4.0",
31
31
  "vite": "^6.2.2",
@@ -57,6 +57,7 @@ export default defineConfig({
57
57
  ],
58
58
  server: {
59
59
  host: '0.0.0.0',
60
+ allowedHosts: ['.mango'],
60
61
  // When running behind mango proxy, configure HMR to use the proxy domain
61
62
  // VITE_DEV_PROXY is set to api.{slug}.mango; derive frontend domain by stripping "api." prefix
62
63
  ...(process.env.VITE_DEV_PROXY?.startsWith('api.') ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mango-cms",
3
- "version": "0.2.49",
3
+ "version": "0.2.51",
4
4
  "main": "./index.js",
5
5
  "exports": {
6
6
  ".": "./index.js",