orbital-command 0.1.3 → 0.2.0
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/orbital.js +41 -21
- package/package.json +1 -1
- package/vite.config.ts +0 -3
package/bin/orbital.js
CHANGED
|
@@ -148,15 +148,24 @@ async function cmdInit(args) {
|
|
|
148
148
|
|
|
149
149
|
function cmdDev() {
|
|
150
150
|
const shouldOpen = process.argv.includes('--open');
|
|
151
|
+
const forceVite = process.argv.includes('--vite');
|
|
151
152
|
const projectRoot = detectProjectRoot();
|
|
152
153
|
const config = loadConfig(projectRoot);
|
|
153
154
|
const serverPort = config.serverPort || 4444;
|
|
154
155
|
const clientPort = config.clientPort || 4445;
|
|
155
156
|
|
|
157
|
+
// Detect packaged mode: dist/index.html exists → serve pre-built frontend
|
|
158
|
+
const hasPrebuiltFrontend = fs.existsSync(path.join(PACKAGE_ROOT, 'dist', 'index.html'));
|
|
159
|
+
const useVite = forceVite || !hasPrebuiltFrontend;
|
|
160
|
+
|
|
156
161
|
console.log(`\nOrbital Command — dev`);
|
|
157
162
|
console.log(`Project root: ${projectRoot}`);
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
if (useVite) {
|
|
164
|
+
console.log(`Server: http://localhost:${serverPort}`);
|
|
165
|
+
console.log(`Client: http://localhost:${clientPort} (Vite dev server)\n`);
|
|
166
|
+
} else {
|
|
167
|
+
console.log(`Dashboard: http://localhost:${serverPort}\n`);
|
|
168
|
+
}
|
|
160
169
|
|
|
161
170
|
checkTemplatesStaleness(projectRoot);
|
|
162
171
|
|
|
@@ -166,7 +175,7 @@ function cmdDev() {
|
|
|
166
175
|
ORBITAL_SERVER_PORT: String(serverPort),
|
|
167
176
|
};
|
|
168
177
|
|
|
169
|
-
// Start the API server
|
|
178
|
+
// Start the API server (serves pre-built frontend from dist/ when available)
|
|
170
179
|
const tsxBin = resolveBin('tsx');
|
|
171
180
|
const serverProcess = tsxBin
|
|
172
181
|
? spawn(tsxBin, ['watch', path.join(PACKAGE_ROOT, 'server', 'index.ts')],
|
|
@@ -174,16 +183,24 @@ function cmdDev() {
|
|
|
174
183
|
: spawn('npx', ['tsx', 'watch', path.join(PACKAGE_ROOT, 'server', 'index.ts')],
|
|
175
184
|
{ stdio: 'inherit', env, cwd: PACKAGE_ROOT });
|
|
176
185
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
let viteProcess = null;
|
|
187
|
+
|
|
188
|
+
if (useVite) {
|
|
189
|
+
// Development mode: spawn Vite for HMR
|
|
190
|
+
const viteBin = resolveBin('vite');
|
|
191
|
+
viteProcess = viteBin
|
|
192
|
+
? spawn(viteBin, ['--config', path.join(PACKAGE_ROOT, 'vite.config.ts'), '--port', String(clientPort)],
|
|
193
|
+
{ stdio: 'inherit', env, cwd: PACKAGE_ROOT })
|
|
194
|
+
: spawn('npx', ['vite', '--config', path.join(PACKAGE_ROOT, 'vite.config.ts'), '--port', String(clientPort)],
|
|
195
|
+
{ stdio: 'inherit', env, cwd: PACKAGE_ROOT });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const dashboardUrl = useVite
|
|
199
|
+
? `http://localhost:${clientPort}`
|
|
200
|
+
: `http://localhost:${serverPort}`;
|
|
184
201
|
|
|
185
202
|
if (shouldOpen) {
|
|
186
|
-
setTimeout(() => openBrowser(
|
|
203
|
+
setTimeout(() => openBrowser(dashboardUrl), 2000);
|
|
187
204
|
}
|
|
188
205
|
|
|
189
206
|
let exiting = false;
|
|
@@ -192,7 +209,7 @@ function cmdDev() {
|
|
|
192
209
|
if (exiting) return;
|
|
193
210
|
exiting = true;
|
|
194
211
|
serverProcess.kill();
|
|
195
|
-
viteProcess.kill();
|
|
212
|
+
if (viteProcess) viteProcess.kill();
|
|
196
213
|
process.exit(0);
|
|
197
214
|
}
|
|
198
215
|
process.on('SIGINT', cleanup);
|
|
@@ -202,16 +219,18 @@ function cmdDev() {
|
|
|
202
219
|
if (exiting) return;
|
|
203
220
|
exiting = true;
|
|
204
221
|
console.log(`Server exited with code ${code}`);
|
|
205
|
-
viteProcess.kill();
|
|
206
|
-
process.exit(code || 0);
|
|
207
|
-
});
|
|
208
|
-
viteProcess.on('exit', (code) => {
|
|
209
|
-
if (exiting) return;
|
|
210
|
-
exiting = true;
|
|
211
|
-
console.log(`Vite exited with code ${code}`);
|
|
212
|
-
serverProcess.kill();
|
|
222
|
+
if (viteProcess) viteProcess.kill();
|
|
213
223
|
process.exit(code || 0);
|
|
214
224
|
});
|
|
225
|
+
if (viteProcess) {
|
|
226
|
+
viteProcess.on('exit', (code) => {
|
|
227
|
+
if (exiting) return;
|
|
228
|
+
exiting = true;
|
|
229
|
+
console.log(`Vite exited with code ${code}`);
|
|
230
|
+
serverProcess.kill();
|
|
231
|
+
process.exit(code || 0);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
215
234
|
}
|
|
216
235
|
|
|
217
236
|
function cmdBuild() {
|
|
@@ -290,7 +309,7 @@ Usage:
|
|
|
290
309
|
|
|
291
310
|
Commands:
|
|
292
311
|
init Scaffold Orbital Command into the current project
|
|
293
|
-
dev Start the
|
|
312
|
+
dev Start the Orbital Command dashboard
|
|
294
313
|
build Production build of the dashboard
|
|
295
314
|
emit <TYPE> <JSON> Emit an orbital event
|
|
296
315
|
update Re-copy hooks/skills/agents from package templates
|
|
@@ -303,6 +322,7 @@ Init Options:
|
|
|
303
322
|
|
|
304
323
|
Dev Options:
|
|
305
324
|
--open Open the dashboard in the default browser
|
|
325
|
+
--vite Force Vite dev server (for local development with HMR)
|
|
306
326
|
|
|
307
327
|
Examples:
|
|
308
328
|
orbital init
|
package/package.json
CHANGED