Sync backend/frontend versions to Docker/VERSION and read version from it
This commit is contained in:
@@ -3,16 +3,19 @@ import react from "@vitejs/plugin-react";
|
||||
import { resolve } from "path";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
const pkg = JSON.parse(
|
||||
readFileSync(resolve(__dirname, "package.json"), "utf-8"),
|
||||
) as { version: string };
|
||||
const appVersion = readFileSync(
|
||||
resolve(__dirname, "../Docker/VERSION"),
|
||||
"utf-8",
|
||||
)
|
||||
.trim()
|
||||
.replace(/^v/, "");
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
define: {
|
||||
/** BanGUI application version injected at build time from package.json. */
|
||||
__APP_VERSION__: JSON.stringify(pkg.version),
|
||||
/** BanGUI application version injected at build time from Docker/VERSION. */
|
||||
__APP_VERSION__: JSON.stringify(appVersion),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user