@rpcbase/cli 0.19.0 → 0.21.0
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/bin.js +1 -1
- package/package.json +2 -2
- package/src/helpers/get_run_configs.js +21 -13
- package/src/start_command.js +2 -0
package/bin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"rb": "./bin.js"
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"picocolors": "1.0.0",
|
|
17
17
|
"semver": "7.3.7",
|
|
18
18
|
"validator": "13.7.0",
|
|
19
|
-
"yargs": "17.
|
|
19
|
+
"yargs": "17.6.2"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -5,11 +5,13 @@ const fs = require("fs")
|
|
|
5
5
|
const ERRORS = require("../errors")
|
|
6
6
|
const exit_with_message = require("./exit_with_message")
|
|
7
7
|
|
|
8
|
+
const {CONTAINER_MODE} = process.env
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
// run type is client | server | both
|
|
9
12
|
const get_run_configs = () => {
|
|
10
13
|
const cwd = process.cwd()
|
|
11
14
|
|
|
12
|
-
|
|
13
15
|
// check if running parent of rb project
|
|
14
16
|
const dir_contents = fs.readdirSync(cwd)
|
|
15
17
|
const is_parent_dir = dir_contents.includes("client") && dir_contents.includes("server")
|
|
@@ -23,8 +25,10 @@ const get_run_configs = () => {
|
|
|
23
25
|
return
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
let run_configs
|
|
29
|
+
|
|
26
30
|
if (is_parent_dir) {
|
|
27
|
-
|
|
31
|
+
run_configs = [
|
|
28
32
|
{
|
|
29
33
|
type: "client",
|
|
30
34
|
working_dir: path.join(cwd, "./client")
|
|
@@ -33,35 +37,39 @@ const get_run_configs = () => {
|
|
|
33
37
|
type: "server",
|
|
34
38
|
working_dir: path.join(cwd, "./server/server")
|
|
35
39
|
},
|
|
36
|
-
{
|
|
37
|
-
type: "agent",
|
|
38
|
-
working_dir: path.join(cwd, "./server/infrastructure")
|
|
39
|
-
},
|
|
40
40
|
]
|
|
41
41
|
} else {
|
|
42
42
|
// client
|
|
43
43
|
if (dir === "client") {
|
|
44
|
-
|
|
44
|
+
run_configs = [{
|
|
45
45
|
type: "client",
|
|
46
46
|
working_dir: cwd
|
|
47
47
|
}]
|
|
48
48
|
// check if parent dir is also server, because we are in server/server
|
|
49
49
|
} else if (dir === "server" && path.basename(path.dirname(cwd)) === "server") {
|
|
50
|
-
|
|
50
|
+
run_configs = [
|
|
51
51
|
{
|
|
52
52
|
type: "server",
|
|
53
53
|
working_dir: cwd
|
|
54
|
-
}
|
|
55
|
-
{
|
|
56
|
-
type: "agent",
|
|
57
|
-
working_dir: path.join(cwd, "../infrastructure")
|
|
58
|
-
},
|
|
54
|
+
}
|
|
59
55
|
]
|
|
60
56
|
} else {
|
|
61
57
|
console.log("TODO: server get_run_configs:handle edge case here")
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
if (run_configs) {
|
|
62
|
+
// check if there is server we add agent but in native mode only
|
|
63
|
+
const server = run_configs.find((rc) => rc.type === "server")
|
|
64
|
+
if (server && CONTAINER_MODE === "native") {
|
|
65
|
+
run_configs.push({
|
|
66
|
+
type: "agent",
|
|
67
|
+
working_dir: server.working_dir,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
return run_configs
|
|
71
|
+
}
|
|
72
|
+
|
|
65
73
|
// fails when no match found
|
|
66
74
|
exit_with_message(ERRORS.INVALID_CWD)
|
|
67
75
|
}
|
package/src/start_command.js
CHANGED