froggo-mission-control 1.2.4 → 1.2.6
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/bin/cli.js +23 -4
- package/package.json +1 -1
- package/scripts/postinstall.js +4 -2
package/bin/cli.js
CHANGED
|
@@ -498,7 +498,9 @@ async function cmdSetup(force = false) {
|
|
|
498
498
|
// ── Install persistent service ──────────────────────────────────────────
|
|
499
499
|
step('Installing persistent service (auto-start at login)');
|
|
500
500
|
const nodeBin = findNodeBin();
|
|
501
|
-
|
|
501
|
+
// Use the actual Next.js JS entry point — avoids the .bin/next shell wrapper
|
|
502
|
+
// which fails in LaunchAgent/systemd contexts where node isn't in PATH
|
|
503
|
+
const nextScript = path.join(INSTALL_DIR, 'node_modules', 'next', 'dist', 'bin', 'next');
|
|
502
504
|
const logPath = path.join(HOME, 'Library', 'Logs', 'mission-control-app.log');
|
|
503
505
|
|
|
504
506
|
const envVars = {
|
|
@@ -537,7 +539,7 @@ async function cmdSetup(force = false) {
|
|
|
537
539
|
<key>ProgramArguments</key>
|
|
538
540
|
<array>
|
|
539
541
|
<string>${nodeBin}</string>
|
|
540
|
-
<string>${
|
|
542
|
+
<string>${nextScript}</string>
|
|
541
543
|
<string>start</string>
|
|
542
544
|
<string>--port</string>
|
|
543
545
|
<string>${port}</string>
|
|
@@ -620,7 +622,7 @@ After=network.target
|
|
|
620
622
|
[Service]
|
|
621
623
|
Type=simple
|
|
622
624
|
WorkingDirectory=${INSTALL_DIR}
|
|
623
|
-
ExecStart=${nodeBin} ${
|
|
625
|
+
ExecStart=${nodeBin} ${nextScript} start --port ${port}
|
|
624
626
|
Restart=always
|
|
625
627
|
RestartSec=5
|
|
626
628
|
${envLines}
|
|
@@ -639,6 +641,22 @@ WantedBy=default.target
|
|
|
639
641
|
warn(`Platform: ${os.platform()} — auto-start not supported. Use \`mission-control start\` manually.`);
|
|
640
642
|
}
|
|
641
643
|
|
|
644
|
+
// ── Ensure Next.js build exists ─────────────────────────────────────────
|
|
645
|
+
const nextDir = path.join(INSTALL_DIR, '.next');
|
|
646
|
+
if (!existsSync(nextDir)) {
|
|
647
|
+
step('Building dashboard (Next.js build not found)...');
|
|
648
|
+
const nextScript = path.join(INSTALL_DIR, 'node_modules', 'next', 'dist', 'bin', 'next');
|
|
649
|
+
const buildResult = spawnSync(process.execPath, [nextScript, 'build'], {
|
|
650
|
+
cwd: INSTALL_DIR,
|
|
651
|
+
stdio: 'inherit',
|
|
652
|
+
env: { ...process.env, NEXT_TELEMETRY_DISABLED: '1' },
|
|
653
|
+
});
|
|
654
|
+
if (buildResult.status !== 0) {
|
|
655
|
+
fail('Next.js build failed. Check error output above, then run: mission-control build');
|
|
656
|
+
}
|
|
657
|
+
success('Dashboard built');
|
|
658
|
+
}
|
|
659
|
+
|
|
642
660
|
// ── Start and open ──────────────────────────────────────────────────────
|
|
643
661
|
step('Launching Mission Control');
|
|
644
662
|
info(`Waiting for server on port ${port}...`);
|
|
@@ -690,7 +708,8 @@ async function cmdStart() {
|
|
|
690
708
|
spawnSync('systemctl', ['--user', 'start', 'mission-control.service'], { stdio: 'inherit' });
|
|
691
709
|
} else {
|
|
692
710
|
// Direct start
|
|
693
|
-
const
|
|
711
|
+
const nextScriptFallback = path.join(INSTALL_DIR, 'node_modules', 'next', 'dist', 'bin', 'next');
|
|
712
|
+
const proc = spawn(process.execPath, [nextScriptFallback, 'start'], {
|
|
694
713
|
cwd: INSTALL_DIR,
|
|
695
714
|
detached: true,
|
|
696
715
|
stdio: 'ignore',
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -150,9 +150,11 @@ for (const mod of ['better-sqlite3', 'keytar']) {
|
|
|
150
150
|
info('Building dashboard (Next.js)...');
|
|
151
151
|
process.env.NEXT_TELEMETRY_DISABLED = '1';
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
// Use the actual Next.js JS entry point — avoids the shell wrapper which
|
|
154
|
+
// may fail if node isn't on PATH in the spawn context
|
|
155
|
+
const nextScript = path.join(ROOT, 'node_modules', 'next', 'dist', 'bin', 'next');
|
|
156
|
+
const buildResult = spawnSync(process.execPath, [nextScript, 'build'], {
|
|
154
157
|
cwd: ROOT,
|
|
155
|
-
shell: true,
|
|
156
158
|
stdio: 'inherit',
|
|
157
159
|
env: { ...process.env, NEXT_TELEMETRY_DISABLED: '1' },
|
|
158
160
|
});
|