Merge pull request #2533 from bluewave-labs/feat/version
feat: extract version from git tag
This commit is contained in:
3 files changed
+28
-9
No files matched your search
@@ -16,4 +16,8 @@ module.exports = {
|
|||||||
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
|
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
|
||||||
"react/no-unescaped-entities": "off",
|
"react/no-unescaped-entities": "off",
|
||||||
},
|
},
|
||||||
|
globals: {
|
||||||
|
__APP_VERSION__: "readonly",
|
||||||
|
process: "readonly",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
@@ -21,7 +21,7 @@ const SettingsAbout = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h2">
|
<Typography component="h2">
|
||||||
{t("common.appName")} {2.1}
|
{t("common.appName")} {__APP_VERSION__}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography sx={{ mt: theme.spacing(2), mb: theme.spacing(6), opacity: 0.6 }}>
|
<Typography sx={{ mt: theme.spacing(2), mb: theme.spacing(6), opacity: 0.6 }}>
|
||||||
{t("settingsPage.aboutSettings.labelDevelopedBy")}
|
{t("settingsPage.aboutSettings.labelDevelopedBy")}
|
||||||
|
|||||||
+23
-8
@@ -1,12 +1,27 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig, loadEnv } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
|
import { execSync } from "child_process";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
export default defineConfig(({ mode }) => {
|
||||||
export default defineConfig({
|
const env = loadEnv(mode, process.cwd(), "");
|
||||||
base: "/",
|
let version;
|
||||||
plugins: [svgr(), react()],
|
try {
|
||||||
optimizeDeps: {
|
version =
|
||||||
include: ["@mui/material/Tooltip", "@emotion/styled"],
|
env.VITE_APP_VERSION ||
|
||||||
},
|
execSync("git describe --tags --abbrev=0").toString().trim();
|
||||||
|
} catch (error) {
|
||||||
|
version = "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
base: "/",
|
||||||
|
plugins: [svgr(), react()],
|
||||||
|
optimizeDeps: {
|
||||||
|
include: ["@mui/material/Tooltip", "@emotion/styled"],
|
||||||
|
},
|
||||||
|
define: {
|
||||||
|
__APP_VERSION__: JSON.stringify(version),
|
||||||
|
},
|
||||||
|
};
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user