@alook/cli 0.0.1 → 0.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 +1 -1
- package/dist/index.js +21 -15
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -97,7 +97,7 @@ function isDev() {
|
|
|
97
97
|
return !!process.env.ALOOK_SERVER_URL;
|
|
98
98
|
}
|
|
99
99
|
function cmdPrefix() {
|
|
100
|
-
return isDev() ? "pnpm dev:cli" : "alook";
|
|
100
|
+
return isDev() ? "pnpm dev:cli" : "npx @alook/cli";
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// lib/config.ts
|
|
@@ -16367,25 +16367,31 @@ function emailCommand() {
|
|
|
16367
16367
|
|
|
16368
16368
|
// commands/version.ts
|
|
16369
16369
|
import { Command as Command6 } from "commander";
|
|
16370
|
+
|
|
16371
|
+
// lib/version.ts
|
|
16370
16372
|
import { readFileSync as readFileSync3 } from "fs";
|
|
16371
16373
|
import { join as join5, dirname as dirname4 } from "path";
|
|
16372
16374
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
16375
|
+
function getCurrentVersion() {
|
|
16376
|
+
const __dirname2 = dirname4(fileURLToPath2(import.meta.url));
|
|
16377
|
+
const candidates = [
|
|
16378
|
+
join5(__dirname2, "..", "package.json"),
|
|
16379
|
+
join5(__dirname2, "..", "..", "package.json")
|
|
16380
|
+
];
|
|
16381
|
+
for (const candidate of candidates) {
|
|
16382
|
+
try {
|
|
16383
|
+
const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
|
|
16384
|
+
if (typeof pkg.version === "string")
|
|
16385
|
+
return pkg.version;
|
|
16386
|
+
} catch {}
|
|
16387
|
+
}
|
|
16388
|
+
return "unknown";
|
|
16389
|
+
}
|
|
16390
|
+
|
|
16391
|
+
// commands/version.ts
|
|
16373
16392
|
function versionCommand() {
|
|
16374
16393
|
const cmd = new Command6("version").description("Show CLI version").action(() => {
|
|
16375
|
-
|
|
16376
|
-
let version3 = "unknown";
|
|
16377
|
-
try {
|
|
16378
|
-
const pkgPath = join5(__dirname2, "..", "package.json");
|
|
16379
|
-
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
16380
|
-
version3 = pkg.version;
|
|
16381
|
-
} catch {
|
|
16382
|
-
try {
|
|
16383
|
-
const pkgPath = join5(__dirname2, "..", "..", "package.json");
|
|
16384
|
-
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
16385
|
-
version3 = pkg.version;
|
|
16386
|
-
} catch {}
|
|
16387
|
-
}
|
|
16388
|
-
console.log(`alook version ${version3}`);
|
|
16394
|
+
console.log(`alook version ${getCurrentVersion()}`);
|
|
16389
16395
|
});
|
|
16390
16396
|
return cmd;
|
|
16391
16397
|
}
|