@a83/orbiter-admin 0.3.14 → 0.3.15

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/src/cli.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import { readdirSync } from 'node:fs';
3
+ import { resolve } from 'node:path';
4
+
5
+ // --port flag → PORT env var
6
+ const portIdx = process.argv.indexOf('--port');
7
+ if (portIdx !== -1 && process.argv[portIdx + 1]) {
8
+ process.env.PORT = process.argv[portIdx + 1];
9
+ }
10
+
11
+ // Resolve ORBITER_POD to absolute path (server.js does chdir, so must happen first)
12
+ if (process.env.ORBITER_POD) {
13
+ process.env.ORBITER_POD = resolve(process.env.ORBITER_POD);
14
+ } else {
15
+ // Auto-detect a single .pod file in cwd
16
+ const pods = readdirSync('.').filter(f => f.endsWith('.pod'));
17
+ if (pods.length === 0) {
18
+ console.error('Error: No .pod file found in current directory.');
19
+ console.error('Set ORBITER_POD=/path/to/content.pod or run from the directory containing your .pod file.');
20
+ process.exit(1);
21
+ }
22
+ if (pods.length > 1) {
23
+ console.error('Multiple .pod files found. Specify one with ORBITER_POD:');
24
+ pods.forEach(p => console.error(' ORBITER_POD=' + resolve(p)));
25
+ process.exit(1);
26
+ }
27
+ process.env.ORBITER_POD = resolve(pods[0]);
28
+ }
29
+
30
+ await import('./server.js');