Spaces:
Running
Running
feat: use actual version
Browse files- packages/cli/src/cli.ts +12 -1
packages/cli/src/cli.ts
CHANGED
|
@@ -20,6 +20,17 @@ import { createInterface } from "readline";
|
|
| 20 |
import { platform } from "os";
|
| 21 |
import { readdir } from "fs/promises";
|
| 22 |
import { join } from "path";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
/**
|
| 25 |
* CLI-specific function to list available serial ports
|
|
@@ -464,7 +475,7 @@ program
|
|
| 464 |
.description(
|
| 465 |
"Control your robot with Node.js (inspired by LeRobot in Python)"
|
| 466 |
)
|
| 467 |
-
.version(
|
| 468 |
.addHelpText(
|
| 469 |
"after",
|
| 470 |
`
|
|
|
|
| 20 |
import { platform } from "os";
|
| 21 |
import { readdir } from "fs/promises";
|
| 22 |
import { join } from "path";
|
| 23 |
+
import { readFileSync } from "fs";
|
| 24 |
+
import { fileURLToPath } from "url";
|
| 25 |
+
import { dirname } from "path";
|
| 26 |
+
|
| 27 |
+
// Get package version dynamically
|
| 28 |
+
const __filename = fileURLToPath(import.meta.url);
|
| 29 |
+
const __dirname = dirname(__filename);
|
| 30 |
+
const packageJson = JSON.parse(
|
| 31 |
+
readFileSync(join(__dirname, "../package.json"), "utf8")
|
| 32 |
+
);
|
| 33 |
+
const version = packageJson.version;
|
| 34 |
|
| 35 |
/**
|
| 36 |
* CLI-specific function to list available serial ports
|
|
|
|
| 475 |
.description(
|
| 476 |
"Control your robot with Node.js (inspired by LeRobot in Python)"
|
| 477 |
)
|
| 478 |
+
.version(version)
|
| 479 |
.addHelpText(
|
| 480 |
"after",
|
| 481 |
`
|