@md2do/cli 0.2.0 → 0.2.1
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/CHANGELOG.md +6 -0
- package/dist/cli.js +12 -1
- package/package.json +1 -1
- package/src/cli.ts +17 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @md2do/cli
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#11](https://github.com/TeamNickHart/md2do/pull/11) [`0e3f3ba`](https://github.com/TeamNickHart/md2do/commit/0e3f3ba9aa4fce44e45cfbc64b4f2a6bc6fd7cc4) Thanks [@nickhart](https://github.com/nickhart)! - Fix CLI version display to read from package.json instead of hardcoded value
|
|
8
|
+
|
|
3
9
|
## 0.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cli.js
CHANGED
|
@@ -25,6 +25,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
|
|
26
26
|
// src/cli.ts
|
|
27
27
|
var import_commander4 = require("commander");
|
|
28
|
+
var import_fs = require("fs");
|
|
29
|
+
var import_path = require("path");
|
|
28
30
|
|
|
29
31
|
// src/commands/list.ts
|
|
30
32
|
var import_commander = require("commander");
|
|
@@ -1169,8 +1171,17 @@ async function todoistSyncAction(options) {
|
|
|
1169
1171
|
}
|
|
1170
1172
|
|
|
1171
1173
|
// src/cli.ts
|
|
1174
|
+
var getVersion = () => {
|
|
1175
|
+
try {
|
|
1176
|
+
const packagePath = (0, import_path.join)(__dirname, "../package.json");
|
|
1177
|
+
const packageJson = JSON.parse((0, import_fs.readFileSync)(packagePath, "utf-8"));
|
|
1178
|
+
return packageJson.version;
|
|
1179
|
+
} catch {
|
|
1180
|
+
return "0.0.0";
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1172
1183
|
var program = new import_commander4.Command();
|
|
1173
|
-
program.name("md2do").description("Scan and manage TODOs in markdown files").version(
|
|
1184
|
+
program.name("md2do").description("Scan and manage TODOs in markdown files").version(getVersion());
|
|
1174
1185
|
program.addCommand(createListCommand());
|
|
1175
1186
|
program.addCommand(createStatsCommand());
|
|
1176
1187
|
program.addCommand(createTodoistCommand());
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
3
5
|
import {
|
|
4
6
|
createListCommand,
|
|
5
7
|
createStatsCommand,
|
|
6
8
|
createTodoistCommand,
|
|
7
9
|
} from './commands/index.js';
|
|
8
10
|
|
|
11
|
+
// Read version from package.json
|
|
12
|
+
// __dirname will be available in the compiled CJS output
|
|
13
|
+
const getVersion = (): string => {
|
|
14
|
+
try {
|
|
15
|
+
const packagePath = join(__dirname, '../package.json');
|
|
16
|
+
const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8')) as {
|
|
17
|
+
version: string;
|
|
18
|
+
};
|
|
19
|
+
return packageJson.version;
|
|
20
|
+
} catch {
|
|
21
|
+
return '0.0.0';
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
9
25
|
const program = new Command();
|
|
10
26
|
|
|
11
27
|
program
|
|
12
28
|
.name('md2do')
|
|
13
29
|
.description('Scan and manage TODOs in markdown files')
|
|
14
|
-
.version(
|
|
30
|
+
.version(getVersion());
|
|
15
31
|
|
|
16
32
|
// Add commands
|
|
17
33
|
program.addCommand(createListCommand());
|