infinicode 2.8.16 → 2.8.17
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/dist/robopark-cli.js +17 -1
- package/package.json +1 -1
package/dist/robopark-cli.js
CHANGED
|
@@ -8,16 +8,32 @@
|
|
|
8
8
|
import { Command } from 'commander';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
10
|
import Conf from 'conf';
|
|
11
|
+
import { readFileSync } from 'node:fs';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { dirname, join } from 'node:path';
|
|
11
14
|
import { attachRoboparkSubcommands as attachLegacy } from './commands/robopark.js';
|
|
12
15
|
import { roboparkScan } from './robopark/scan.js';
|
|
13
16
|
import { roboparkServe } from './robopark/serve.js';
|
|
14
17
|
import { roboparkSetup } from './robopark/setup.js';
|
|
18
|
+
// Read the real version from package.json so `--version` never drifts from
|
|
19
|
+
// what is actually installed (this was a hardcoded constant that went stale
|
|
20
|
+
// across several releases — see the identical fix + comment in cli.ts).
|
|
21
|
+
function pkgVersion() {
|
|
22
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
for (const rel of ['../package.json', '../../package.json']) {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(readFileSync(join(here, rel), 'utf8')).version ?? '0.0.0';
|
|
26
|
+
}
|
|
27
|
+
catch { /* try next */ }
|
|
28
|
+
}
|
|
29
|
+
return '0.0.0';
|
|
30
|
+
}
|
|
15
31
|
const config = new Conf({
|
|
16
32
|
projectName: 'infinicode',
|
|
17
33
|
});
|
|
18
34
|
const program = new Command('robopark')
|
|
19
35
|
.description('RoboPark fleet control CLI — set up, watch, and drive talking robots')
|
|
20
|
-
.version(
|
|
36
|
+
.version(pkgVersion());
|
|
21
37
|
program
|
|
22
38
|
.command('scan')
|
|
23
39
|
.description('Auto-discover the fleet and print ready-to-run setup commands')
|
package/package.json
CHANGED