diff options
| author | Tommaso Sciortino <[email protected]> | 2025-06-07 10:54:23 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-07 10:54:23 -0700 |
| commit | 680f4cdd61ab718d946afe0fd0d23828106bfda1 (patch) | |
| tree | 12e53678d67a24699f1be6a410dc469f7876b601 /packages/cli/src/utils/version.ts | |
| parent | 63757d6a7ae6dcff47e912578903ed4040b2b82f (diff) | |
More version simplifiction. (#810)
Diffstat (limited to 'packages/cli/src/utils/version.ts')
| -rw-r--r-- | packages/cli/src/utils/version.ts | 29 |
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; } |
