@a83/orbiter-admin 0.3.17 → 0.3.18
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/package.json +1 -1
- package/src/cli.js +9 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -8,12 +8,16 @@ if (portIdx !== -1 && process.argv[portIdx + 1]) {
|
|
|
8
8
|
process.env.PORT = process.argv[portIdx + 1];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
// When run via `npm run --workspace=...`, npm sets CWD to the workspace dir.
|
|
12
|
+
// INIT_CWD is where the user actually ran npm — use that as base for relative paths.
|
|
13
|
+
const baseCwd = process.env.INIT_CWD || process.cwd();
|
|
14
|
+
|
|
11
15
|
// Resolve ORBITER_POD to absolute path (server.js does chdir, so must happen first)
|
|
12
16
|
if (process.env.ORBITER_POD) {
|
|
13
|
-
process.env.ORBITER_POD = resolve(process.env.ORBITER_POD);
|
|
17
|
+
process.env.ORBITER_POD = resolve(baseCwd, process.env.ORBITER_POD);
|
|
14
18
|
} else {
|
|
15
|
-
// Auto-detect a single .pod file in
|
|
16
|
-
const pods = readdirSync(
|
|
19
|
+
// Auto-detect a single .pod file in the directory where npm was invoked
|
|
20
|
+
const pods = readdirSync(baseCwd).filter(f => f.endsWith('.pod'));
|
|
17
21
|
if (pods.length === 0) {
|
|
18
22
|
console.error('Error: No .pod file found in current directory.');
|
|
19
23
|
console.error('Set ORBITER_POD=/path/to/content.pod or run from the directory containing your .pod file.');
|
|
@@ -21,10 +25,10 @@ if (process.env.ORBITER_POD) {
|
|
|
21
25
|
}
|
|
22
26
|
if (pods.length > 1) {
|
|
23
27
|
console.error('Multiple .pod files found. Specify one with ORBITER_POD:');
|
|
24
|
-
pods.forEach(p => console.error(' ORBITER_POD=' + resolve(p)));
|
|
28
|
+
pods.forEach(p => console.error(' ORBITER_POD=' + resolve(baseCwd, p)));
|
|
25
29
|
process.exit(1);
|
|
26
30
|
}
|
|
27
|
-
process.env.ORBITER_POD = resolve(pods[0]);
|
|
31
|
+
process.env.ORBITER_POD = resolve(baseCwd, pods[0]);
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
await import('./server.js');
|