thinkncollab-cli 0.0.40 → 0.0.42
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/index.js +6 -0
- package/commands/version.js +17 -11
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -11,6 +11,8 @@ import Status from "../commands/status.js";
|
|
|
11
11
|
import pull from "../commands/pull.js";
|
|
12
12
|
import whoami from "../commands/whoami.js";
|
|
13
13
|
import help from "../commands/help.js";
|
|
14
|
+
import version from "../commands/version.js";
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
16
18
|
const VERSION_FILE = path.join(process.cwd(), ".tncversions");
|
|
@@ -473,6 +475,10 @@ async function main() {
|
|
|
473
475
|
|
|
474
476
|
case "help":
|
|
475
477
|
await help();
|
|
478
|
+
break;
|
|
479
|
+
|
|
480
|
+
case "version":
|
|
481
|
+
await version();
|
|
476
482
|
break;
|
|
477
483
|
|
|
478
484
|
default:
|
package/commands/version.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import path from "path";
|
|
4
|
-
import inquirer from "inquirer";
|
|
5
|
-
import axios from "axios";
|
|
1
|
+
// Assume your package.json is in project root
|
|
2
|
+
// and this file is in src/commands/version.js
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname, join } from 'path';
|
|
9
7
|
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
async function version() {
|
|
12
|
+
try {
|
|
13
|
+
const pkgPath = join(__dirname, '..', '..', 'package.json');
|
|
14
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
15
|
+
console.log(`ThinkNCollab CLI Version: ${pkg.version}`);
|
|
16
|
+
console.log(`ThinkNCollab CLI is Installed at: ${pkgPath}`);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.log("ThinkNCollab CLI Version: unknown");
|
|
19
|
+
}
|
|
20
|
+
}
|