From 6766974dd306aa32618d608abb06309b1dab31e3 Mon Sep 17 00:00:00 2001 From: Boshen Date: Mon, 29 Dec 2025 12:10:41 +0000 Subject: [PATCH] refactor(oxfmt,oxlint): replace OXC_VERSION with `env!("CARGO_PKG_VERSION")` (#17458) I didn't know this env variable existed when I built the first version of the CLI :-) --- .github/workflows/release_apps.yml | 2 -- Cross.toml | 1 - apps/oxfmt/src/cli/command.rs | 5 +---- apps/oxlint/src/command/mod.rs | 5 +---- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release_apps.yml b/.github/workflows/release_apps.yml index 4f1fb12cfa..d410a0f760 100644 --- a/.github/workflows/release_apps.yml +++ b/.github/workflows/release_apps.yml @@ -86,7 +86,6 @@ jobs: name: Build Oxlint ${{ matrix.code-target }} runs-on: ${{ matrix.os }} env: - OXC_VERSION: ${{ needs.check.outputs.oxlint_version }} # Required for `--version` to work. TARGET_CC: clang # for mimalloc defaults: run: @@ -253,7 +252,6 @@ jobs: name: Build Oxfmt ${{ matrix.code-target }} runs-on: ${{ matrix.os }} env: - OXC_VERSION: ${{ needs.check.outputs.oxfmt_version }} # Required for `--version` to work. TARGET_CC: clang # for mimalloc defaults: run: diff --git a/Cross.toml b/Cross.toml index 11961798fd..8cd2f3b6d1 100644 --- a/Cross.toml +++ b/Cross.toml @@ -2,5 +2,4 @@ passthrough = [ "CI", # for crates/oxc_traverse/build.rs "JEMALLOC_SYS_WITH_LG_PAGE", - "OXC_VERSION", ] diff --git a/apps/oxfmt/src/cli/command.rs b/apps/oxfmt/src/cli/command.rs index 74a74f220f..f384265de4 100644 --- a/apps/oxfmt/src/cli/command.rs +++ b/apps/oxfmt/src/cli/command.rs @@ -4,10 +4,7 @@ use bpaf::{Bpaf, Parser}; #[cfg(feature = "napi")] use cow_utils::CowUtils; -const VERSION: &str = match option_env!("OXC_VERSION") { - Some(v) => v, - None => "dev", -}; +const VERSION: &str = env!("CARGO_PKG_VERSION"); #[expect(clippy::ptr_arg)] fn validate_paths(paths: &Vec) -> bool { diff --git a/apps/oxlint/src/command/mod.rs b/apps/oxlint/src/command/mod.rs index 407f87c015..40ca0b9d12 100644 --- a/apps/oxlint/src/command/mod.rs +++ b/apps/oxlint/src/command/mod.rs @@ -10,10 +10,7 @@ pub use self::{ lint::{LintCommand, OutputOptions, ReportUnusedDirectives, WarningOptions, lint_command}, }; -const VERSION: &str = match option_env!("OXC_VERSION") { - Some(v) => v, - None => "dev", -}; +const VERSION: &str = env!("CARGO_PKG_VERSION"); /// Miscellaneous #[derive(Debug, Clone, Bpaf)]