solo-doc 0.1.2 → 0.2.0

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.
@@ -15,10 +15,28 @@ const chalk_1 = __importDefault(require("chalk"));
15
15
  const path_1 = __importDefault(require("path"));
16
16
  const fs_1 = __importDefault(require("fs"));
17
17
  const program = new commander_1.Command();
18
+ const getPackageVersion = () => {
19
+ try {
20
+ // Try production path first (dist/bin -> root)
21
+ const prodPath = path_1.default.resolve(__dirname, '../../package.json');
22
+ if (fs_1.default.existsSync(prodPath)) {
23
+ return JSON.parse(fs_1.default.readFileSync(prodPath, 'utf-8')).version;
24
+ }
25
+ // Try dev path (bin -> root)
26
+ const devPath = path_1.default.resolve(__dirname, '../package.json');
27
+ if (fs_1.default.existsSync(devPath)) {
28
+ return JSON.parse(fs_1.default.readFileSync(devPath, 'utf-8')).version;
29
+ }
30
+ return '1.0.0';
31
+ }
32
+ catch (e) {
33
+ return '1.0.0';
34
+ }
35
+ };
18
36
  program
19
37
  .name('solo-doc')
20
38
  .description('CLI to crawl documentation sites and convert to single Markdown file')
21
- .version('1.0.0');
39
+ .version(getPackageVersion());
22
40
  // VS Command
23
41
  program
24
42
  .command('vs')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solo-doc",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "main": "dist/bin/solo-doc.js",
5
5
  "bin": {
6
6
  "solo-doc": "dist/bin/solo-doc.js"