Skip to content

Commit

Permalink
Adding version details to the PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
blckmn committed Oct 14, 2023
1 parent 848d412 commit d195ef2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function readConfiguratorVersionMetadata() {
CONFIGURATOR.productName = manifest.productName;
CONFIGURATOR.version = manifest.version;
CONFIGURATOR.gitRevision = manifest.gitRevision;
} else {
CONFIGURATOR.productName = __APP_PRODUCTNAME__;

Check failure on line 59 in src/js/main.js

View workflow job for this annotation

GitHub Actions / CI / Test

'__APP_PRODUCTNAME__' is not defined
CONFIGURATOR.version = __APP_VERSION__;

Check failure on line 60 in src/js/main.js

View workflow job for this annotation

GitHub Actions / CI / Test

'__APP_VERSION__' is not defined
CONFIGURATOR.gitRevision = __APP_REVISION__;

Check failure on line 61 in src/js/main.js

View workflow job for this annotation

GitHub Actions / CI / Test

'__APP_REVISION__' is not defined
}
}

Expand Down
8 changes: 8 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d195ef2

Please sign in to comment.