@openremote/util 1.2.1 → 1.2.3-1

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.
Files changed (2) hide show
  1. package/cli.js +14 -11
  2. 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 get the openremote project dir or custom project dir */
10
- function getWorkingDirectory() {
11
- let dirs = __dirname.split(path.sep);
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
- if (fs.existsSync(path.join(cwd, "..", ".gitmodules"))) {
19
- // Assume we're in a custom project
20
- cwd = path.join(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 = getWorkingDirectory();
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openremote/util",
3
- "version": "1.2.1",
3
+ "version": "1.2.3-1",
4
4
  "description": "Build Util",
5
5
  "author": "OpenRemote",
6
6
  "main": "webpack.util.js",