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 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:
@@ -1,14 +1,20 @@
1
- import fs from "fs";
2
- import os from "os";
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
- const homeDir = os.homedir();
8
- const pkg = path.join(homeDir, "AppData\Roaming\npm\thinkncollab-cli\package.json");
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
- if(fs.existsSync(pkg)) {
12
- const version = JSON.parse(fs.readFileSync(pkg, "utf-8")).version;
13
- console.log(`ThinkNCollab CLI Version: ${version}`);
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
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thinkncollab-cli",
3
3
  "author": "Raman Singh",
4
- "version": "0.0.40",
4
+ "version": "0.0.42",
5
5
  "description": "CLI tool for ThinkNCollab",
6
6
  "main": "index.js",
7
7
  "bin": {