summaryrefslogtreecommitdiff
path: root/packages/cli/src/utils/version.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/utils/version.ts')
-rw-r--r--packages/cli/src/utils/version.ts29
1 files changed, 2 insertions, 27 deletions
diff --git a/packages/cli/src/utils/version.ts b/packages/cli/src/utils/version.ts
index 8ccc3737..50b69350 100644
--- a/packages/cli/src/utils/version.ts
+++ b/packages/cli/src/utils/version.ts
@@ -4,31 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { readPackageUp } from 'read-package-up';
-import { fileURLToPath } from 'node:url';
-import { dirname } from 'node:path';
-
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = dirname(__filename);
-
-let cliVersion: string | undefined;
-
-export async function getCliVersion(): Promise<string> {
- if (cliVersion) {
- return cliVersion;
- }
-
- if (process.env.CLI_VERSION) {
- cliVersion = process.env.CLI_VERSION;
- return cliVersion;
- }
-
- try {
- const readUpResult = await readPackageUp({ cwd: __dirname });
- cliVersion = readUpResult?.packageJson.version || 'unknown';
- } catch (_e) {
- cliVersion = 'unknown';
- }
-
- return cliVersion;
+export function getCliVersion(): string {
+ return process.env.CLI_VERSION || process.version;
}