thinkncollab-cli 0.0.41 → 0.0.43

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.
Files changed (2) hide show
  1. package/commands/version.js +17 -16
  2. package/package.json +1 -1
@@ -1,20 +1,21 @@
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';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
9
10
 
10
11
  async function version() {
11
- if(fs.existsSync(pkg)) {
12
- const version = JSON.parse(fs.readFileSync(pkg, "utf-8")).version;
13
- console.log(`ThinkNCollab CLI Version: ${version}`);
14
- }
15
- else {
16
- console.log("ThinkNCollab CLI Version: Unknown");
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
+ }
17
20
  }
18
- }
19
- export default version;
20
-
21
+ export default version;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thinkncollab-cli",
3
3
  "author": "Raman Singh",
4
- "version": "0.0.41",
4
+ "version": "0.0.43",
5
5
  "description": "CLI tool for ThinkNCollab",
6
6
  "main": "index.js",
7
7
  "bin": {