@daylenjeez/ccm-switch 1.2.7 → 1.2.8
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/dist/index.js +6 -2
- package/package.json +1 -1
- package/src/index.ts +7 -2
package/dist/index.js
CHANGED
|
@@ -8,14 +8,18 @@ import { createInterface } from "readline";
|
|
|
8
8
|
import { spawnSync } from "child_process";
|
|
9
9
|
import { writeFileSync, readFileSync, unlinkSync, existsSync } from "fs";
|
|
10
10
|
import { tmpdir, homedir } from "os";
|
|
11
|
-
import { join } from "path";
|
|
11
|
+
import { join, dirname } from "path";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
12
13
|
import { t, setLocale } from "./i18n/index.js";
|
|
13
14
|
import * as clack from "@clack/prompts";
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const packageJsonPath = join(__dirname, "..", "package.json");
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
14
18
|
const program = new Command();
|
|
15
19
|
program
|
|
16
20
|
.name("ccm")
|
|
17
21
|
.description(t("program.description"))
|
|
18
|
-
.version(
|
|
22
|
+
.version(packageJson.version);
|
|
19
23
|
// Helper: prompt user for input
|
|
20
24
|
function ask(question) {
|
|
21
25
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -9,16 +9,21 @@ import { createInterface } from "readline";
|
|
|
9
9
|
import { spawnSync } from "child_process";
|
|
10
10
|
import { writeFileSync, readFileSync, unlinkSync, existsSync } from "fs";
|
|
11
11
|
import { tmpdir, homedir } from "os";
|
|
12
|
-
import { join } from "path";
|
|
12
|
+
import { join, dirname } from "path";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
13
14
|
import { t, setLocale } from "./i18n/index.js";
|
|
14
15
|
import * as clack from "@clack/prompts";
|
|
15
16
|
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const packageJsonPath = join(__dirname, "..", "package.json");
|
|
19
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
20
|
+
|
|
16
21
|
const program = new Command();
|
|
17
22
|
|
|
18
23
|
program
|
|
19
24
|
.name("ccm")
|
|
20
25
|
.description(t("program.description"))
|
|
21
|
-
.version(
|
|
26
|
+
.version(packageJson.version);
|
|
22
27
|
|
|
23
28
|
// Helper: prompt user for input
|
|
24
29
|
function ask(question: string): Promise<string> {
|