feat(cli): embed release version via build.rs instead of CI string replacement#989
feat(cli): embed release version via build.rs instead of CI string replacement#989Nobody9512 wants to merge 3 commits intovoidzero-dev:mainfrom
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
| contents: read | ||
| env: | ||
| VERSION: ${{ needs.prepare.outputs.version }} | ||
| VITE_PLUS_VERSION: ${{ needs.prepare.outputs.version }} |
There was a problem hiding this comment.
should change to VP_VERSION instead of VITE_PLUS_VERSION after #1166
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c1d20fc47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -91,17 +92,10 @@ jobs: | |||
| shell: bash | |||
| run: | | |||
| pnpm exec tool replace-file-content packages/cli/binding/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"' | |||
There was a problem hiding this comment.
Restore CLI package version replacement for release builds
Keeping only packages/cli/binding/Cargo.toml replacement here leaves crates/vite_global_cli/Cargo.toml at 0.0.0 in release artifacts, but upgrade_check.rs still reads env!("CARGO_PKG_VERSION") (see check_for_update/display_upgrade_notice) and is_newer_version explicitly returns false for 0.0.0. In release binaries this disables background update notices entirely, which is a functional regression from the previous workflow where the CLI crate version was rewritten before building.
Useful? React with 👍 / 👎.
Summary
build.rstovite_global_clithat resolves the version at compile time through a 3-layer fallback:VITE_PLUS_VERSIONenv var →git describe --tags→CARGO_PKG_VERSIONenv!("CARGO_PKG_VERSION")withenv!("VITE_PLUS_VERSION")in the 3 call sites withinvite_global_cliVITE_PLUS_VERSIONenv var and remove the now-unnecessary string replacement forvite_global_cli/Cargo.tomlThis allows distro packagers (Nix, Homebrew, AUR) to build from source with the correct version by setting
VITE_PLUS_VERSION=x.y.z, and local dev builds in a git checkout will automatically pick up the version from git tags instead of showingvp v0.0.0.Closes #976