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
Updated npm run scripts for apps and demos
Rich Turner5c485b8c604a
diff --git a/ui/demo/demo-core/package.json b/ui/demo/demo-core/package.jsonindex ed75c9584..6d02c0e89 100644--- a/ui/demo/demo-core/package.json+++ b/ui/demo/demo-core/package.json@@ -5,9 +5,11 @@"private": true,"scripts": {"clean": "npx shx rm -rf dist",- "build": "node ../../model-build.js && npx tsc -b && npx cross-env NODE_ENV=production webpack",- "serve": "node ../../model-build.js && npx tsc -b && npx webpack-dev-server",- "watch": "node ../../model-build.js && npx tsc -b -w",+ "modelBuild": "node ../../model-build.js",+ "modelWatch": "node ../../model-watch.js",+ "build": "npx tsc -b && npx cross-env NODE_ENV=production webpack",+ "serve": "npx tsc -b && npx webpack-dev-server",+ "watch": "npx tsc -b -w","test": "echo \"Error: no test specified\" && exit 1"},"author": "OpenRemote",diff --git a/ui/demo/demo-or-header/package.json b/ui/demo/demo-or-header/package.jsonindex d9e7e0f6a..f75045fe2 100644--- a/ui/demo/demo-or-header/package.json+++ b/ui/demo/demo-or-header/package.json@@ -4,9 +4,11 @@"description": "Component Demo","scripts": {"clean": "npx shx rm -rf dist",- "build": "node ../../model-build.js && npx tsc -b && npx cross-env NODE_ENV=production webpack",- "serve": "node ../../model-build.js && npx tsc -b && npx webpack-dev-server",- "watch": "node ../../model-build.js && npx tsc -b -w",+ "modelBuild": "node ../../model-build.js",+ "modelWatch": "node ../../model-watch.js",+ "build": "npx tsc -b && npx cross-env NODE_ENV=production webpack",+ "serve": "npx tsc -b && npx webpack-dev-server",+ "watch": "npx tsc -b -w","test": "echo \"Error: no test specified\" && exit 1"},"author": "OpenRemote",diff --git a/ui/demo/demo-or-map/package.json b/ui/demo/demo-or-map/package.jsonindex 34b0c4274..d289a38d7 100644--- a/ui/demo/demo-or-map/package.json+++ b/ui/demo/demo-or-map/package.json@@ -4,8 +4,10 @@"description": "Component Demo","scripts": {"clean": "npx shx rm -rf dist",- "build": "node ../../model-build.js && npx tsc -b && npx cross-env NODE_ENV=production webpack",- "serve": "node ../../model-build.js && npx tsc -b && npx webpack-dev-server",+ "modelBuild": "node ../../model-build.js",+ "modelWatch": "node ../../model-watch.js",+ "build": "npx tsc -b && npx cross-env NODE_ENV=production webpack",+ "serve": "npx tsc -b && npx webpack-dev-server","watch": "node ../../model-build.js && npx tsc -b -w","test": "echo \"Error: no test specified\" && exit 1"},diff --git a/ui/demo/demo-or-thermostat/package.json b/ui/demo/demo-or-thermostat/package.jsonindex 6641737ac..8e7c68a09 100644--- a/ui/demo/demo-or-thermostat/package.json+++ b/ui/demo/demo-or-thermostat/package.json@@ -4,9 +4,11 @@"description": "Component Demo","scripts": {"clean": "npx shx rm -rf dist",- "build": "node ../../model-build.js && npx tsc -b && npx cross-env NODE_ENV=production webpack",- "serve": "node ../../model-build.js && npx tsc -b && npx webpack-dev-server",- "watch": "node ../../model-build.js && npx tsc -b -w",+ "modelBuild": "node ../../model-build.js",+ "modelWatch": "node ../../model-watch.js",+ "build": "npx tsc -b && npx cross-env NODE_ENV=production webpack",+ "serve": "npx tsc -b && npx webpack-dev-server",+ "watch": "npx tsc -b -w","test": "echo \"Error: no test specified\" && exit 1"},"author": "OpenRemote",diff --git a/ui/demo/demo-rest/package.json b/ui/demo/demo-rest/package.jsonindex 5f4b8efff..47e097d39 100644--- a/ui/demo/demo-rest/package.json+++ b/ui/demo/demo-rest/package.json@@ -5,9 +5,11 @@"private": true,"scripts": {"clean": "npx shx rm -rf dist",- "build": "node ../../model-build.js && npx tsc -b && npx cross-env NODE_ENV=production webpack",- "serve": "node ../../model-build.js && npx tsc -b && npx webpack-dev-server",- "watch": "node ../../model-build.js && npx tsc -b -w",+ "modelBuild": "node ../../model-build.js",+ "modelWatch": "node ../../model-watch.js",+ "build": "npx tsc -b && npx cross-env NODE_ENV=production webpack",+ "serve": "npx tsc -b && npx webpack-dev-server",+ "watch": "npx tsc -b -w","test": "echo \"Error: no test specified\" && exit 1"},"author": "OpenRemote",diff --git a/ui/model-watch.js b/ui/model-watch.jsnew file mode 100644index 000000000..85ca0d13b--- /dev/null+++ b/ui/model-watch.js@@ -0,0 +1,41 @@+var path = require("path");+const fs = require("fs");+const { spawn } = require("child_process");++function getWorkingDirectory() {+ let dirs = __dirname.split(path.sep);+ dirs.pop();++ 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("Watching model for changes...");+const child = spawn((process.platform === "win32" ? "gradlew" : "./gradlew"), ["-t", "modelWatch"], {+ cwd: cwd,+ shell: true+});+child.stdout.removeAllListeners("data");+child.stderr.removeAllListeners("data");+child.stdout.pipe(process.stdout);+child.stderr.pipe(process.stderr);++child.on("exit", function() {+ console.log("gradlew modelWatch finished! Status = " + child.status);+ process.exit(gradleModelWatch.status);+});\ No newline at end of file