From c217aade591b9f51a9c70c0eadcf9ed8d6681f02 Mon Sep 17 00:00:00 2001 From: Tomas Chmelevskij Date: Sun, 31 Dec 2023 20:42:33 +0100 Subject: [PATCH] Fix/build output layout (#3716) * fix: `ol.css` for nwjs build * fix: global vars broken by race condition * fix: only copy node modules css --- gulpfile.js | 6 +++--- src/index.html | 1 - src/js/main.js | 9 ++++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 5c9c1274..043e0a93 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -380,14 +380,14 @@ function dist_src() { function dist_node_modules_css() { return gulp - .src("./**/*.min.css") - .pipe(gulp.dest(DIST_DIR)); + .src("./node_modules/**/*.min.css") + .pipe(gulp.dest(`${DIST_DIR}node_modules`)); } function dist_ol_css() { return gulp .src("./node_modules/ol/ol.css", { base: "node_modules" }) - .pipe(gulp.dest(DIST_DIR)); + .pipe(gulp.dest(`${DIST_DIR}css/tabs/`)); } function dist_less() { diff --git a/src/index.html b/src/index.html index 4622d75b..db16db64 100644 --- a/src/index.html +++ b/src/index.html @@ -337,6 +337,5 @@ - diff --git a/src/js/main.js b/src/js/main.js index c3643f33..e5df0c5c 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -56,9 +56,12 @@ function readConfiguratorVersionMetadata() { CONFIGURATOR.version = manifest.version; CONFIGURATOR.gitRevision = manifest.gitRevision; } else { - CONFIGURATOR.productName = __APP_PRODUCTNAME__; - CONFIGURATOR.version = __APP_VERSION__; - CONFIGURATOR.gitRevision = __APP_REVISION__; + // These are injected by vite. If not checking + // for undefined occasionally there is a race + // condition where this fails the nwjs and cordova builds + CONFIGURATOR.productName = typeof __APP_PRODUCTNAME__ !== 'undefined' ? __APP_PRODUCTNAME__ : 'Betaflight Configurator'; + CONFIGURATOR.version = typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : '0.0.0'; + CONFIGURATOR.gitRevision = typeof __APP_REVISION__ !== 'undefined' ? __APP_REVISION__ : 'unknown'; } }