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.
- package/commands/version.js +17 -16
- package/package.json +1 -1
package/commands/version.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
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';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
9
10
|
|
|
10
11
|
async function version() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
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;
|