diff --git a/.eslintrc.js b/.eslintrc.js index 9d35205b6b..ffd9f2ef1c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,6 +37,11 @@ module.exports = { cordovaChromeapi: true, appAvailability: true, // end cordova bindings + + // globals for vite + __APP_PRODUCTNAME__: "readonly", + __APP_VERSION__: "readonly", + __APP_REVISION__: "readonly", }, // ignore src/dist folders ignorePatterns: ["src/dist/*"], diff --git a/src/js/main.js b/src/js/main.js index a3b1366e46..270ddc8c38 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -55,6 +55,10 @@ function readConfiguratorVersionMetadata() { CONFIGURATOR.productName = manifest.productName; CONFIGURATOR.version = manifest.version; CONFIGURATOR.gitRevision = manifest.gitRevision; + } else { + CONFIGURATOR.productName = __APP_PRODUCTNAME__; + CONFIGURATOR.version = __APP_VERSION__; + CONFIGURATOR.gitRevision = __APP_REVISION__; } } diff --git a/vite.config.js b/vite.config.js index 3baee1093b..131677365a 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,6 +4,9 @@ import vue from "@vitejs/plugin-vue2"; import path from "node:path"; import { readFileSync } from "node:fs"; import copy from "rollup-plugin-copy"; +import pkg from './package.json'; + +const childProcess = require('child_process'); function serveFileFromDirectory(directory) { return (req, res, next) => { @@ -46,6 +49,11 @@ function serveLocalesPlugin() { } export default defineConfig({ + define: { + '__APP_VERSION__': JSON.stringify(pkg.version), + '__APP_PRODUCTNAME__': JSON.stringify(pkg.productName), + '__APP_REVISION__': JSON.stringify(childProcess.execSync("git rev-parse --short HEAD").toString().trim()), + }, test: { // NOTE: this is a replacement location for karma tests. // moving forward we should colocate tests with the