mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-15 12:25:15 +03:00
Adding version details to the PWA (#3606)
* Adding version details to the PWA * Created a coded version.js that can be loaded as a module. * Reverting, and simply identifying the permissible global vars for Vite * Update .eslintrc.js Removing whitespace * Update vite.config.js
This commit is contained in:
parent
16df95118a
commit
d6575e175f
3 changed files with 17 additions and 0 deletions
|
@ -37,6 +37,11 @@ module.exports = {
|
||||||
cordovaChromeapi: true,
|
cordovaChromeapi: true,
|
||||||
appAvailability: true,
|
appAvailability: true,
|
||||||
// end cordova bindings
|
// end cordova bindings
|
||||||
|
|
||||||
|
// globals for vite
|
||||||
|
__APP_PRODUCTNAME__: "readonly",
|
||||||
|
__APP_VERSION__: "readonly",
|
||||||
|
__APP_REVISION__: "readonly",
|
||||||
},
|
},
|
||||||
// ignore src/dist folders
|
// ignore src/dist folders
|
||||||
ignorePatterns: ["src/dist/*"],
|
ignorePatterns: ["src/dist/*"],
|
||||||
|
|
|
@ -55,6 +55,10 @@ function readConfiguratorVersionMetadata() {
|
||||||
CONFIGURATOR.productName = manifest.productName;
|
CONFIGURATOR.productName = manifest.productName;
|
||||||
CONFIGURATOR.version = manifest.version;
|
CONFIGURATOR.version = manifest.version;
|
||||||
CONFIGURATOR.gitRevision = manifest.gitRevision;
|
CONFIGURATOR.gitRevision = manifest.gitRevision;
|
||||||
|
} else {
|
||||||
|
CONFIGURATOR.productName = __APP_PRODUCTNAME__;
|
||||||
|
CONFIGURATOR.version = __APP_VERSION__;
|
||||||
|
CONFIGURATOR.gitRevision = __APP_REVISION__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ import vue from "@vitejs/plugin-vue2";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { readFileSync } from "node:fs";
|
import { readFileSync } from "node:fs";
|
||||||
import copy from "rollup-plugin-copy";
|
import copy from "rollup-plugin-copy";
|
||||||
|
import pkg from './package.json';
|
||||||
|
|
||||||
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
function serveFileFromDirectory(directory) {
|
function serveFileFromDirectory(directory) {
|
||||||
return (req, res, next) => {
|
return (req, res, next) => {
|
||||||
|
@ -46,6 +49,11 @@ function serveLocalesPlugin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
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: {
|
test: {
|
||||||
// NOTE: this is a replacement location for karma tests.
|
// NOTE: this is a replacement location for karma tests.
|
||||||
// moving forward we should colocate tests with the
|
// moving forward we should colocate tests with the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue