From f7a77533240ec435c8a7b103b6f6be409bf995d8 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sun, 9 Jun 2024 10:52:09 +0000 Subject: fix(cli): Fix CLI version in help message. Fixes #139 --- apps/cli/src/index.ts | 6 +++++- apps/cli/src/vite-env.d.ts | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 apps/cli/src/vite-env.d.ts (limited to 'apps/cli/src') diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.ts index 12cd7a13..a4f6f7b4 100644 --- a/apps/cli/src/index.ts +++ b/apps/cli/src/index.ts @@ -22,7 +22,11 @@ const program = new Command() .makeOptionMandatory(true) .env("HOARDER_SERVER_ADDR"), ) - .version(process.env.npm_package_version ?? "0.0.0"); + .version( + import.meta.env && "CLI_VERSION" in import.meta.env + ? import.meta.env.CLI_VERSION + : "0.0.0", + ); program.addCommand(bookmarkCmd); program.addCommand(listsCmd); diff --git a/apps/cli/src/vite-env.d.ts b/apps/cli/src/vite-env.d.ts new file mode 100644 index 00000000..604ce503 --- /dev/null +++ b/apps/cli/src/vite-env.d.ts @@ -0,0 +1,9 @@ +/// + +interface ImportMetaEnv { + readonly CLI_VERSION: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} -- cgit v1.2.3-70-g09d2