From f4ea63c8f4cf087b6b5c1f2f5c0a7c41fbf47fb8 Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Thu, 18 Apr 2024 20:25:14 +0200 Subject: [PATCH] Use vite-plugin-version-mark to read project version Change-Id: I0d46dc57df025538379a2f0786d3e972c56dd248 --- index.html | 14 +++----------- package.json | 7 ++++--- vite.config.js | 11 ++++++++++- yarn.lock | 5 +++++ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 1b585a1..8588999 100644 --- a/index.html +++ b/index.html @@ -119,22 +119,14 @@
Loading...
- + + diff --git a/package.json b/package.json index dbacb99..55ce16e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "jest-fetch-mock": "^3.0.3", "prettier": "^3.2.5", "react-test-renderer": "^18.2.0", - "vite": "^5.0.0" + "vite": "^5.0.0", + "vite-plugin-version-mark": "^0.0.13" }, "dependencies": { "@haleos/ra-language-german": "^1.0.0", @@ -43,8 +44,8 @@ "react-dom": "^18.0.0" }, "scripts": { - "start": "REACT_APP_VERSION=$(git describe --tags) vite serve", - "build": "REACT_APP_VERSION=$(git describe --tags) vite build", + "start": "vite serve", + "build": "vite build", "fix:other": "yarn prettier --write", "fix:code": "yarn test:lint --fix", "fix": "yarn fix:code && yarn fix:other", diff --git a/vite.config.js b/vite.config.js index 081c8d9..7d3132c 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,6 +1,15 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +import { vitePluginVersionMark } from "vite-plugin-version-mark"; export default defineConfig({ - plugins: [react()], + plugins: [ + react(), + vitePluginVersionMark({ + command: "git describe --tags", + ifMeta: true, + ifLog: true, + ifGlobal: true, + }), + ], }); diff --git a/yarn.lock b/yarn.lock index 68bb320..733f91d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6411,6 +6411,11 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^2.0.0" +vite-plugin-version-mark@^0.0.13: + version "0.0.13" + resolved "https://registry.yarnpkg.com/vite-plugin-version-mark/-/vite-plugin-version-mark-0.0.13.tgz#dbdbbcba37eb0a9f7f4d2a3c65d05f5645cd65a6" + integrity sha512-myri8xZYEo2mqVJCAZYR+OIFUCdw9AWbl/a4RFucKtcQa4sMXsoxUcXUtBI9jyC2EZGBDHYE0FL22YLYxNZb0Q== + vite@^5.0.0: version "5.2.9" resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.9.tgz#cd9a356c6ff5f7456c09c5ce74068ffa8df743d9"