congmao-cli 1.0.1 → 1.0.3
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/README.md +0 -2
- package/bin/index.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/bin/index.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { program } from "commander";
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { dirname, join } from "path";
|
|
4
7
|
import create from "../src/commands/create.js";
|
|
5
8
|
import mcp from "../src/commands/mcp.js";
|
|
6
9
|
import { showLogo } from "../src/utils/logo.js";
|
|
7
10
|
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
13
|
+
const packageJsonPath = join(__dirname, "../package.json");
|
|
14
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
15
|
+
|
|
8
16
|
showLogo();
|
|
9
17
|
|
|
10
|
-
program.name("cm-cli").version(
|
|
18
|
+
program.name("cm-cli").version(packageJson.version);
|
|
11
19
|
|
|
12
20
|
program.command("create").description("创建初始化项目").action(create);
|
|
13
21
|
|