From 57138914c667b61a329f7d5816f1d9076ba07d61 Mon Sep 17 00:00:00 2001 From: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com> Date: Sun, 2 Feb 2025 18:37:46 -0500 Subject: [PATCH] chore: read version from `tauri.conf.json` instead of hardcoding (#395) * chore: read version from tauri.conf.json instead of hardcoding * remove unrelevant --- src/manager/tabs/AboutTab.tsx | 2 +- src/vite-env.d.ts | 2 ++ src/vite.config.ts | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/manager/tabs/AboutTab.tsx b/src/manager/tabs/AboutTab.tsx index 6f3baf80..f12e74b3 100644 --- a/src/manager/tabs/AboutTab.tsx +++ b/src/manager/tabs/AboutTab.tsx @@ -33,7 +33,7 @@ const AboutTab = () => { Version - 0.0.1 + {__VERSION__} Authors diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 11f02fe2..b63e0333 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1 +1,3 @@ /// + +declare const __VERSION__: string; diff --git a/src/vite.config.ts b/src/vite.config.ts index 4f172cdb..f535cbc4 100644 --- a/src/vite.config.ts +++ b/src/vite.config.ts @@ -1,8 +1,12 @@ import { defineConfig } from "vite"; import { resolve } from "path"; import react from "@vitejs/plugin-react"; +import tauriConf from "../crates/deskulpt/tauri.conf.json"; export default defineConfig({ + define: { + __VERSION__: JSON.stringify(tauriConf.version), + }, plugins: [ react({ jsxImportSource: "@emotion/react",