@openremote/util 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +14 -11
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -6,18 +6,21 @@ const { spawn } = require("child_process");
|
|
|
6
6
|
|
|
7
7
|
/* THIS IS JUST A WRAPPER THAT LAUNCHES GRADLE TASKS */
|
|
8
8
|
|
|
9
|
-
/* Try and
|
|
10
|
-
function
|
|
11
|
-
let dirs =
|
|
12
|
-
dirs.pop();
|
|
13
|
-
|
|
14
|
-
// get CWD as the openremote repo root
|
|
9
|
+
/* Try and find the gradle wrapper in a parent dir */
|
|
10
|
+
function getGradleDirectory() {
|
|
11
|
+
let dirs = process.cwd().split(path.sep);
|
|
15
12
|
let cwd = dirs.join(path.sep);
|
|
16
|
-
cwd = path.join(cwd, "..");
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cwd =
|
|
14
|
+
while (dirs.length > 0 && !fs.existsSync(path.join(cwd, "gradlew"))) {
|
|
15
|
+
dirs.pop();
|
|
16
|
+
cwd = dirs.join(path.sep);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!fs.existsSync(path.join(cwd, "gradlew"))) {
|
|
20
|
+
console.log("Failed to locate gradlew in a parent directory of: " + process.cwd());
|
|
21
|
+
process.exit(1);
|
|
22
|
+
} else {
|
|
23
|
+
console.log("Located gradlew in parent directory: " + cwd);
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
return cwd;
|
|
@@ -44,7 +47,7 @@ if (process.argv.length >= 3 && process.argv[2] =="watch") {
|
|
|
44
47
|
} else {
|
|
45
48
|
|
|
46
49
|
// Do build
|
|
47
|
-
let cwd =
|
|
50
|
+
let cwd = getGradleDirectory();
|
|
48
51
|
console.log("Running gradlew modelBuild task in " + cwd + " ...");
|
|
49
52
|
const gradleModelWatch = spawnSync((process.platform === "win32" ? "gradlew" : "./gradlew"), ["modelWatch"], {
|
|
50
53
|
cwd: cwd,
|