100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
UI update: modified model-build.js to always run from root repo
Rich Turner4f58474c987f
diff --git a/ui/model-build.js b/ui/model-build.jsindex 724a28979..2d0ac4fab 100644--- a/ui/model-build.js+++ b/ui/model-build.js@@ -1,17 +1,34 @@var path = require("path");-const { spawnSync } = require('child_process');+const fs = require("fs");+const { spawnSync } = require("child_process");-let dirs = __dirname.split(path.sep);-dirs.pop();-let cwd = dirs.join(path.sep);-let isORRepo = dirs.pop() === "openremote";+function getWorkingDirectory() {+ let dirs = __dirname.split(path.sep);+ dirs.pop();-if (!isORRepo) {- cwd = path.join(cwd, "openremote");+ let cwd = dirs.join(path.sep);++ // Dirs is now the repo root but is this a custom project repo or OR repo+ let isDirCalledOR = dirs.pop() === "openremote";+ if(isDirCalledOR) {+ try {+ if (fs.existsSync(path.join(cwd, "..", ".gitmodules"))) {+ cwd = path.join(cwd, "..");+ }+ } catch(err) {+ console.error(err);+ process.exit(1);+ }+ }++ return cwd;}+let cwd = getWorkingDirectory();+console.log("Running gradlew modelWatch task...");const gradleModelWatch = spawnSync((process.platform === "win32" ? "gradlew" : "./gradlew"), ["modelWatch"], {cwd: cwd,shell: true});+console.log("gradlew modelWatch finished!");process.exit(gradleModelWatch.status);\ No newline at end of file